Ejemplo n.º 1
0
 def _get_module(self):
     module_type = self.cfg.MODULE.TYPE
     if module_type == "GAP":
         module = GAP()
     elif module_type == "Identity":
         module = Identity()
     else:
         raise NotImplementedError
     return module
    def __init__(self, backbone_type='bbn_res34', num_classes=331):
        super(Network, self).__init__()
        if backbone_type == 'bbn_res34':
            self.backbone = bbn_res34(pretrain=False, pretrained_model="")
            num_features = 512 * 2
        elif backbone_type == 'bbn_res50':
            self.backbone = bbn_res50(pretrain=False, pretrained_model="")
            num_features = 2048 * 2
        elif backbone_type == 'bbn_ress50':
            self.backbone = bbn_ress50(pretrain=False, pretrained_model="")
            num_features = 2048 * 2
        elif backbone_type == 'bbn_ress101':
            self.backbone = bbn_ress101(pretrain=False, pretrained_model="")
            num_features = 2048 * 2
        else:
            raise NotImplementedError

        self.module = GAP()
        self.classifier = nn.Linear(num_features, num_classes, bias=True)