Views
No views yet
| Model | ImageNet 1k Top-1 accuracy, % |
|---|---|
| EfficientNetV2-b0 | 77.590% |
| EfficientNetV2-b1 | 78.872% |
| EfficientNetV2-b2 | 79.388% |
| EfficientNetV2-b3 | 82.260% |
| EfficientNetV2-S | 84.282% |
| EfficientNetV2-M | 85.596% |
| EfficientNetV2-L | 86.298% |
| EfficientNetV2-XL | 86.414% |
1import torch
2from efficientnet_v2 import EfficientNetV2
3
4model = EfficientNetV2('s',
5 in_channels=3,
6 n_classes=50,
7 pretrained=True)
8
9# x - tensor of shape [batch_size, in_channels, image_height, image_width]
10x = torch.randn([10, 3, 224, 224])
11
12# to get predictions:
13pred = model(x)
14print('out shape:', pred.shape)
15# >>> out shape: torch.Size([10, 50])
16
17# to extract features:
18features = model.get_features(x)
19for i, feature in enumerate(features):
20 print('feature %d shape:' % i, feature.shape)
21# >>> feature 0 shape: torch.Size([10, 48, 56, 56])
22# >>> feature 1 shape: torch.Size([10, 64, 28, 28])
23# >>> feature 2 shape: torch.Size([10, 160, 14, 14])
24# >>> feature 3 shape: torch.Size([10, 256, 7, 7])