コード例 #1
0
    def __init__(self, classes, class_agnostic):
        super(_hyper_rcnn, self).__init__()
        #self.classes = classes
        self.n_classes = classes
        self.class_agnostic = class_agnostic
        # loss
        self.RCNN_loss_cls = 0
        self.RCNN_loss_bbox = 0
        self.rcnn_din = 4096
        self.rpn_din = 512

        # define rpn
        self.RCNN_rpn = _RPN(self.dout_base_model, self.rpn_din)
        self.RCNN_proposal_target = _ProposalTargetLayer(self.n_classes)

        # self.RCNN_roi_pool = _RoIPooling(cfg.POOLING_SIZE, cfg.POOLING_SIZE, 1.0/16.0)
        # self.RCNN_roi_align = RoIAlignAvg(cfg.POOLING_SIZE, cfg.POOLING_SIZE, 1.0/16.0)
        self.downSample = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)

        self.RCNN_roi_pool = ROIPoolingLayer((cfg.POOLING_SIZE, cfg.POOLING_SIZE), 1.0/16.0)
        self.RCNN_roi_align = ROIAlignLayer((cfg.POOLING_SIZE, cfg.POOLING_SIZE), 1.0/16.0, 0)
        self.downBeat = nn.Conv2d(3584, self.rpn_din, kernel_size=1)
        self.RCNN_top = nn.Sequential(OrderedDict([
            ('fc6_new',nn.Linear(self.dout_base_model * cfg.POOLING_SIZE * cfg.POOLING_SIZE, self.rcnn_din)),
            ('fc6_relu', nn.ReLU(inplace=True)),
            ('fc7_new', nn.Linear(self.rcnn_din, self.rcnn_din, bias=True)),
            ('fc7_relu', nn.ReLU(inplace=True))]))
コード例 #2
0
    def __init__(self, classes, class_agnostic):
        super(pva_faster_rcnn, self).__init__()
        self.n_classes = classes
        self.class_agnostic = class_agnostic
        # loss
        self.RCNN_loss_cls = 0
        self.RCNN_loss_bbox = 0
        self.rcnn_din = cfg.MODEL.RCNN_CIN
        self.rcnn_last_din = cfg.MODEL.RCNN_LAST
        self.rpn_din = cfg.MODEL.RPN_CIN

        # define rpn
        self.RCNN_rpn = _RPN(self.dout_base_model, self.rpn_din)
        self.RCNN_proposal_target = _ProposalTargetLayer(self.n_classes)

        if cfg.POOLING_MODE == 'align':
            self.RCNN_roi_pool = ROIAlignLayer(
                (cfg.POOLING_SIZE, cfg.POOLING_SIZE), 1.0 / cfg.FEAT_STRIDE[0],
                2)
        elif cfg.POOLING_MODE == 'pool':
            self.RCNN_roi_pool = ROIPoolingLayer(
                (cfg.POOLING_SIZE, cfg.POOLING_SIZE), 1.0 / cfg.FEAT_STRIDE[0])

        self.RCNN_top = nn.Sequential(
            OrderedDict([('fc6_new',
                          nn.Linear(
                              self.dout_base_model * cfg.POOLING_SIZE *
                              cfg.POOLING_SIZE, self.rcnn_din)),
                         ('fc6_relu', nn.ReLU(inplace=True)),
                         ('fc7_new',
                          nn.Linear(self.rcnn_din,
                                    self.rcnn_last_din,
                                    bias=True)),
                         ('fc7_relu', nn.ReLU(inplace=True))]))
コード例 #3
0
    def __init__(self, classes, class_agnostic):
        super(_fasterRCNN, self).__init__()
        #self.classes = classes
        self.n_classes = classes
        self.class_agnostic = class_agnostic
        # loss
        self.RCNN_loss_cls = 0
        self.RCNN_loss_bbox = 0

        # define rpn
        self.RCNN_rpn = _RPN(self.dout_base_model, self.rpn_din)
        self.RCNN_proposal_target = _ProposalTargetLayer(self.n_classes)

        self.RCNN_roi_pool = ROIPoolingLayer(
            (cfg.POOLING_SIZE, cfg.POOLING_SIZE), 1.0 / 16.0)
        self.RCNN_roi_align = ROIAlignLayer(
            (cfg.POOLING_SIZE, cfg.POOLING_SIZE), 1.0 / 16.0, 0)