Exemplo n.º 1
0
    def __init__(self, args):
        super().__init__()
        self.args = args
        if args.backbone_class == 'ConvNet':
            from model.networks.convnet import ConvNet
            hdim = 64
            self.encoder = ConvNet()
        elif args.backbone_class == 'ConvAttNet':
            from model.networks.convnet import ConvAttNet as ConvNet
            hdim = 64
            self.encoder = ConvNet()
        elif args.backbone_class == 'Res12':
            hdim = 640
            from model.networks.res12 import ResNet
            self.encoder = ResNet()
        elif args.backbone_class == 'SAN':
            hdim = 2048
            from model.networks.san import san
            self.encoder = san(1, [2, 1, 2, 4, 1], [3, 3, 3, 3, 3])
        elif args.backbone_class == 'ResNest12':
            hdim = 640
            from model.networks.resnest12 import ResNet
            self.encoder = ResNet()
        elif args.backbone_class == 'Res18':
            hdim = 512
            from model.networks.res18 import ResNet
            self.encoder = ResNet()
        elif args.backbone_class == 'WRN':
            hdim = 640
            from model.networks.WRN28 import Wide_ResNet
            self.encoder = Wide_ResNet(28, 10, 0.5)
        else:
            raise ValueError('')

        self.fc = nn.Linear(hdim, args.num_class)
Exemplo n.º 2
0
 def __init__(self, args):
     super().__init__()
     self.args = args
     if args.backbone_class == 'ConvNet':
         from model.networks.convnet import ConvNet
         self.hdim = 64
         self.encoder = ConvNet()
     elif args.backbone_class == 'Res12':
         self.hdim = 640
         from model.networks.res12 import ResNet
         self.encoder = ResNet()
     elif args.backbone_class == 'Res18':
         self.hdim = 512
         from model.networks.res18 import ResNet
         self.encoder = ResNet()
     elif args.backbone_class == 'WRN':
         self.hdim = 640
         from model.networks.WRN28 import Wide_ResNet
         self.encoder = Wide_ResNet(28, 10,
                                    0.5)  # we set the dropout=0.5 directly here, it may achieve better results by tunning the dropout
     else:
         raise ValueError('')
     self.ep = 0
     self.gep = 0
     self.lep = 0
Exemplo n.º 3
0
    def __init__(self, args):
        super().__init__()
        self.args = args
        if args.backbone_class == 'ConvNet':
            from model.networks.convnet import ConvNet
            hdim = 64
            self.encoder = ConvNet()
        elif args.backbone_class == 'Res12':
            hdim = 640
            from model.networks.res12 import ResNet
            self.encoder = ResNet()
        elif args.backbone_class == 'Res18':
            hdim = 512
            from model.networks.res18 import ResNet
            self.encoder = ResNet()
        elif args.backbone_class == 'WRN':
            hdim = 640
            from model.networks.WRN28 import Wide_ResNet
            self.encoder = Wide_ResNet(28, 10, 0.5)
        else:
            raise ValueError('')

        self.fc = nn.Linear(hdim, args.num_class)