FindPet: Identification of lost pets with Artificial Intelligence

La Paz. Deep Learning. 2021 In this article we will use Artificial Intelligence techniques to find lost pets. Those people who have lost a pet for different reasons know that although many...

A learning project shared by the community. The article documents its team, methods and results; it does not establish that the prototype is ready for real-world use.

FindPet: Identification of lost pets with Artificial Intelligence

This archive includes automatic translations. Audio, video and text inside images remain in their original language.

La Paz. Deep Learning. 2021

In this article we will use Artificial Intelligence techniques to find lost pets. Those people who have lost a pet for different reasons know that although many return to their owners, a large percentage does not achieve the reunion. About 420,000 pets, mainly dogs and cats, are lost annually in Peru and very few are found or returned to their owners, because it is very difficult to identify them.

Pet identification is usually done through metal tags hung around their neck, with their name and the owner's phone number. Others choose to insert a chip under the skin and a few, because of the cost, prefer GPS and even tattoo them. When they lose their pets, people choose to look for them through posters posted on posts, through social networks, advertisements in the media or by offering rewards in money or with tickets to concerts or soccer games. That is why the objective of this project is to help people find their lost pets through Artificial Intelligence and Deep Learning to identify their pets quickly, accurately and economically.

Problematic

Every day, it is estimated that approximately 30 to 40 domestic animals, including dogs and cats, are lost in Lima alone. However, it is estimated that this figure may be higher, not only when accounting for the rest of the cities in Peru, but also because many people do not know how or where they can report the loss or loss of their pet. Very few pets are found or returned to their owners, because it is difficult to identify them and do the correct tracking. As a consequence, many pets end up as stray animals, causing overpopulation that ends up contaminating the city with their feces and the parasites that are expelled through them.

Objective

Develop an application that helps people report and find lost pets quickly using Artificial Intelligence with Deep Learning techniques.

Datasets

Existing and open access datasets were used, for the classification of breeds the datasets from Stanford containing images of 120 dog breeds from around the world and Thudogs containing 130 dog breeds along with bounding boxes of the entire body and head of the dog in each image; while for the identification of pets, Flickr which contains only the faces of the dog and is divided by name of the dog belonging to only two types of breed: pugs and huskies.

Pet Identification Process

The process of identifying lost pets using Artificial Intelligence consists of four phases as shown in the following figure, each of them is detailed below.

  • GROSS PHASE: Breed Classification

In this phase, the image of a lost or found dog is entered and it is evaluated with the breed classification model and as output the top N of breeds to which the dog belongs is obtained. This serves as input for the middle phase where only the images obtained based on found or lost dogs of these "N" breeds will be entered.

  • MIDDLE PHASE: Face Detection

In this phase, the image of the found dog and the result of the classification of this image are taken as input, obtaining the top N images of the breeds, to be evaluated by the face detection model, in this case yolo v5, obtaining as output the bounding boxes of the dog's face for each image.

  • FINE PHASE: Identification of the pet

In this phase, the images of the found or lost dog are entered as input along with the images of the top N and the face already cropped using the bounding boxes obtained from the middle phase, to train the face identification model.

  • SUPERVISED DECISION

Finally, to make a more precise decision we use supervised decision with parameters such as the age and gender of the dog, to be able to narrow down and have more precision to identify the correct dog.

Models

The breed classification and pet identification model used convolutional neural networks, specifically Inception v3 and Xception. This is an image classification problem with N possible outputs, where N is the number of breeds or individual dog names: 120 for the Stanford dataset, 130 for Thudogs and 42 for Flickr. The pet face detection model used YOLO v5.

  • Inception v3

Inception-v3 is a convolutional neural network architecture from the Inception family that makes several improvements, including the use of Label Smoothing, 7 x 7 factored convolutions, and the use of an auxiliary classifier to propagate label information at the bottom of the network, along with the use of batch normalization for layers in the head-end.

Below is the architecture diagram of Inception v3:

  • Xception

Xception means “xtreme inception”. This architecture rethinks the way we view neural networks, particularly convolutional networks. And, as the name suggests, it takes the principles of Inception to the extreme.

