Skip to content

Commit add835b

Browse files
Avoid converting label ids twice by label map during evaluation (open-mmlab#1417)
* Avoid converting label ids twice by label map during evaluation * Update mmseg/datasets/custom.py Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com> * lint Co-authored-by: Miao Zheng <76149310+MeowZheng@users.noreply.github.com> Co-authored-by: MeowZheng <meowzheng@outlook.com>
1 parent a09df2c commit add835b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

Diff for: mmseg/datasets/custom.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,18 @@ def pre_eval(self, preds, indices):
298298
for pred, index in zip(preds, indices):
299299
seg_map = self.get_gt_seg_map_by_idx(index)
300300
pre_eval_results.append(
301-
intersect_and_union(pred, seg_map, len(self.CLASSES),
302-
self.ignore_index, self.label_map,
303-
self.reduce_zero_label))
301+
intersect_and_union(
302+
pred,
303+
seg_map,
304+
len(self.CLASSES),
305+
self.ignore_index,
306+
# as the labels has been converted when dataset initialized
307+
# in `get_palette_for_custom_classes ` this `label_map`
308+
# should be `dict()`, see
309+
# https://github.com/open-mmlab/mmsegmentation/issues/1415
310+
# for more ditails
311+
label_map=dict(),
312+
reduce_zero_label=self.reduce_zero_label))
304313

305314
return pre_eval_results
306315

@@ -417,7 +426,7 @@ def evaluate(self,
417426
num_classes,
418427
self.ignore_index,
419428
metric,
420-
label_map=self.label_map,
429+
label_map=dict(),
421430
reduce_zero_label=self.reduce_zero_label)
422431
# test a list of pre_eval_results
423432
else:

0 commit comments

Comments
 (0)