diff --git a/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py b/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py index b7386f746..9690c0dfa 100644 --- a/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py +++ b/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py @@ -116,7 +116,10 @@ def prepare_for_coco_segmentation(predictions, dataset): prediction = prediction.resize((image_width, image_height)) masks = prediction.get_field("mask") # t = time.time() - masks = masker(masks, prediction) + # Masker is necessary only if masks haven't been already resized. + if list(masks.shape[-2:]) != [image_height, image_width]: + masks = masker(masks.expand(1, -1, -1, -1, -1), prediction) + masks = masks[0] # logger.info('Time mask: {}'.format(time.time() - t)) # prediction = prediction.convert('xywh')