In a traditional convolutional network, convolutional layers look for correlations in both space and depth. In Inception, we started to separate the two slightly. We use 1x1 convolutions to project the original input into several separate smaller input spaces, and from each of those input spaces we use a different type of filter to transform those smaller 3D blocks of data. Xception takes this one step further. Instead of splitting the input data into multiple compressed chunks, it maps the spatial correlations to each output channel separately and then performs a 1x1 depthwise convolution to capture the correlation between channels.

Below is the architecture diagram of Xception, where the data first passes through the input stream, then through the middle stream that is repeated eight times, and finally through the output stream. Note that all convolution and separable convolution layers are followed by batch normalization.

  • Yolo v5

Yolo v5 is an object detection model, and its first official version was released by Ultralytics. As YOLO v5 is a single-stage object detector, it has three important parts like any other single-stage object detector.

  • Model Backbone: It is mainly used to extract important features from the given input image. In YOLO v5, CSPs — Cross Stage Partial Networks are used as a backbone to extract a large number of informative features from an input image.
  • Model Neck: Mainly used to generate feature pyramids. Feature pyramids help models generalize well to the object scale. Helps identify the same object with different sizes and scales. Feature pyramids are very useful and help models perform well with unseen data. There are other models that use different types of feature pyramid techniques like FPN, BiFPN, PANet, etc.
  • Model Head: Mainly used to perform the final detection part. Applied anchor boxes in features and generates final output vectors with class probabilities, objectness scores, and bounding boxes.

Below is the architecture diagram of Yolo v5:

Results

  • GROSS PHASE: Breed Classification

  • MIDDLE PHASE: Face Detection

  • FINE PHASE: Identification of the pet

Conclusions and Recommendations

  • In the coarse breed classification phase, it is concluded that the most optimal model is Inception v3 with an accuracy of 83.35% using the Stanford dataset and 78.28% for the Thudogs dataset.
  • In the middle phase of face detection, only the Yolo v5 model was tested, obtaining a MAP of 98.5%.
  • In the fine phase of face identification, it is concluded that the most optimal model is Xception with an accuracy of 67.5% for the Flickr dataset once the data augmentation has been performed.
  • The use of deep learning models in identifying lost pets will reduce the pet's return time to your home, allowing for the right tracking.
  • In the fine phase it is recommended to try GANs for data augmentation.
  • In the coarse phase, it is suggested to combine the Stanford and Thudogs datasets, and test the developed models.
  • In the coarse phase, it is recommended to create your own dataset for identification.
  • In the middle phase, it is suggested to try new models additional to yolo v5.

References

  • Dog Identification using Biometrics and Neural Networks

https://arxiv.org/pdf/2007.11986v1.pdf

  • Dog Breed Identification Using Deep Learning

https://www.researchgate.net/publication/328834665_Dog_Breed_Identification_Using_Deep_Learning

  • Yolo v5

Train Custom Data - ultralytics/yolov5 Wiki? This guide explains how to train your own custom dataset with YOLOv5 ?. UPDATED 25 July 2021. Clone this repo…github.com

Project presentation: DemoDay

Open video or resource

More artificial intelligence!

The mission of Saturdays.ai is to make artificial intelligence more accessible (#ai4all) through intensive courses and programs where projects for good are carried out (#ai4good).

Explore our AI master’s programme at https://saturdays.ai/master-ia-online/

If you want to learn more about artificial intelligence join our community at community.saturdays.ai or visit us on our website www.saturdays.ai Join us! Saturdays.AI

WRITTEN BY

Mishel Carrion Lopez

Saturdays.AI

Saturdays.AI

Saturdays.AI is an impact-focused organization on a mission to empower diverse individuals to learn Artificial Intelligence in a collaborative and project-based way, beyond the conventional path of traditional education.

FROM CURIOSITY TO PRACTICE

Your next step starts here.

Put an idea into practice or find people to continue learning with.

Receive new stories in your RSS reader ↗

A history of the Saturdays.AI community. Originally published on Nov 21, 2021.

← More community stories