Transfer Learning & Classification of dogs and cats
Transfer learning is a machine learning technique in which a model trained on one task is used as a starting point for a model on a second, related task. It is particularly useful when tagged data is scarce or expensive to obtain. For this project, different CNN models will be used to classify dogs and cats
Dataset
The database consists of 4000 images of dogs and cats only, for which it was decided to generate a database of the classifications, that is, to generate a pair of corresponding image tags, cats with a tag of 0 and dogs with a tag of 1.
Data preparation
Data preparation consisted of generating the labels for each image (dog or cat), normalizing the images, mixing the images and labels without losing their pair, and separating the data into training, validation, and test sets to images and annotations based on the rule of 60,20,20.
Normalization
Splitting data based on Rule 60,20,20
MobilNet
EfficientNetB7
InceptionResNetV2
Downloading models
Using TensorFlow, three models were downloaded from Keras to perform the learning transfer and add layers to the final part of each model. These and more models can be found here.
Results
After training and verifying an expected behavior by viewing the loss graphs for the training sets, the results obtained show us that the best models using transfer learning were InceptionResNetV2 and MobilNet. The following images and tables show the final results.
Results for dogs classification
Results for cats classification
Mobilnet model predictions
EfficientNetB7 model predictions
InceptionResNetV2 model predictions
For more details, you can see the report here.