We're going to build 3 image CNNs using just Tensorflow and Keras. The first is a simple classifier for images that will show you the basics of the keras api and how to build a simple CNN. The second is a classifier that uses pre-trained VGG16 convolutional layers and fine tunes them for a different classification task. The third model is a CNN regressor taht also uses pre-trained VGG16 layers but fine tunes them for the task of face detection. The goal for this is to fully understand how a Convolutional Neural Network works.
This is the code for the workshop "Implementing CNNs with keras and tensorflow".
Includes 3 different CNN architectures:
-
A simple CNN for image classification
-
A CNN that uses the pretrained layers from VGG16 for image classification
-
A CNN regressor that uses the pretrained layers from VGG16 for the task of face detection
- Python
- NumPy
- OpenCV
- scikit-learn
- Tensorflow
- Keras
Run pip install -r requirements.txt
to install the requirements.
Install pip here.
Step 1.
Clone this repository with git
.
$ git clone https://github.com/AlexGidiotis/Keras-tutorial-on-CNNs.git
$ cd Keras-tutorial-on-CNNs
Step 2. Download celebA data
$ mkdir data/
Step 3. Move the data you downloaded to the data directory you just created.
Step 4. Created a directory to save the trained models.
$ mkdir model/
Step 5. Try training your own models.
-
The simple CNN achieves approximately 80% accuracy on the cifar10 data after 50 epochs.
-
The CNN with the VGG16 pre-trained layers achieves approximately 91% accuracy on the cifar10 data.
-
The CNN regressor achieves approximately 187 Mean Squared Error on the celebA data after 28 epochs.