It's all about being a:
0
: Cat
1
: Dog
This project proposes three differents Deep Neural Network (DNN) to face the well known Kaggle Dog and Cat Classification challenge. You can get more details about it at https://www.kaggle.com/c/dogs-vs-cats.
The DNN here used for the purpose of beating the challenge are the following:
LeNet
DeepConvNet
AlexNet
(pre-trained model)
You can find more information about these DNN here: https://medium.com/@sidereal/cnns-architectures-lenet-alexnet-vgg-googlenet-resnet-and-more-666091488df5
Each of these DNN is really sensitive to several hyperparameters, which in turn provide a better or worse fine tuning.
- python 2.7
- tensorflow 1.9.0 or greater
- opencv
First of all, download the repository by running:
git clone https://github.com/DavideNardone/DeepCatnDogRecognition.git
unzip DeepCatnDogRecognition-master.py
Before training or testing any of the DNN available in this project, you must create some directories under the root project by running the following commands:
mkdir plots
mkdir results
mkdir ckpt
mkdir npys
Once you've done this, you might need to set up some paths, located in the following python files:
src/train_net
src/configs
src/create_test_submission
tools/loader
To train the network run:
python train_net.py <MODEL>
where the MODEL
parameter specify the kind of DNN you want to train (e.g., LE-NET, DEEP-CONVNET, ALEX-NET)
The latter network is a pre-trained network and it works by loading its proper weights which can be downloaded at the following link:
http://www.cs.toronto.edu/~guerzhoy/tf_alexnet/ that need to be located at the root of the project folder.
To create the submission test useful for classifying the test set, run the following command:
python create_test_submission.py <MODEL>
The dataset used for train and test the DNN can be downloaded at the following link: https://www.kaggle.com/c/dogs-vs-cats-redux-kernels-edition/data
Once you've downloaded it, you must unzip and locate it under the root project in order to make everything run smoothly.
The models accuracy/loss achieved both on train and validation are shown below:
TRAINING_SET
LE-NET (~98 epoches)
+/- 0.78 ACC
+/- 0.5 LOSS
DEEP-CONVNET (~20 epoches)
+/- 0.86 ACC
+/- 0.4 LOSS
ALEX-NET (~15 epoches)
+/- 0.93 ACC
+/- 0.9 LOSS
VALIDATION SET
LE-NET
+/- 0.70 ACC
+/- 0.5 LOSS
DEEP-CONVNET
+/- 0.93 ACC
+/- 0.2 LOSS
ALEX-NET
+/- 0.9 ACC
+/- 0.9 LOSS
NB: As you might know, DNN are ruled by several hyperparameters that in turn affect the fine tuning process. The results presented here might not be the best one since a better fine tuning process and a more efficient image pre-processing might led to better results.
In case something goes wrong, make sure:
- You've created all the required directories
- Any configuration path is rightly set up
- You've installed the right library versions
Davide Nardone, University of Naples Parthenope, Science and Techonlogies Departement,
Msc Applied Computer Science
https://www.linkedin.com/in/davide-nardone-127428102
For any kind of problem, questions, ideas or suggestions, please don't esitate to contact me at: