mirror of
https://github.com/open-mmlab/mmsegmentation.git
synced 2025-06-03 22:03:48 +08:00
fix bug about label_map (#1445)
* fix bug about label_map * Update mmseg/datasets/pipelines/loading.py Co-authored-by: MengzhangLI <mcmong@pku.edu.cn> * lint Co-authored-by: MengzhangLI <mcmong@pku.edu.cn> Co-authored-by: MeowZheng <meowzheng@outlook.com>
This commit is contained in:
parent
4bd32f4c3d
commit
28488851fd
@ -135,8 +135,12 @@ class LoadAnnotations(object):
|
|||||||
backend=self.imdecode_backend).squeeze().astype(np.uint8)
|
backend=self.imdecode_backend).squeeze().astype(np.uint8)
|
||||||
# modify if custom classes
|
# modify if custom classes
|
||||||
if results.get('label_map', None) is not None:
|
if results.get('label_map', None) is not None:
|
||||||
|
# Add deep copy to solve bug of repeatedly
|
||||||
|
# replace `gt_semantic_seg`, which is reported in
|
||||||
|
# https://github.com/open-mmlab/mmsegmentation/pull/1445/
|
||||||
|
gt_semantic_seg_copy = gt_semantic_seg.copy()
|
||||||
for old_id, new_id in results['label_map'].items():
|
for old_id, new_id in results['label_map'].items():
|
||||||
gt_semantic_seg[gt_semantic_seg == old_id] = new_id
|
gt_semantic_seg[gt_semantic_seg_copy == old_id] = new_id
|
||||||
# reduce zero_label
|
# reduce zero_label
|
||||||
if self.reduce_zero_label:
|
if self.reduce_zero_label:
|
||||||
# avoid using underflow conversion
|
# avoid using underflow conversion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user