This is an implementation of ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices. It is written in Tensorflow and tested on Tiny ImageNet dataset. The dataset consists of 64x64 images and has 200 classes. The network gives validation accuracy ~49% after 40 epochs (it takes ~2.2 hours on p2.xlarge).
- I use reduced in size ShuffleNet: in the original paper it has more layers.
But it is easy to change a couple of parameters inshufflenet/CONSTANTS.py
to make it like the original. - For the input pipeline I use
tf.data.TFRecordDataset
. - For data augmentation I use 56x56 sized random crops and random color manipulations.
- I use a reduce-on-plateau learning rate scheduler.
Assuming that Tiny ImageNet data is in /home/ubuntu/data/tiny-imagenet-200/
steps are
cd ShuffleNet-tensorflow
.python tiny_imagenet/move_data.py
to slightly change the folder structure of the data.python image_dataset_to_tfrecords.py
to convert the dataset totfrecords
format.- (optional) If you want to change the network's length,
edit the number of ShuffleNet Units inshufflenet/CONSTANTS.py
. python train.py
to begin training. Evaluation is after each epoch.- logs and the saved model will be in
logs/run0
andsaved/run0
.
To train on your dataset, you need to change a few values in shufflenet/CONSTANTS.py
file.
- Python 3.6
- tensorflow 1.4
- tqdm, Pillow, pandas, numpy