Francesco commited on
Commit
85b9a24
1 Parent(s): 47b8c55

commit files to HF hub

Browse files
Files changed (1) hide show
  1. README.md +56 -0
README.md ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - image-classification
5
+ datasets:
6
+ - imagenet
7
+ ---
8
+ # eca_resnet26t
9
+ Implementation of ResNet proposed in [Deep Residual Learning for Image
10
+ Recognition](https://arxiv.org/abs/1512.03385)
11
+
12
+ ``` python
13
+ ResNet.resnet18()
14
+ ResNet.resnet26()
15
+ ResNet.resnet34()
16
+ ResNet.resnet50()
17
+ ResNet.resnet101()
18
+ ResNet.resnet152()
19
+ ResNet.resnet200()
20
+
21
+ Variants (d) proposed in `Bag of Tricks for Image Classification with Convolutional Neural Networks <https://arxiv.org/pdf/1812.01187.pdf`_
22
+
23
+ ResNet.resnet26d()
24
+ ResNet.resnet34d()
25
+ ResNet.resnet50d()
26
+ # You can construct your own one by chaning `stem` and `block`
27
+ resnet101d = ResNet.resnet101(stem=ResNetStemC, block=partial(ResNetBottleneckBlock, shortcut=ResNetShorcutD))
28
+ ```
29
+
30
+ Examples:
31
+
32
+ ``` python
33
+ # change activation
34
+ ResNet.resnet18(activation = nn.SELU)
35
+ # change number of classes (default is 1000 )
36
+ ResNet.resnet18(n_classes=100)
37
+ # pass a different block
38
+ ResNet.resnet18(block=SENetBasicBlock)
39
+ # change the steam
40
+ model = ResNet.resnet18(stem=ResNetStemC)
41
+ change shortcut
42
+ model = ResNet.resnet18(block=partial(ResNetBasicBlock, shortcut=ResNetShorcutD))
43
+ # store each feature
44
+ x = torch.rand((1, 3, 224, 224))
45
+ # get features
46
+ model = ResNet.resnet18()
47
+ # first call .features, this will activate the forward hooks and tells the model you'll like to get the features
48
+ model.encoder.features
49
+ model(torch.randn((1,3,224,224)))
50
+ # get the features from the encoder
51
+ features = model.encoder.features
52
+ print([x.shape for x in features])
53
+ #[torch.Size([1, 64, 112, 112]), torch.Size([1, 64, 56, 56]), torch.Size([1, 128, 28, 28]), torch.Size([1, 256, 14, 14])]
54
+ ```
55
+
56
+