• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created over 6 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A lightweight convolutional neural network

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:

  1. File architecture.py. It contains a definition of the graph.
  2. Checkpoint. You can load it into the graph using tf.train.Saver or tf.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

  1. Using moving averages of weights doesn't increase accuracy for some reason.

Requirements

  1. for using the pretrained models: tensorflow 1.10
  2. for dataset preparation: pandas, Pillow, tqdm, opencv, ...

How to train

  1. Prepare ImageNet. See data/README.md.
  2. Set the right parameters in the beginning of train.py file.
  3. Run python train.py.
  4. Run tensorboard to see the loss curves. Examples of loss curves are in images/.
  5. Use evaluation.ipynb for the final evaluation on ImageNet.

Credit

The training code is heavily inspired by:

  1. https://github.com/tensorflow/models/tree/master/official/resnet
  2. https://cloud.google.com/tpu/docs/inception-v3-advanced

Other implementations

  1. miaow1988/ShuffleNet_V2_pytorch_caffe
  2. tensorpack/examples/ImageNetModels

More Repositories

1

mtcnn-pytorch

Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks
Jupyter Notebook
648
star
2

knowledge-distillation-keras

A machine learning experiment
Jupyter Notebook
182
star
3

FaceBoxes-tensorflow

A fast face detector
Python
178
star
4

lda2vec-pytorch

Topic modeling with word vectors
Jupyter Notebook
115
star
5

trained-ternary-quantization

Reducing the size of convolutional neural networks
Jupyter Notebook
107
star
6

image-classification-caltech-256

Exploring CNNs and model quantization on Caltech-256 dataset
Jupyter Notebook
83
star
7

wing-loss

A facial landmarks regressor
Jupyter Notebook
71
star
8

ShuffleNet-tensorflow

A ShuffleNet implementation tested on Tiny ImageNet dataset
Jupyter Notebook
41
star
9

light-head-rcnn

Python
23
star
10

set-transformer

A neural network architecture for prediction on sets
Python
21
star
11

single-shot-detector

A lightweight version of RetinaNet
Python
16
star
12

MultiPoseNet

Python
9
star
13

associative-domain-adaptation

A simple domain adaptation example
Python
8
star
14

multi-scale-gradient-gan

Generation of high resolution fashion images
Python
7
star
15

WESPE

Manipulating image quality using GANs
Python
6
star
16

bicycle-gan

Multimodal edges to image translation
Python
5
star
17

point-cloud-autoencoder

Python
5
star
18

contextual-loss

Jupyter Notebook
3
star
19

CNNMRF

Jupyter Notebook
3
star
20

universal-style-transfer

Python
2
star
21

EDANet

Python
2
star
22

U-GAT-IT

Unsupervised Image-to-Image Translation
Python
2
star
23

maxout-networks-tensorflow

A neural network with maxout activation units
Python
1
star
24

large-shufflenet-tpu

Python
1
star