- A tensorflow implement for PeleeNet described in Pelee: A Real-Time Object Detection System on Mobile Devices. This repo mainly focuses on classification part.
- Architecture of peleenet
- Net block: stem block & dense block
- stem block
- dense block
- GPU: Geforce GTX 1080Ti
- ubuntu16.04
- tensorflow >= 1.0
- python 2.* or python 3.*
- numpy
- scipy
- cPickle
- Pillow
Notes: Python2 is default. If you have python3.*, cifar10.py, cache.py dataset.py should be replaced by files stored in python3 folder. Any problems, you can email me!!!
The following structure show the main frame of this repo.
PeleeNet
|———— data/ # store cifar10 dataset
|———— cifar10/
|———— python/ # python3 support
|———— cifar10.py
|———— cache.py
|———— dataset.py
|———— main.py # repo entry
|———— PeleeNet.py # mobilenet class
|———— layers.py # stem block, dense_block, transition_layer
|———— config.py # parameters setting
|———— utils.py # generate datasource
|———— cifar10.py # cifar10.py, cache.py dataset.py for cifar10 reading
|———— cache.py
|———— datatset.py
# if you want to use your own datasets, add your datasets type in line 38 in utils.py.
# Images are [input_height, input_width, input_channel] formats and labels are one_hot encoding formats.
$ git clone https://github.com/nnuyi/PeleeNet.git
$ cd PeleeNet
In this repo, since the computation, I mainly focus on CIFAR10 datasets.
-
CIFAR10: You are required to download CIFAR10 datasets here, unzip it and store it in './data/cifar10/' , note that CIFAR-10 python version is required. You can unzip it in './data/cifar10/' using the following command:
$ tar -zxvf cifar-10-python.tar.gz # you will see that data_batch_* are stored in './data/cifar10/cifar-10-batches-py/'
$ python main.py --batchsize=128 \
--is_training=True \
--is_testing=False \
--datasets=cifar10 \
--input_height=32 \
--input_width=32 \
--input_channels=3 \
--num_class=10
# If GPU options is avaiable, you can use it as the instruction shows below:
$ CUDA_VISIBLE_DEVICES=[no] \
python main.py --batchsize=128 \
--is_training=True \
--is_testing=False \
--datasets=cifar10 \
--input_height=32 \
--input_width=32 \
--input_channels=3 \
--num_class=10
# notes: [no] is the device number of GPU, you can set it according to you machine
$ CUDA_VISIBLE_DEVICES=0 \
python main.py --batchsize=128 \
--is_training=True \
--is_testing=False \
--datasets=cifar10 \
--input_height=32 \
--input_width=32 \
--input_channels=3 \
--num_class=10
-
After training, you can see that the testing accuracy rate can reach to 89.83%.
-
loss function and training accuracy shows below:
- Continute to fine-tuning hyperparameters to improve its accuracy!!!
- Train in cifar100
- Train in Caltech101
- Pelee: A Real-Time Object Detection System on Mobile Devices
- cifar10.py is derived from Hvass-Labs's codes
Email: computerscienceyyz@163.com