Home

Awesome

DogFaceNet

This code is an implementation of a deep learning method for dog identification. It relies on the triplet loss defined in FaceNet paper and on novel deep learning techniques as ResNet networks.

Dog faces pictures were retrieved from the web and aligned using three handmade labels. We used VIA tool to label the images. The dataset is available here: Zenodo and the old dataset here: Releases Page.

This code contains also an automatic face alignement tool and several implementation of GANs (Generative Adverserial Networks) onto the dataset.

Citation

If ever this project (code or dataset) is used for a publication, please cite: A Deep Learning Approach for Dog Face Verification and Recognition

@InProceedings{10.1007/978-3-030-29894-4_34,
author="Mougeot, Guillaume and Li, Dewei and Jia, Shuai",
editor="Nayak, Abhaya C. and Sharma, Alok",
title="A Deep Learning Approach for Dog Face Verification and Recognition",
booktitle="PRICAI 2019: Trends in Artificial Intelligence",
year="2019",
publisher="Springer International Publishing",
address="Cham",
pages="418--430",
isbn="978-3-030-29894-4"
}

Dataset

[NEWS 2024/06/28] The complete dataset is now available on Zenodo.

The old dataset is still available for download on the releases page: Releases Page

Run the recognition algorithm

To run the code you will need:

Then run the following command from the root directory of the project:

python dogfacenet/dogfacenet.py

To run properly the dataset has to be located in a data/dogfacenet folder or you will have to edit the config part of the dogfacenet.py file.

The above command will train a model and save it into output/model directory. It will also save its history in output/history.

Content

As previously described, the stable version is in dogfacenet/dogfacenet.py. It contains:

The dogfacenet-dev folder contains the developer version of the code. Model evaluation (verification, recognition, clustering, ROC curve, observation on the heatmap, ...) is in developer folder. It will be transfer in stable folder soon. The main dev version is in dogfacenet-dev/dogfacenet_v12-dev.ipynb jupyter notebook file.

The rest of the project contains:

Results on face verification

UPDATE: the now available dataset is bigger (around 8600 pictures) than the one presented in the article (around 1400 pictures). The following results (and the one presented in the paper) were found using the small dataset. The results on the big dataset are unfortunately worse than the one on the small dataset (86% accuracy on the open-set): this can be explained knowing that there are much more dogs per breed in the test set, it thus makes the problem harder (two different dogs of the same breed are very similar).

The current version of the code reaches 92% accuracy on an open-set (48 unknown dogs) of pairs of dogs pictures. That is to say that for a pair of pictures representing either the same dog or two different dogs, the current code could tell if it is the same dog or not with an accuracy of 92%.

Here is the corresponding ROC curve:

picture alt

Here follows some false accepted examples and false rejected ones. The model mistakes are mainly due to light exposure, dogs' posture and occlusions.

picture alt

Results on face clustering

The obtained code presents great results on face clustering (even for dog faces that the code hasn't seen before). Here follows is an example of two of these clusters: the left one shows a correct example and the right one shows a mistake.

picture alt

The face detector

This part of the code is still in development. The current detector can for now detect dog faces on 64x64 images. Here follows a set of examples given by the current algorithm on a testing set.

picture alt

As the dataset contains only 3 keypoints (the two eyes and the nose) we had to modify the dataset to extract a bounding box. We created a small piece of code that automatically applies a 3D mask on the dog faces using the landmarks. We then considered the middle of the dog brain as the middle of the bounding box. Here follows some examples of computed 3D masks:

picture alt

GAN

The Generative Adverserial Network created by NVIDIA in https://github.com/tkarras/progressive_growing_of_gans gives the best results on our dataset. Here follows the results obtained using a single GPU (a GTX1080) during a day of training on the dataset:

picture alt