huiserwang / ContrastMask

Official code for "ContrastMask: Contrastive Learning to Segment Every Thing" (CVPR2022)
https://arxiv.org/abs/2203.09775
30 stars 3 forks source link

Questions about loss_mask valid_masks? #6

Closed niecongchong closed 1 year ago

niecongchong commented 1 year ago
valid_masks = torch.logical_and(is_base, gt_proposal)

loss_mask = self.mask_head.loss(mask_pred[valid_masks],
                                        mask_targets[valid_masks],
                                        pos_labels[valid_masks])

In the code of roi_head.py, loss_mask is only calculated for the base set, because the novel set has no mask tag in the setting. My question is that why valid_masks!=is_base, but valid_masks = torch.logical_and(is_base, gt_proposal), which means that only when a gt is used as a proposal and the gt belongs to the base set, the loss_mask will be calculated.

Thank you for your help.

huiserwang commented 1 year ago

It's just a trick. We find that only using gt proposals (or high-quality proposals) is better. This is also verified by DeepMAC(ICCV21).

niecongchong commented 1 year ago

Thank you