ShuffleNet v2
This is an implementation of ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design .
model | accuracy | top 5 accuracy |
---|---|---|
0.5x | 0.607 | 0.822 |
1.0x | 0.688 | 0.886 |
You can download ImageNet trained checkpoints from here.
How to use the pretrained models
You only need two things:
- File
architecture.py
. It contains a definition of the graph. - Checkpoint. You can load it into the graph using
tf.train.Saver
ortf.train.init_from_checkpoint
.
For an example of using the pretrained model see: inference_with_trained_model.ipynb
.
Speed benchmarks
model | accuracy | images/second |
---|---|---|
ShuffleNet v2 0.5x | 0.607 | 3192 |
ShuffleNet v2 1.0x | 0.689 | 2349 |
ShuffleNet v2 1.5x | - | 1855 |
ShuffleNet v2 2.0x | - | 1570 |
MobileNet v1 0.5x | 0.633 | 3317 |
MobileNet v1 0.75x | 0.684 | 2187 |
MobileNet v1 1.0x | 0.709 | 1685 |
MobileNet v2 0.35x | 0.603 | 2722 |
MobileNet v2 0.75x | 0.698 | 1527 |
MobileNet v2 1.0x | 0.718 | 1292 |
All measurements were done using batches of size 8, images of size 224x224, and NVIDIA GTX 1080 Ti.
See benchmark_speed.ipynb
for the code.
MobileNet v1 results are taken from here. MobileNet v2 results are taken from here.
Notes
- Using moving averages of weights doesn't increase accuracy for some reason.
Requirements
- for using the pretrained models:
tensorflow 1.10
- for dataset preparation:
pandas, Pillow, tqdm, opencv, ...
How to train
- Prepare ImageNet. See
data/README.md
. - Set the right parameters in the beginning of
train.py
file. - Run
python train.py
. - Run
tensorboard
to see the loss curves. Examples of loss curves are inimages/
. - Use
evaluation.ipynb
for the final evaluation on ImageNet.
Credit
The training code is heavily inspired by:
- https://github.com/tensorflow/models/tree/master/official/resnet
- https://cloud.google.com/tpu/docs/inception-v3-advanced