facebookresearch / Mask2Former

Code release for "Masked-attention Mask Transformer for Universal Image Segmentation"
MIT License
2.54k stars 384 forks source link

Why are there empty images during training phase ? #118

Open Yangr116 opened 2 years ago

Yangr116 commented 2 years ago

Hi, thanks for your nice work! I have a question about the mask2fomer on the instance segmentation task. I added assert targets_per_image.gt_classes.shape[0] != 0, f"mask2former, num_instances=0, {targets_per_image}" at the line of 268 to check targets. This assertion is triggered: AssertionError: mask2former, num_instances=0, Instances(num_instances=0, image_height=512, image_width=512, fields= [gt_boxes: Boxes(tensor([], device='cuda:0', size=(0, 4))), gt_classes: tensor([], device='cuda:0', dtype=torch.int64), gt_masks: tensor([], device='cuda:0', size=(0, 512, 512), dtype=torch.uint8)]) This shows that the mask2former uses empty images during the training phase. Is that right? However, the dataloader maybe filter images without annotations because cfg.DATALOADER.FILTER_EMPTY_ANNOTATIONS is True. Could you help me tackle these puzzles? Looking forward to your reply~

bowenc0221 commented 2 years ago

The image may contain no object after data augmentation.