(self, x, boxes)
return results
Arguments:
            x (Tensor): the mask logits
            boxes (list[BoxList]): bounding boxes that are used as
                reference, one for ech image

        Returns:
            results (list[BoxList]): one BoxList for each image, containing
                the extra field mask
Arguments:
            x (Tensor): the mask logits
            boxes (list[BoxList]): bounding boxes that are used as
                reference, one for ech image
Arguments : x ( Tensor ) : the mask logits boxes ( list [ BoxList ] ) : bounding boxes that are used as reference one for ech image
def forward(self, x, boxes):
        """
        Arguments:
            x (Tensor): the mask logits
            boxes (list[BoxList]): bounding boxes that are used as
                reference, one for ech image

        Returns:
            results (list[BoxList]): one BoxList for each image, containing
                the extra field mask
        """
        mask_prob = x.sigmoid()

        # select masks coresponding to the predicted classes
        num_masks = x.shape[0]
        labels = [bbox.get_field("labels") for bbox in boxes]
        labels = torch.cat(labels)
        index = torch.arange(num_masks, device=labels.device)
        mask_prob = mask_prob[index, labels][:, None]

        boxes_per_image = [len(box) for box in boxes]
        mask_prob = mask_prob.split(boxes_per_image, dim=0)

        if self.masker:
            mask_prob = self.masker(mask_prob, boxes)

        results = []
        for prob, box in zip(mask_prob, boxes):
            bbox = BoxList(box.bbox, box.size, mode="xyxy")
            for field in box.fields():
                bbox.add_field(field, box.get_field(field))
            bbox.add_field("mask", prob)
            results.append(bbox)

        return results
def forward ( self , x , boxes ) : mask_prob = x . sigmoid ( ) # select masks coresponding to the predicted classes num_masks = x . shape [ 0 ] labels = [ bbox . get_field ( "labels" ) for bbox in boxes ] labels = torch . cat ( labels ) index = torch . arange ( num_masks , device = labels . device ) mask_prob = mask_prob [ index , labels ] [ : , None ] boxes_per_image = [ len ( box ) for box in boxes ] mask_prob = mask_prob . split ( boxes_per_image , dim = 0 ) if self . masker : mask_prob = self . masker ( mask_prob , boxes ) results = [ ] for prob , box in zip ( mask_prob , boxes ) : bbox = BoxList ( box . bbox , box . size , mode = "xyxy" ) for field in box . fields ( ) : bbox . add_field ( field , box . get_field ( field ) ) bbox . add_field ( "mask" , prob ) results . append ( bbox ) return results