Views
No views yet
1ResNet.resnet18()
2ResNet.resnet26()
3ResNet.resnet34()
4ResNet.resnet50()
5ResNet.resnet101()
6ResNet.resnet152()
7ResNet.resnet200()
8
9Variants (d) proposed in `Bag of Tricks for Image Classification with Convolutional Neural Networks <https://arxiv.org/pdf/1812.01187.pdf`_
10
11ResNet.resnet26d()
12ResNet.resnet34d()
13ResNet.resnet50d()
14# You can construct your own one by chaning `stem` and `block`
15resnet101d = ResNet.resnet101(stem=ResNetStemC, block=partial(ResNetBottleneckBlock, shortcut=ResNetShorcutD))1# change activation
2ResNet.resnet18(activation = nn.SELU)
3# change number of classes (default is 1000 )
4ResNet.resnet18(n_classes=100)
5# pass a different block
6ResNet.resnet18(block=SENetBasicBlock)
7# change the steam
8model = ResNet.resnet18(stem=ResNetStemC)
9change shortcut
10model = ResNet.resnet18(block=partial(ResNetBasicBlock, shortcut=ResNetShorcutD))
11# store each feature
12x = torch.rand((1, 3, 224, 224))
13# get features
14model = ResNet.resnet18()
15# first call .features, this will activate the forward hooks and tells the model you'll like to get the features
16model.encoder.features
17model(torch.randn((1,3,224,224)))
18# get the features from the encoder
19features = model.encoder.features
20print([x.shape for x in features])
21#[torch.Size([1, 64, 112, 112]), torch.Size([1, 64, 56, 56]), torch.Size([1, 128, 28, 28]), torch.Size([1, 256, 14, 14])]