def _network(self):
        ''' Define the network outputs '''
        with tf.variable_scope('model'):
            self.cnn = convnet(self.x, [5, 3, 3, 3, 3],
                               [64, 96, 128, 172, 256],
                               strides=[2, 2, 2, 2, 2])
            featureMaps = self.cnn.get_output()
            _feat_stride = self.cnn.get_feat_stride()

            # Region Proposal Network (RPN)
            self.rpn_net = rpn(featureMaps, self.gt_boxes, self.im_dims,
                               _feat_stride, flags)

            rpn_cls_score = self.rpn_net.get_rpn_cls_score()
            rpn_bbox_pred = self.rpn_net.get_rpn_bbox_pred()

            # Roi Pooling
            roi_proposal_net = roi_proposal(rpn_cls_score, rpn_bbox_pred,
                                            self.gt_boxes, self.im_dims, flags)

            # R-CNN Classification
            self.fast_rcnn_net = fast_rcnn(featureMaps, roi_proposal_net)

        with tf.variable_scope('model', reuse=True):
            assert tf.get_variable_scope().reuse is True
            self.cnn_valid = convnet(self.x_valid, [5, 3, 3, 3, 3],
                                     [64, 96, 128, 172, 256],
                                     strides=[2, 2, 2, 2, 2])
            featureMaps_valid = self.cnn_valid.get_output()
            _feat_stride_valid = self.cnn_valid.get_feat_stride()

            # Region Proposal Network (RPN)
            self.rpn_net_valid = rpn(featureMaps_valid, self.gt_boxes_valid,
                                     self.im_dims_valid, _feat_stride_valid,
                                     flags)

            rpn_cls_score_valid = self.rpn_net_valid.get_rpn_cls_score()
            rpn_bbox_pred_valid = self.rpn_net_valid.get_rpn_bbox_pred()

            # Roi Pooling
            self.roi_proposal_net_valid = roi_proposal(rpn_cls_score_valid,
                                                       rpn_bbox_pred_valid,
                                                       self.gt_boxes_valid,
                                                       self.im_dims_valid,
                                                       flags)

            # R-CNN Classification
            self.fast_rcnn_net_valid = fast_rcnn(featureMaps_valid,
                                                 self.roi_proposal_net_valid)
    def _faster_rcnn(self, x, gt_boxes, im_dims, key):
        self.cnn[key] = convnet(x, [5, 3, 3, 3, 3], [64, 96, 128, 172, 256], strides=[2, 2, 2, 2, 2])
        featureMaps = self.cnn[key].get_output()
        _feat_stride = self.cnn[key].get_feat_stride()

        # Region Proposal Network (RPN)
        self.rpn_net[key] = rpn(featureMaps, gt_boxes, im_dims, _feat_stride, flags)

        # Roi Pooling
        self.roi_proposal_net[key] = roi_proposal(self.rpn_net[key], gt_boxes, im_dims, key, flags)

        # R-CNN Classification
        self.fast_rcnn_net[key] = fast_rcnn(featureMaps, self.roi_proposal_net[key])
예제 #3
0
    def _network(self):
        ''' Define the network outputs '''
        with tf.variable_scope('model'):
            self.cnn = convnet(self.x, [5, 3, 3, 3, 3], [64, 96, 128, 172, 256], strides=[2, 2, 2, 2, 2])
            featureMaps = self.cnn.get_output()
            _feat_stride = self.cnn.get_feat_stride()

            # Region Proposal Network (RPN)
            self.rpn_net = rpn(featureMaps, self.gt_boxes, self.im_dims, _feat_stride, flags)

            rpn_cls_score = self.rpn_net.get_rpn_cls_score()
            rpn_bbox_pred = self.rpn_net.get_rpn_bbox_pred()

            # Roi Pooling
            roi_proposal_net = roi_proposal(rpn_cls_score, rpn_bbox_pred, self.gt_boxes, self.im_dims, flags)

            # R-CNN Classification
            self.fast_rcnn_net = fast_rcnn(featureMaps, roi_proposal_net)

        with tf.variable_scope('model', reuse=True):
            assert tf.get_variable_scope().reuse is True
            self.cnn_valid = convnet(self.x_valid, [5, 3, 3, 3, 3], [64, 96, 128, 172, 256], strides=[2, 2, 2, 2, 2])
            featureMaps_valid = self.cnn_valid.get_output()
            _feat_stride_valid = self.cnn_valid.get_feat_stride()

            # Region Proposal Network (RPN)
            self.rpn_net_valid = rpn(featureMaps_valid, self.gt_boxes_valid, self.im_dims_valid, _feat_stride_valid, flags)

            rpn_cls_score_valid = self.rpn_net_valid.get_rpn_cls_score()
            rpn_bbox_pred_valid = self.rpn_net_valid.get_rpn_bbox_pred()

            # Roi Pooling
            self.roi_proposal_net_valid = roi_proposal(rpn_cls_score_valid, rpn_bbox_pred_valid, self.gt_boxes_valid, self.im_dims_valid, flags)

            # R-CNN Classification
            self.fast_rcnn_net_valid = fast_rcnn(featureMaps_valid, self.roi_proposal_net_valid)
