Python torchvision.models.resnet101() Examples
The following are 30
code examples of torchvision.models.resnet101().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
torchvision.models
, or try the search function
.
Example #1
Source File: resnet_encoder.py From packnet-sfm with MIT License | 8 votes |
def __init__(self, num_layers, pretrained, num_input_images=1): super(ResnetEncoder, self).__init__() self.num_ch_enc = np.array([64, 64, 128, 256, 512]) resnets = {18: models.resnet18, 34: models.resnet34, 50: models.resnet50, 101: models.resnet101, 152: models.resnet152} if num_layers not in resnets: raise ValueError("{} is not a valid number of resnet layers".format(num_layers)) if num_input_images > 1: self.encoder = resnet_multiimage_input(num_layers, pretrained, num_input_images) else: self.encoder = resnets[num_layers](pretrained) if num_layers > 34: self.num_ch_enc[1:] *= 4
Example #2
Source File: featureModels.py From multi-modal-regression with MIT License | 6 votes |
def __init__(self, model_type='resnet50', layer_type='layer4'): super().__init__() # get model if model_type == 'resnet50': original_model = models.resnet50(pretrained=True) elif model_type == 'resnet101': original_model = models.resnet101(pretrained=True) else: raise NameError('Unknown model_type passed') # get requisite layer if layer_type == 'layer2': num_layers = 6 pool_size = 28 elif layer_type == 'layer3': num_layers = 7 pool_size = 14 elif layer_type == 'layer4': num_layers = 8 pool_size = 7 else: raise NameError('Uknown layer_type passed') self.features = nn.Sequential(*list(original_model.children())[:num_layers]) self.avgpool = nn.AvgPool2d(pool_size, stride=1)
Example #3
Source File: resnet.py From deeplabv3plus-pytorch with MIT License | 6 votes |
def __init__(self, layers, atrous, pretrained=True): super(ResNet, self).__init__() self.inner_layer = [] if layers == 18: self.backbone = models.resnet18(pretrained=pretrained) elif layers == 34: self.backbone = models.resnet34(pretrained=pretrained) elif layers == 50: self.backbone = models.resnet50(pretrained=pretrained) elif layers == 101: self.backbone = models.resnet101(pretrained=pretrained) elif layers == 152: self.backbone = models.resnet152(pretrained=pretrained) else: raise ValueError('resnet.py: network layers is no support yet') def hook_func(module, input, output): self.inner_layer.append(output) self.backbone.layer1.register_forward_hook(hook_func) self.backbone.layer2.register_forward_hook(hook_func) self.backbone.layer3.register_forward_hook(hook_func) self.backbone.layer4.register_forward_hook(hook_func)
Example #4
Source File: model.py From tiny-faces-pytorch with MIT License | 6 votes |
def __init__(self, base_model=resnet101, num_templates=1, num_objects=1): super().__init__() # 4 is for the bounding box offsets output = (num_objects + 4)*num_templates self.model = base_model(pretrained=True) # delete unneeded layer del self.model.layer4 self.score_res3 = nn.Conv2d(in_channels=512, out_channels=output, kernel_size=1, padding=0) self.score_res4 = nn.Conv2d(in_channels=1024, out_channels=output, kernel_size=1, padding=0) self.score4_upsample = nn.ConvTranspose2d(in_channels=output, out_channels=output, kernel_size=4, stride=2, padding=1, bias=False) self._init_bilinear()
Example #5
Source File: Res101_SFCN.py From NWPU-Crowd-Sample-Code with MIT License | 6 votes |
def __init__(self, pretrained=True): super(Res101_SFCN, self).__init__() self.seen = 0 self.backend_feat = [512, 512, 512,256,128,64] self.frontend = [] self.backend = make_layers(self.backend_feat,in_channels = 1024,dilation = True) self.convDU = convDU(in_out_channels=64,kernel_size=(1,9)) self.convLR = convLR(in_out_channels=64,kernel_size=(9,1)) self.output_layer = nn.Sequential(nn.Conv2d(64, 1, kernel_size=1),nn.ReLU()) initialize_weights(self.modules()) res = models.resnet101(pretrained=pretrained) self.frontend = nn.Sequential( res.conv1, res.bn1, res.relu, res.maxpool, res.layer1, res.layer2 ) self.own_reslayer_3 = make_res_layer(Bottleneck, 256, 23, stride=1) self.own_reslayer_3.load_state_dict(res.layer3.state_dict())
Example #6
Source File: resnet_encoder.py From SC-SfMLearner-Release with GNU General Public License v3.0 | 6 votes |
def __init__(self, num_layers, pretrained, num_input_images=1): super(ResnetEncoder, self).__init__() self.num_ch_enc = np.array([64, 64, 128, 256, 512]) resnets = {18: models.resnet18, 34: models.resnet34, 50: models.resnet50, 101: models.resnet101, 152: models.resnet152} if num_layers not in resnets: raise ValueError("{} is not a valid number of resnet layers".format(num_layers)) if num_input_images > 1: self.encoder = resnet_multiimage_input(num_layers, pretrained, num_input_images) else: self.encoder = resnets[num_layers](pretrained) if num_layers > 34: self.num_ch_enc[1:] *= 4
Example #7
Source File: resSFCN.py From GCC-SFCN with MIT License | 6 votes |
def __init__(self, ): super(resSFCN, self).__init__() self.seen = 0 self.backend_feat = [512, 512, 512,256,128,64] self.frontend = [] self.backend = make_layers(self.backend_feat,in_channels = 1024,dilation = True) self.convDU = convDU(in_out_channels=64,kernel_size=(1,9)) self.convLR = convLR(in_out_channels=64,kernel_size=(9,1)) self.output_layer = nn.Sequential(nn.Conv2d(64, 1, kernel_size=1),nn.ReLU()) self._initialize_weights() res = models.resnet101() pre_wts = torch.load(model_path) res.load_state_dict(pre_wts) self.frontend = nn.Sequential( res.conv1, res.bn1, res.relu, res.maxpool, res.layer1, res.layer2 ) self.own_reslayer_3 = make_res_layer(Bottleneck, 256, 23, stride=1) self.own_reslayer_3.load_state_dict(res.layer3.state_dict())
Example #8
Source File: pretrained_networks.py From TecoGAN with Apache License 2.0 | 6 votes |
def __init__(self, requires_grad=False, pretrained=True, num=18): super(resnet, self).__init__() if(num==18): self.net = models.resnet18(pretrained=pretrained) elif(num==34): self.net = models.resnet34(pretrained=pretrained) elif(num==50): self.net = models.resnet50(pretrained=pretrained) elif(num==101): self.net = models.resnet101(pretrained=pretrained) elif(num==152): self.net = models.resnet152(pretrained=pretrained) self.N_slices = 5 self.conv1 = self.net.conv1 self.bn1 = self.net.bn1 self.relu = self.net.relu self.maxpool = self.net.maxpool self.layer1 = self.net.layer1 self.layer2 = self.net.layer2 self.layer3 = self.net.layer3 self.layer4 = self.net.layer4
Example #9
Source File: pretrained_networks.py From SMIT with MIT License | 6 votes |
def __init__(self, requires_grad=False, pretrained=True, num=18): super(resnet, self).__init__() if (num == 18): self.net = models.resnet18(pretrained=pretrained) elif (num == 34): self.net = models.resnet34(pretrained=pretrained) elif (num == 50): self.net = models.resnet50(pretrained=pretrained) elif (num == 101): self.net = models.resnet101(pretrained=pretrained) elif (num == 152): self.net = models.resnet152(pretrained=pretrained) self.N_slices = 5 self.conv1 = self.net.conv1 self.bn1 = self.net.bn1 self.relu = self.net.relu self.maxpool = self.net.maxpool self.layer1 = self.net.layer1 self.layer2 = self.net.layer2 self.layer3 = self.net.layer3 self.layer4 = self.net.layer4
Example #10
Source File: pspnet.py From pytorch-hair-segmentation with MIT License | 6 votes |
def __init__(self, num_class=1, sizes=(1, 2, 3, 6), base_network='resnet101'): super(PSPNet, self).__init__() base_network = base_network.lower() if base_network == 'resnet101': self.base_network = ResNet101Extractor() feature_dim = 1024 elif base_network == 'squeezenet': self.base_network = SqueezeNetExtractor() feature_dim = 512 else: raise ValueError self.psp = PyramidPoolingModule(in_channels=feature_dim, sizes=sizes) self.drop_1 = nn.Dropout2d(p=0.3) self.up_1 = UpsampleLayer(2*feature_dim, 256) self.up_2 = UpsampleLayer(256, 64) self.up_3 = UpsampleLayer(64, 64) self.drop_2 = nn.Dropout2d(p=0.15) self.final = nn.Sequential( nn.Conv2d(64, num_class, kernel_size=1) ) self._init_weight()
Example #11
Source File: pretrained_networks.py From PerceptualSimilarity with BSD 2-Clause "Simplified" License | 6 votes |
def __init__(self, requires_grad=False, pretrained=True, num=18): super(resnet, self).__init__() if(num==18): self.net = tv.resnet18(pretrained=pretrained) elif(num==34): self.net = tv.resnet34(pretrained=pretrained) elif(num==50): self.net = tv.resnet50(pretrained=pretrained) elif(num==101): self.net = tv.resnet101(pretrained=pretrained) elif(num==152): self.net = tv.resnet152(pretrained=pretrained) self.N_slices = 5 self.conv1 = self.net.conv1 self.bn1 = self.net.bn1 self.relu = self.net.relu self.maxpool = self.net.maxpool self.layer1 = self.net.layer1 self.layer2 = self.net.layer2 self.layer3 = self.net.layer3 self.layer4 = self.net.layer4
Example #12
Source File: resnet_encoder.py From DF-VO with MIT License | 6 votes |
def __init__(self, num_layers, pretrained, num_input_images=1): super(ResnetEncoder, self).__init__() self.num_ch_enc = np.array([64, 64, 128, 256, 512]) resnets = {18: models.resnet18, 34: models.resnet34, 50: models.resnet50, 101: models.resnet101, 152: models.resnet152} if num_layers not in resnets: raise ValueError("{} is not a valid number of resnet layers".format(num_layers)) if num_input_images > 1: self.encoder = resnet_multiimage_input(num_layers, pretrained, num_input_images) else: self.encoder = resnets[num_layers](pretrained) if num_layers > 34: self.num_ch_enc[1:] *= 4
Example #13
Source File: main.py From Grad-CAM.pytorch with Apache License 2.0 | 6 votes |
def get_net(net_name, weight_path=None): """ 根据网络名称获取模型 :param net_name: 网络名称 :param weight_path: 与训练权重路径 :return: """ pretrain = weight_path is None # 没有指定权重路径,则加载默认的预训练权重 if net_name in ['vgg', 'vgg16']: net = models.vgg16(pretrained=pretrain) elif net_name == 'vgg19': net = models.vgg19(pretrained=pretrain) elif net_name in ['resnet', 'resnet50']: net = models.resnet50(pretrained=pretrain) elif net_name == 'resnet101': net = models.resnet101(pretrained=pretrain) elif net_name in ['densenet', 'densenet121']: net = models.densenet121(pretrained=pretrain) elif net_name in ['inception']: net = models.inception_v3(pretrained=pretrain) elif net_name in ['mobilenet_v2']: net = models.mobilenet_v2(pretrained=pretrain) elif net_name in ['shufflenet_v2']: net = models.shufflenet_v2_x1_0(pretrained=pretrain) else: raise ValueError('invalid network name:{}'.format(net_name)) # 加载指定路径的权重参数 if weight_path is not None and net_name.startswith('densenet'): pattern = re.compile( r'^(.*denselayer\d+\.(?:norm|relu|conv))\.((?:[12])\.(?:weight|bias|running_mean|running_var))$') state_dict = torch.load(weight_path) for key in list(state_dict.keys()): res = pattern.match(key) if res: new_key = res.group(1) + res.group(2) state_dict[new_key] = state_dict[key] del state_dict[key] net.load_state_dict(state_dict) elif weight_path is not None: net.load_state_dict(torch.load(weight_path)) return net
Example #14
Source File: basenet.py From MCD_DA with MIT License | 6 votes |
def __init__(self,option = 'resnet18',pret=True): super(ResFreeze, self).__init__() self.dim = 2048*2*2 if option == 'resnet18': model_ft = models.resnet18(pretrained=pret) self.dim = 512 if option == 'resnet50': model_ft = models.resnet50(pretrained=pret) if option == 'resnet101': model_ft = models.resnet101(pretrained=pret) if option == 'resnet152': model_ft = models.resnet152(pretrained=pret) if option == 'resnet200': model_ft = Res200() self.conv1 = model_ft.conv1 self.bn0 = model_ft.bn1 self.relu = model_ft.relu self.maxpool = model_ft.maxpool self.layer1 = model_ft.layer1 self.layer2 = model_ft.layer2 self.layer3 = model_ft.layer3 self.layer4 = model_ft.layer4 self.avgpool = model_ft.avgpool
Example #15
Source File: basenet.py From MCD_DA with MIT License | 6 votes |
def __init__(self,option = 'resnet18',pret=True): super(ResBase, self).__init__() self.dim = 2048 if option == 'resnet18': model_ft = models.resnet18(pretrained=pret) self.dim = 512 if option == 'resnet50': model_ft = models.resnet50(pretrained=pret) if option == 'resnet101': model_ft = models.resnet101(pretrained=pret) if option == 'resnet152': model_ft = models.resnet152(pretrained=pret) if option == 'resnet200': model_ft = Res200() if option == 'resnetnext': model_ft = ResNeXt(layer_num=101) mod = list(model_ft.children()) mod.pop() #self.model_ft =model_ft self.features = nn.Sequential(*mod)
Example #16
Source File: psp_net.py From segmentation-networks-benchmark with MIT License | 5 votes |
def __init__(self, num_classes, pretrained=True, use_aux=True): super(PSPNet, self).__init__() self.use_aux = use_aux self.num_classes = num_classes resnet = models.resnet101(pretrained) self.layer0 = nn.Sequential(resnet.conv1, resnet.bn1, resnet.relu, resnet.maxpool) self.layer1, self.layer2, self.layer3, self.layer4 = resnet.layer1, resnet.layer2, resnet.layer3, resnet.layer4 for n, m in self.layer3.named_modules(): if 'conv2' in n: m.dilation, m.padding, m.stride = (2, 2), (2, 2), (1, 1) elif 'downsample.0' in n: m.stride = (1, 1) for n, m in self.layer4.named_modules(): if 'conv2' in n: m.dilation, m.padding, m.stride = (4, 4), (4, 4), (1, 1) elif 'downsample.0' in n: m.stride = (1, 1) self.ppm = _PyramidPoolingModule(2048, 512, (1, 2, 3, 6)) self.final = nn.Sequential( nn.Conv2d(4096, 512, kernel_size=3, padding=1, bias=False), nn.BatchNorm2d(512, momentum=.95), nn.ReLU(inplace=True), nn.Dropout(0.1), nn.Conv2d(512, num_classes, kernel_size=1) ) if use_aux: self.aux_logits = nn.Conv2d(1024, num_classes, kernel_size=1) initialize_weights(self.aux_logits) initialize_weights(self.ppm, self.final)
Example #17
Source File: refinenet_4cascade.py From pytorch_refinenet with MIT License | 5 votes |
def __init__(self, input_shape, num_classes=1, features=256, resnet_factory=models.resnet101, pretrained=True, freeze_resnet=True): """Multi-path 4-Cascaded RefineNet for image segmentation with improved pooling Args: input_shape ((int, int)): (channel, size) assumes input has equal height and width refinenet_block (block): RefineNet Block num_classes (int, optional): number of classes features (int, optional): number of features in refinenet resnet_factory (func, optional): A Resnet model from torchvision. Default: models.resnet101 pretrained (bool, optional): Use pretrained version of resnet Default: True freeze_resnet (bool, optional): Freeze resnet model Default: True Raises: ValueError: size of input_shape not divisible by 32 """ super().__init__( input_shape, RefineNetBlockImprovedPooling, num_classes=num_classes, features=features, resnet_factory=resnet_factory, pretrained=pretrained, freeze_resnet=freeze_resnet)
Example #18
Source File: refinenet_4cascade.py From pytorch_refinenet with MIT License | 5 votes |
def __init__(self, input_shape, num_classes=1, features=256, resnet_factory=models.resnet101, pretrained=True, freeze_resnet=True): """Multi-path 4-Cascaded RefineNet for image segmentation Args: input_shape ((int, int)): (channel, size) assumes input has equal height and width refinenet_block (block): RefineNet Block num_classes (int, optional): number of classes features (int, optional): number of features in refinenet resnet_factory (func, optional): A Resnet model from torchvision. Default: models.resnet101 pretrained (bool, optional): Use pretrained version of resnet Default: True freeze_resnet (bool, optional): Freeze resnet model Default: True Raises: ValueError: size of input_shape not divisible by 32 """ super().__init__( input_shape, RefineNetBlock, num_classes=num_classes, features=features, resnet_factory=resnet_factory, pretrained=pretrained, freeze_resnet=freeze_resnet)
Example #19
Source File: utils_test.py From pytorch-dp with Apache License 2.0 | 5 votes |
def test_run_resnet101(self): imgSize = (3, 224, 224) # should throw because privacy engine does not work with batch norm # remove the next two lines when we support batch norm with self.assertRaises(Exception): self.runOneBatch(models.resnet101(), imgSize) self.runOneBatch( utils.convert_batchnorm_modules(models.resnet101()), imgSize)
Example #20
Source File: torchvision_models.py From models-comparison.pytorch with BSD 3-Clause "New" or "Revised" License | 5 votes |
def resnet101(num_classes=1000, pretrained='imagenet'): """Constructs a ResNet-101 model. """ model = models.resnet101(pretrained=False) if pretrained is not None: settings = pretrained_settings['resnet101'][pretrained] model = load_pretrained(model, num_classes, settings) model = modify_resnets(model) return model
Example #21
Source File: model.py From service-streamer with Apache License 2.0 | 5 votes |
def __init__(self, device="cpu"): super().__init__(device=device) self.model = models.resnet101(pretrained=True) self.model.to(self.device) self.model.eval()
Example #22
Source File: amnet_model.py From AMNet with MIT License | 5 votes |
def __init__(self): super(ResNet101FC, self).__init__() self.core_cnn = models.resnet101(pretrained=True) self.D = 1024 return
Example #23
Source File: models.py From wildcat.pytorch with MIT License | 5 votes |
def resnet101_wildcat(num_classes, pretrained=True, kmax=1, kmin=None, alpha=1, num_maps=1): model = models.resnet101(pretrained) pooling = nn.Sequential() pooling.add_module('class_wise', ClassWisePool(num_maps)) pooling.add_module('spatial', WildcatPool2d(kmax, kmin, alpha)) return ResNetWSL(model, num_classes * num_maps, pooling=pooling)
Example #24
Source File: ResNet.py From vidreid_cosegmentation with Apache License 2.0 | 5 votes |
def get_ResNet(net_type): if net_type == "resnet50": model = models.resnet50(pretrained=True) model = nn.Sequential(*list(model.children())[:-2]) elif net_type == "senet101": model = models.resnet101(pretrained=True) model = nn.Sequential(*list(model.children())[:-2]) else: assert False, "unknown ResNet type : " + net_type return model
Example #25
Source File: basenet.py From MCD_DA with MIT License | 5 votes |
def __init__(self,option = 'resnet18',pret=True): super(ResBase_D, self).__init__() self.dim = 2048 if option == 'resnet18': model_ft = models.resnet18(pretrained=pret) self.dim = 512 if option == 'resnet50': model_ft = models.resnet50(pretrained=pret) if option == 'resnet101': model_ft = models.resnet101(pretrained=pret) if option == 'resnet152': model_ft = models.resnet152(pretrained=pret) if option == 'resnet200': model_ft = Res200() if option == 'resnetnext': model_ft = ResNeXt(layer_num=101) #mod = list(model_ft.children()) #mod.pop() #self.model_ft =model_ft self.conv1 = model_ft.conv1 self.bn0 = model_ft.bn1 self.relu = model_ft.relu self.maxpool = model_ft.maxpool self.drop0 = nn.Dropout2d() self.layer1 = model_ft.layer1 self.drop1 = nn.Dropout2d() self.layer2 = model_ft.layer2 self.drop2 = nn.Dropout2d() self.layer3 = model_ft.layer3 self.drop3 = nn.Dropout2d() self.layer4 = model_ft.layer4 self.drop4 = nn.Dropout2d() self.pool = model_ft.avgpool #self.features = nn.Sequential(*mod)
Example #26
Source File: basenet.py From MCD_DA with MIT License | 5 votes |
def __init__(self,option = 'resnet18',pret=True): super(ResBase_office, self).__init__() self.dim = 2048 if option == 'resnet18': model_ft = models.resnet18(pretrained=pret) self.dim = 512 if option == 'resnet50': model_ft = models.resnet50(pretrained=pret) if option == 'resnet101': model_ft = models.resnet101(pretrained=pret) if option == 'resnet152': model_ft = models.resnet152(pretrained=pret) if option == 'resnet200': model_ft = Res200() if option == 'resnetnext': model_ft = ResNeXt(layer_num=101) #mod = list(model_ft.children()) #mod.pop() #self.model_ft =model_ft self.conv1 = model_ft.conv1 self.bn0 = model_ft.bn1 self.relu = model_ft.relu self.maxpool = model_ft.maxpool self.layer1 = model_ft.layer1 self.layer2 = model_ft.layer2 self.layer3 = model_ft.layer3 self.layer4 = model_ft.layer4 self.pool = model_ft.avgpool #self.bottleneck = nn.Sequential(*layers) #self.features = nn.Sequential(*mod)
Example #27
Source File: basenet.py From MCD_DA with MIT License | 5 votes |
def __init__(self,option = 'resnet18',pret=True): super(ResNet_all, self).__init__() self.dim = 2048 if option == 'resnet18': model_ft = models.resnet18(pretrained=pret) self.dim = 512 if option == 'resnet50': model_ft = models.resnet50(pretrained=pret) if option == 'resnet101': model_ft = models.resnet101(pretrained=pret) if option == 'resnet152': model_ft = models.resnet152(pretrained=pret) if option == 'resnet200': model_ft = Res200() if option == 'resnetnext': model_ft = ResNeXt(layer_num=101) #mod = list(model_ft.children()) #mod.pop() #self.model_ft =model_ft self.conv1 = model_ft.conv1 self.bn0 = model_ft.bn1 self.relu = model_ft.relu self.maxpool = model_ft.maxpool self.layer1 = model_ft.layer1 self.layer2 = model_ft.layer2 self.layer3 = model_ft.layer3 self.layer4 = model_ft.layer4 self.pool = model_ft.avgpool self.fc = nn.Linear(2048,12)
Example #28
Source File: basenet.py From MCD_DA with MIT License | 5 votes |
def __init__(self,option = 'resnet18',pret=True): super(ResBasePlus, self).__init__() self.dim = 2048 if option == 'resnet18': model_ft = models.resnet18(pretrained=pret) self.dim = 512 if option == 'resnet50': model_ft = models.resnet50(pretrained=pret) if option == 'resnet101': model_ft = models.resnet101(pretrained=pret) if option == 'resnet152': model_ft = models.resnet152(pretrained=pret) if option == 'resnet200': model_ft = Res200() if option == 'resnetnext': model_ft = ResNeXt(layer_num=101) mod = list(model_ft.children()) mod.pop() #self.model_ft =model_ft self.layer = nn.Sequential( nn.Dropout(), nn.Linear(2048, 1000), nn.ReLU(inplace=True), nn.BatchNorm1d(1000,affine=True), nn.Dropout(), nn.ReLU(inplace=True), ) self.features = nn.Sequential(*mod)
Example #29
Source File: archs.py From pytorch-adacos with MIT License | 5 votes |
def __init__(self, args): super().__init__() if args.backbone == 'resnet18': self.backbone = models.resnet18(pretrained=True) last_channels = 512 elif args.backbone == 'resnet34': self.backbone = models.resnet34(pretrained=True) last_channels = 512 elif args.backbone == 'resnet50': self.backbone = models.resnet50(pretrained=True) last_channels = 2048 elif args.backbone == 'resnet101': self.backbone = models.resnet101(pretrained=True) last_channels = 2048 elif args.backbone == 'resnet152': self.backbone = models.resnet152(pretrained=True) last_channels = 2048 self.features = nn.Sequential( self.backbone.conv1, self.backbone.bn1, self.backbone.relu, self.backbone.layer1, self.backbone.layer2, self.backbone.layer3, self.backbone.layer4) self.bn1 = nn.BatchNorm2d(last_channels) self.dropout = nn.Dropout2d(0.5) self.fc = nn.Linear(8*8*last_channels, args.num_features) self.bn2 = nn.BatchNorm1d(args.num_features)
Example #30
Source File: resnet_qc.py From AD-DL with MIT License | 5 votes |
def resnet_qc_101(pretrained=False, **kwargs): """Constructs a ResNet-101 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet """ model = ResNetQC(Bottleneck, [3, 4, 23, 3], **kwargs) if pretrained: model_ft = models.resnet101(pretrained=True) model.load_from_std(model_ft) return model