Skip to content

Commit 2848885

Browse files
YzichenMengzhangLIMeowZheng
authored
fix bug about label_map (open-mmlab#1445)
* fix bug about label_map * Update mmseg/datasets/pipelines/loading.py Co-authored-by: MengzhangLI <[email protected]> * lint Co-authored-by: MengzhangLI <[email protected]> Co-authored-by: MeowZheng <[email protected]>
1 parent 4bd32f4 commit 2848885

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mmseg/datasets/pipelines/loading.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,12 @@ def __call__(self, results):
135135
backend=self.imdecode_backend).squeeze().astype(np.uint8)
136136
# modify if custom classes
137137
if results.get('label_map', None) is not None:
138+
# Add deep copy to solve bug of repeatedly
139+
# replace `gt_semantic_seg`, which is reported in
140+
# https://github.com/open-mmlab/mmsegmentation/pull/1445/
141+
gt_semantic_seg_copy = gt_semantic_seg.copy()
138142
for old_id, new_id in results['label_map'].items():
139-
gt_semantic_seg[gt_semantic_seg == old_id] = new_id
143+
gt_semantic_seg[gt_semantic_seg_copy == old_id] = new_id
140144
# reduce zero_label
141145
if self.reduce_zero_label:
142146
# avoid using underflow conversion

0 commit comments

Comments
 (0)