(self, features, proposals, targets=None, prefix='')
return x, detections, losses
prefix (str): Some model may use auxiliary heads which don't share rpn,
        use this to separate the loss names
prefix (str): Some model may use auxiliary heads which don't share rpn,
        use this to separate the loss names
prefix ( str ) : Some model may use auxiliary heads which don t share rpn use this to separate the loss names
def forward(self, features, proposals, targets=None, prefix=''):
        """
        prefix (str): Some model may use auxiliary heads which don't share rpn,
        use this to separate the loss names
        """
        losses = {}
        # TODO rename x to roi_box_features, if it doesn't increase memory consumption
        x, detections, loss_box = self.box(features, proposals, targets)
        losses.update(loss_box)
        if self.cfg.MODEL.MASK_ON:
            mask_features = features
            # optimization: during training, if we share the feature extractor between
            # the box and the mask heads, then we can reuse the features already computed
            if (
                self.training
                and self.cfg.MODEL.ROI_MASK_HEAD.SHARE_BOX_FEATURE_EXTRACTOR
            ):
                mask_features = x
            # During training, self.box() will return the unaltered proposals as "detections"
            # this makes the API consistent during training and testing
            x, detections, loss_mask = self.mask(mask_features, detections, targets)
            losses.update(loss_mask)
        
        if self.cfg.MODEL.KEYPOINT_ON:
            keypoint_features = features
            # optimization: during training, if we share the feature extractor between
            # the box and the mask heads, then we can reuse the features already computed
            if (
                self.training
                and self.cfg.MODEL.ROI_KEYPOINT_HEAD.SHARE_BOX_FEATURE_EXTRACTOR
            ):
                keypoint_features = x
            # During training, self.box() will return the unaltered proposals as "detections"
            # this makes the API consistent during training and testing
            x, detections, loss_keypoint = self.keypoint(keypoint_features, detections, targets)
            losses.update(loss_keypoint)


        # BDN KE
        if self.cfg.MODEL.KE_ON:
            ke_features = features
            if (
                self.training
                and self.cfg.MODEL.ROI_KE_HEAD.SHARE_BOX_FEATURE_EXTRACTOR
            ):
                ke_features = x
            x, detections, loss_ke, loss_mty = self.ke(ke_features, detections, targets)
            losses.update(loss_ke)
            losses.update(loss_mty)

        losses = {prefix + k: losses[k] for k in losses}
        return x, detections, losses
def forward ( self , features , proposals , targets = None , prefix = '' ) : losses = { } # TODO rename x to roi_box_features, if it doesn't increase memory consumption x , detections , loss_box = self . box ( features , proposals , targets ) losses . update ( loss_box ) if self . cfg . MODEL . MASK_ON : mask_features = features # optimization: during training, if we share the feature extractor between # the box and the mask heads, then we can reuse the features already computed if ( self . training and self . cfg . MODEL . ROI_MASK_HEAD . SHARE_BOX_FEATURE_EXTRACTOR ) : mask_features = x # During training, self.box() will return the unaltered proposals as "detections" # this makes the API consistent during training and testing x , detections , loss_mask = self . mask ( mask_features , detections , targets ) losses . update ( loss_mask ) if self . cfg . MODEL . KEYPOINT_ON : keypoint_features = features # optimization: during training, if we share the feature extractor between # the box and the mask heads, then we can reuse the features already computed if ( self . training and self . cfg . MODEL . ROI_KEYPOINT_HEAD . SHARE_BOX_FEATURE_EXTRACTOR ) : keypoint_features = x # During training, self.box() will return the unaltered proposals as "detections" # this makes the API consistent during training and testing x , detections , loss_keypoint = self . keypoint ( keypoint_features , detections , targets ) losses . update ( loss_keypoint ) # BDN KE if self . cfg . MODEL . KE_ON : ke_features = features if ( self . training and self . cfg . MODEL . ROI_KE_HEAD . SHARE_BOX_FEATURE_EXTRACTOR ) : ke_features = x x , detections , loss_ke , loss_mty = self . ke ( ke_features , detections , targets ) losses . update ( loss_ke ) losses . update ( loss_mty ) losses = { prefix + k : losses [ k ] for k in losses } return x , detections , losses