This repository contains a Keras implementation of SqueezeNet, Convolutional Neural Networks (CNN) based image classifier. SqueezeNet model is trained on MIO-TCD classification dataset to correctly label each image.
- SqueezeNet Paper
- SqueezeNet Official Repository
- Systematic evaluation of CNN advances on the ImageNet
- MIO-TCD: A New Benchmark Dataset for Vehicle Classification and Localization
- MIO-TCD dataset
The SqueezeNet architecture is implemented using Keras Functional API with TensorFlow backend. SqueezeNet architecture implemented in this repo has 9 fire modules as described in the paper but number of filters in convolutional layers are reduced for MIO-TCD dataset with 11 classes.
The following library versions are used:
- Keras 2.2.4
- TensorFlow 1.8.0
MIO-TCD classification dataset consists of 648,959 images divided into 11 categories {Articulated truck, Bicycle, Bus, Car, Motorcycle, Non-motorized vehicle, Pedestrian, Pickup truck, Single unit truck, Work van, Background}.
- Download the dataset from here.
- Unzip the images and corresponding labels.
The training details of SqueezeNet for Vehicle Classification:
- SGD with momentum is used to train the CNN.
- Initial learning rate is 0.001 and "Linear Learning Rate Decay" policy is used as described in the paper Systematic evaluation of CNN advances on the ImageNet. The learning rate is decreased linearly by each SGD batch update.
- Validation split of 0.1 is used to evaluate the performance after each epoch.
- Run train.py script to start training the network.
python ./train.py --dir /home/dataset/train --batchsize 64 --epochs 10
- After training for 10 epocs, the SqueezeNet model reaches 92 % validation accuracy.
- Training history of accuracy, loss and learning rate for 10 epochs:
After training finishes, train.py saves the SqueezeNet model and model parameters to be used for prediction.
./model/squeezenet_model.h5
./model/model_parms.json
To predict the label for a vehicle, run the predict.py script.
python ./predict.py --test-image ./images/test_image.jpg
The prediction results from test images in the dataset: