(self, gt_segs, gt_masks, keep_inds=None)
return matched_gt
:param gt_segs: [1 x h x w] things: 1~8, stuff: 9~19
        :param gt_masks: [num_gt_boxes x h x w]
        :param keep_inds: [num_kept_boxes x 1]
        :return: matched_gt: [1 x h x w]
:param gt_segs: [1 x h x w] things: 1~8, stuff: 9~19
        :param gt_masks: [num_gt_boxes x h x w]
        :param keep_inds: [num_kept_boxes x 1]
        :return: matched_gt: [1 x h x w]
: param gt_segs : [ 1 x h x w ] things : 1~8 stuff : 9~19 : param gt_masks : [ num_gt_boxes x h x w ] : param keep_inds : [ num_kept_boxes x 1 ] : return : matched_gt : [ 1 x h x w ]
def forward(self, gt_segs, gt_masks, keep_inds=None):
        """
        :param gt_segs: [1 x h x w] things: 1~8, stuff: 9~19
        :param gt_masks: [num_gt_boxes x h x w]
        :param keep_inds: [num_kept_boxes x 1]
        :return: matched_gt: [1 x h x w]
        """
        gt_masks = torch.from_numpy(gt_masks).float().to(gt_segs.device)

        matched_gt = torch.ones_like(gt_segs) * -1
        # stuff classes into [0,10]
        matched_gt = torch.where(gt_segs <= self.num_stuff_classes -1, gt_segs, matched_gt)
        matched_gt = torch.where(gt_segs >= 255, gt_segs, matched_gt)
        if keep_inds is not None:
            gt_masks = gt_masks[keep_inds]
        # instance classe into [11,~]
        for i in range(gt_masks.shape[0]):
            matched_gt[(gt_masks[[i], :, :] != 0) & (gt_masks[[i], :, :] != 255)] = i + self.num_stuff_classes
        if keep_inds is not None:
            matched_gt[matched_gt == -1] = self.num_stuff_classes + gt_masks.shape[0]
        else:
            matched_gt[matched_gt == -1] = self.ignore_label

        return matched_gt
def forward ( self , gt_segs , gt_masks , keep_inds = None ) : gt_masks = torch . from_numpy ( gt_masks ) . float ( ) . to ( gt_segs . device ) matched_gt = torch . ones_like ( gt_segs ) * - 1 # stuff classes into [0,10] matched_gt = torch . where ( gt_segs <= self . num_stuff_classes - 1 , gt_segs , matched_gt ) matched_gt = torch . where ( gt_segs >= 255 , gt_segs , matched_gt ) if keep_inds is not None : gt_masks = gt_masks [ keep_inds ] # instance classe into [11,~] for i in range ( gt_masks . shape [ 0 ] ) : matched_gt [ ( gt_masks [ [ i ] , : , : ] != 0 ) & ( gt_masks [ [ i ] , : , : ] != 255 ) ] = i + self . num_stuff_classes if keep_inds is not None : matched_gt [ matched_gt == - 1 ] = self . num_stuff_classes + gt_masks . shape [ 0 ] else : matched_gt [ matched_gt == - 1 ] = self . ignore_label return matched_gt