Example #1
0
 def __init__(self, args):
     super(CustomResnet, self).__init__()
     layers = get_layers(args.block_layout)
     self._model = ResNet(layers, args)
     model_name = args.pretrained_imagenet_model_name
     if args.pretrained_on_imagenet:
         load_pretrained_weights(self._model,
                                 load_pretrained_model(model_name))
Example #2
0
 def __init__(self, args):
     super(Default_Resnet50, self).__init__()
     block_layout = [[('Bottleneck', 3)], [('Bottleneck', 4)],
                     [('Bottleneck', 6)], [('Bottleneck', 3)]]
     layers = get_layers(block_layout)
     self._model = ResNet(layers, args)
     if args.pretrained_on_imagenet:
         load_pretrained_weights(self._model,
                                 load_pretrained_model('resnet50'))
Example #3
0
    def __init__(self, args):
        '''
            Given some a patch model, add add some FC layers and a shortcut to make whole image prediction
       '''
        super(CustomBlock_Agg, self).__init__()

        self.args = args
        if not args.use_precomputed_hiddens:
            self.feat_extractor = load_model(args.patch_snapshot, args, False)
        agg_layers = get_layers(args.block_layout)
        self._model = ResNet(agg_layers, args)
Example #4
0
 def __init__(self, args):
     super(Default_8StageResnet36, self).__init__()
     block_layout = [[('BasicBlock', 2)], [('BasicBlock', 2)],
                     [('BasicBlock', 2)], [('BasicBlock', 2)],
                     [('BasicBlock', 2)], [('BasicBlock', 2)],
                     [('BasicBlock', 2)], [('BasicBlock', 2)]]
     layers = get_layers(block_layout)
     self._model = ResNet(layers, args)
     if args.pretrained_on_imagenet:
         load_pretrained_weights(self._model,
                                 load_pretrained_model('resnet18'))