22

Deep Learning: Recognise your home pets!

 3 years ago
source link: https://mc.ai/deep-learning-recognise-your-home-pets-2/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Deep Learning Object-Detection

Deep Learning: Recognise your home pets!

Ever wondered how would a face recognition for a pet would work? Phone Unlock? I’ll be presenting the project in a way that you guys too will be able to recognize your own pet.

(rights: own image)

Check my GitHub repository for source code . If any issues encountered please do send an email to me.

ROADMAP

Here is the roadmap to this article:

1] Introduction

2] Prerequisites for demo and usage

3] Examples and results

4] Future Improvements

Here we go!

1] Introduction

If you’re not familiar with object detection please check out an article that I wrote recently about the Yolo architectures, despite talking about yolov4 there and using yolov3 here, the main concepts remain.

2] Prerequisites for demo and usage

System prerequisites are the same found on my Github repository. So go ahead and clone my repository.

git clone https://github.com/miki998/pet_recognition

Once you’re done downloading, you’ll have to get some extra files that I, unfortunately, could not upload to git due to its size. You’ll have to ask me and I will share you the links through google drive.

Put them in the following folder ./DARK/weights . Double-check you meet all requirements, (requirements.txt). Alright, you’re now good to go.

Standard Run

Supposedly all, if everything is in the order you simply have to put images of the pets you want the model to remember/recognize. And then

python3 train.py -<arguments>

Arguments will be explained when you simply run python3 train.py.

If you want to add more pets (i.e cats or dogs) for the model to recognize then train them separately and in an incremental fashion (meaning, one after the other plus, you can add multiple images of the same pet)

To recognize a pet

python3 recog.py -<arguments>

Arguments will be explained when you simply run python3 train.py.

Docker container Run (preferred method)

The commands are similar to previous ones, simply do the following before starting (start a container with the image that you supposedly built beforehand, you can find instructions in the README.md from the repository)

docker run -it -p 9999 --ipc=host <docker-image-name>

Note that <docker-image-name> is the name you gave to the image when you built it.

3] Examples and results

First of all, a batch of examples for the different trained detections for the two pets that we support (cat and dogs)

We have eyes detection:

(own image)

body detection:

(own image)

face detection:

(own image)

After a recognition model training (i.e lbph features creation and storing) on 7 different pets (we didn’t test out the limits of recognition and note that we tested all pets in a similar environment) here is my preferred pet!

(own created gif)

4] Future improvements

We have a “sort of “ real-time recognition on a limited set of pets (since we used it on a product for home pets that obviously limits the range of pets we are required to recognize) through some tricks on real-time that involves not catching all the time images from video or reducing resolution or using overpowered chips (I wasn’t in charge of this part). We are still trying to improve the recognition parts since there is an obvious limitation in numbers (the size of weights increasing at least linearly to the number of pets), other features involving automated face landmarks added with large scale diffeomorphism registration could help to normalize faces, also finding other features could help (i.e behavioral since we have body detection). In the detection part, tons of things could be done e.g replacing by EfficientDet and TensorRT, parallelizing through image split when we have the first body detections.

Conclusion

Thanks for reading and if you liked it or found this article useful please do follow me on medium and GitHub for more projects. For the weights simply email me, they are quite heavy plus I only provide detection weights since recognition weights are specific to pets you want to recognize.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK