Transformers
PyTorch
Inference Endpoints
Francesco commited on
Commit
de0c4b0
1 Parent(s): 07f5e44

commit files to HF hub

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