예제 #4
0
    def _faster_rcnn(self, x, gt_boxes, im_dims, key):
        # VALID and TEST are both evaluation mode
        eval_mode = True if (key == 'EVAL') else False

        self.cnn[key] = convnet(x, [5, 3, 3, 3, 3], [32, 64, 64, 128, 128], strides=[2, 2, 1, 2, 1])
        feature_maps = self.cnn[key].get_output()
        _feat_stride = self.cnn[key].get_feat_stride()

        # Region Proposal Network (RPN)
        self.rpn_net[key] = rpn(feature_maps, gt_boxes, im_dims, _feat_stride, eval_mode)

        # RoI Proposals
        self.roi_proposal_net[key] = roi_proposal(self.rpn_net[key], gt_boxes, im_dims, eval_mode)

        # Fast R-CNN Classification
        self.fast_rcnn_net[key] = fast_rcnn(feature_maps, self.roi_proposal_net[key], eval_mode)
예제 #5
0
    def _faster_rcnn(self, x, gt_boxes, im_dims, key):
        # VALID and TEST are both evaluation mode
        eval_mode = True if (key == 'EVAL') else False

        self.cnn[key] = convnet(x, [5, 3, 3, 3, 3], [32, 64, 64, 128, 128], strides=[2, 2, 1, 2, 1])
        feature_maps = self.cnn[key].get_output()
        _feat_stride = self.cnn[key].get_feat_stride()

        # Region Proposal Network (RPN)
        self.rpn_net[key] = rpn(feature_maps, gt_boxes, im_dims, _feat_stride, eval_mode)

        # RoI Proposals
        self.roi_proposal_net[key] = roi_proposal(self.rpn_net[key], gt_boxes, im_dims, eval_mode)

        # Fast R-CNN Classification
        self.fast_rcnn_net[key] = fast_rcnn(feature_maps, self.roi_proposal_net[key], eval_mode)
    def _faster_rcnn(self, x, gt_boxes, im_dims, key):
        # VALID and TEST are both evaluation mode
        eval_mode = True if (key == 'EVAL') else False
          
        # CNN Feature extractor
        feature_maps = resnet50_reduced(x)
        # CNN downsampling factor
        _feat_stride = 16           

        self.print_log(feature_maps)
        
        # Region Proposal Network (RPN)
        self.rpn_net[key] = rpn(feature_maps, gt_boxes, im_dims, _feat_stride, eval_mode)

        # RoI Proposals
        self.roi_proposal_net[key] = roi_proposal(self.rpn_net[key], gt_boxes, im_dims, eval_mode)

        # Fast R-CNN Classification
        self.fast_rcnn_net[key] = fast_rcnn(feature_maps, self.roi_proposal_net[key], eval_mode)
    def _faster_rcnn(self, x, gt_boxes, im_dims, key):
        # VALID and TEST are both evaluation mode
        eval_mode = True if (key == 'EVAL') else False
          
        # CNN Feature extractor
        feature_maps = resnet50_reduced(x)
        # CNN downsampling factor
        _feat_stride = 16           

        self.print_log(feature_maps)
        
        # Region Proposal Network (RPN)
        self.rpn_net[key] = rpn(feature_maps, gt_boxes, im_dims, _feat_stride, eval_mode)

        # RoI Proposals
        self.roi_proposal_net[key] = roi_proposal(self.rpn_net[key], gt_boxes, im_dims, eval_mode)

        # Fast R-CNN Classification
        self.fast_rcnn_net[key] = fast_rcnn(feature_maps, self.roi_proposal_net[key], eval_mode)
예제 #8
0
    def _network(self):
        ''' Define the network outputs '''
        # Convolutional Feature Extractor: ResNet101
        #        self.cnn = resnet(101, self.x)
        # Simpler convnet for debugging
        self.cnn = convnet(self.x, [5, 3, 3, 3, 3], [64, 96, 128, 172, 256],
                           strides=[2, 2, 2, 2, 2])
        featureMaps = self.cnn.get_output()
        _feat_stride = self.cnn.get_feat_stride()

        # Region Proposal Network (RPN)
        self.rpn_net = rpn(featureMaps, self.gt_boxes, self.im_dims,
                           _feat_stride, flags)

        rpn_cls_score = self.rpn_net.get_rpn_cls_score()
        rpn_bbox_pred = self.rpn_net.get_rpn_bbox_pred()

        # ROI proposal
        self.roi_proposal_net = roi_proposal(rpn_cls_score, rpn_bbox_pred,
                                             self.gt_boxes, self.im_dims,
                                             flags)

        # R-CNN Classification
        self.fast_rcnn_net = fast_rcnn(featureMaps, self.roi_proposal_net)