Exemple #1
0
 def _forward_train(self, image, im_info, gt_boxes):
     loss_dict = {}
     fpn_fms = self.FPN(image)
     # fpn_fms stride: 64,32,16,8,4, p6->p2
     rpn_rois, loss_dict_rpn = self.RPN(fpn_fms, im_info, gt_boxes)
     rcnn_rois, rcnn_labels, rcnn_bbox_targets = fpn_roi_target(
             rpn_rois, im_info, gt_boxes, top_k=1)
     loss_dict_rcnn = self.RCNN(fpn_fms, rcnn_rois,
             rcnn_labels, rcnn_bbox_targets)
     loss_dict.update(loss_dict_rpn)
     loss_dict.update(loss_dict_rcnn)
     return loss_dict
Exemple #2
0
 def _forward_train(self, image, im_info, gt_boxes):
     loss_dict = {}
     fpn_fms = self.FPN(image)
     # fpn_fms stride: 64,32,16,8,4, p6->p2
     rpn_rois, loss_dict_rpn = self.RPN(fpn_fms, im_info, gt_boxes)
     rcnn_rois, rcnn_labels, rcnn_bbox_targets = fpn_roi_target(
             rpn_rois, im_info, gt_boxes, top_k=1)
     proposals, loss_dict_cascade_0 = self.Cascade_0(
             fpn_fms, rcnn_rois, rcnn_labels, rcnn_bbox_targets)
     cascade_rois, cascade_labels, cascade_bbox_targets = cascade_roi_target(
             proposals, im_info, gt_boxes, pos_threshold=0.6, top_k=2)
     #proposals, loss_dict_cascade_1 = self.Cascade_1(
     #        fpn_fms, cascade_rois, cascade_labels, cascade_bbox_targets)
     #cascade_rois, cascade_labels, cascade_bbox_targets = cascade_roi_target(
     #        proposals, im_info, gt_boxes, pos_threshold=0.7, top_k=2)
     loss_dict_rcnn = self.RCNN(fpn_fms, cascade_rois,
             cascade_labels, cascade_bbox_targets)
     loss_dict.update(loss_dict_rpn)
     loss_dict.update(loss_dict_cascade_0)
     #loss_dict.update(loss_dict_cascade_1)
     loss_dict.update(loss_dict_rcnn)
     return loss_dict