Skip to content

Commit 42a43be

Browse files
committed
Updated README
1 parent 28f70f8 commit 42a43be

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
# EfficientNet PyTorch
22

3+
### Update (June 29, 2019)
4+
5+
_Upgrade the pip package with_ `pip install --upgrade efficientnet-pytorch`
6+
7+
This update adds easy model exporting ([#20](https://github.com/lukemelas/EfficientNet-PyTorch/issues/20)) and feature extraction ([#38](https://github.com/lukemelas/EfficientNet-PyTorch/issues/38)).
8+
9+
* [Example: Export to ONNX](#example-export)
10+
* [Example: Extract features](#example-feature-extraction)
11+
* Also: fixed a CUDA/CPU bug ([#32](https://github.com/lukemelas/EfficientNet-PyTorch/issues/32))
12+
13+
It is also now incredibly simple to load a pretrained model with a new number of classes for transfer learning:
14+
```python
15+
model = EfficientNet.from_pretrained('efficientnet-b1', num_classes=23)
16+
```
17+
18+
319
### Update (June 23, 2019)
420

521
The B4 and B5 models are now available. Their usage is identical to the other models:
622
```python
723
from efficientnet_pytorch import EfficientNet
824
model = EfficientNet.from_pretrained('efficientnet-b4')
925
```
10-
Upgrade the pip package with `pip install --upgrade efficientnet-pytorch`.
1126

1227
### Overview
1328
This repository contains an op-for-op PyTorch reimplementation of [EfficientNet](https://arxiv.org/abs/1905.11946), along with pre-trained models and examples.
@@ -32,6 +47,7 @@ _Upcoming features_: In the next few days, you will be able to:
3247
* [Load pretrained models](#loading-pretrained-models)
3348
* [Example: Classify](#example-classification)
3449
* [Example: Extract features](#example-feature-extraction)
50+
* [Example: Export to ONNX](#example-export)
3551
6. [Contributing](#contributing)
3652

3753
### About EfficientNet
@@ -160,9 +176,25 @@ model = EfficientNet.from_pretrained('efficientnet-b0')
160176
print(img.shape) # torch.Size([1, 3, 224, 224])
161177

162178
features = model.extract_features(img)
163-
print(features.shape) # torch.Size([1, 320, 7, 7])
179+
print(features.shape) # torch.Size([1, 1280, 7, 7])
164180
```
165181

182+
#### Example: Export to ONNX
183+
184+
Exporting to ONNX for deploying to production is now simple:
185+
```python
186+
import torch
187+
from efficientnet_pytorch import EfficientNet
188+
189+
model = EfficientNet.from_pretrained('efficientnet-b1')
190+
dummy_input = torch.randn(10, 3, 240, 240)
191+
192+
torch.onnx.export(model, dummy_input, "test-b1.onnx", verbose=True)
193+
```
194+
195+
[Here](https://colab.research.google.com/drive/1rOAEXeXHaA8uo3aG2YcFDHItlRJMV0VP) is a Colab example.
196+
197+
166198
#### ImageNet
167199

168200
See `examples/imagenet` for details about evaluating on ImageNet.

0 commit comments

Comments
 (0)