(self, anchors, box_cls, box_regression, targets)
return retinanet_cls_loss, retinanet_regression_loss
Arguments:
            anchors (list[BoxList])
            box_cls (list[Tensor])
            box_regression (list[Tensor])
            targets (list[BoxList])

        Returns:
            retinanet_cls_loss (Tensor)
            retinanet_regression_loss (Tensor
Arguments:
            anchors (list[BoxList])
            box_cls (list[Tensor])
            box_regression (list[Tensor])
            targets (list[BoxList])
Arguments : anchors ( list [ BoxList ] ) box_cls ( list [ Tensor ] ) box_regression ( list [ Tensor ] ) targets ( list [ BoxList ] )
def __call__(self, anchors, box_cls, box_regression, targets):
        """
        Arguments:
            anchors (list[BoxList])
            box_cls (list[Tensor])
            box_regression (list[Tensor])
            targets (list[BoxList])

        Returns:
            retinanet_cls_loss (Tensor)
            retinanet_regression_loss (Tensor
        """
        anchors = [cat_boxlist(anchors_per_image) for anchors_per_image in anchors]
        labels, regression_targets = self.prepare_targets(anchors, targets)

        N = len(labels)
        box_cls, box_regression = \
                concat_box_prediction_layers(box_cls, box_regression)

        labels = torch.cat(labels, dim=0)
        regression_targets = torch.cat(regression_targets, dim=0)
        pos_inds = torch.nonzero(labels > 0).squeeze(1)

        retinanet_regression_loss = smooth_l1_loss(
            box_regression[pos_inds],
            regression_targets[pos_inds],
            beta=self.bbox_reg_beta,
            size_average=False,
        ) / (max(1, pos_inds.numel() * self.regress_norm))

        labels = labels.int()

        retinanet_cls_loss = self.box_cls_loss_func(
            box_cls,
            labels
        ) / (pos_inds.numel() + N)

        return retinanet_cls_loss, retinanet_regression_loss
def __call__ ( self , anchors , box_cls , box_regression , targets ) : anchors = [ cat_boxlist ( anchors_per_image ) for anchors_per_image in anchors ] labels , regression_targets = self . prepare_targets ( anchors , targets ) N = len ( labels ) box_cls , box_regression = concat_box_prediction_layers ( box_cls , box_regression ) labels = torch . cat ( labels , dim = 0 ) regression_targets = torch . cat ( regression_targets , dim = 0 ) pos_inds = torch . nonzero ( labels > 0 ) . squeeze ( 1 ) retinanet_regression_loss = smooth_l1_loss ( box_regression [ pos_inds ] , regression_targets [ pos_inds ] , beta = self . bbox_reg_beta , size_average = False , ) / ( max ( 1 , pos_inds . numel ( ) * self . regress_norm ) ) labels = labels . int ( ) retinanet_cls_loss = self . box_cls_loss_func ( box_cls , labels ) / ( pos_inds . numel ( ) + N ) return retinanet_cls_loss , retinanet_regression_loss