Animal Object Detection

This project quickly determines what animals are being shown on a video camera and relays the information back to the raspberry pi camera. The pi will then use this information to play the animal noise through a speaker.


Aryash Jain

Area of Interest

Software engineering


Dougherty Valley High


Incoming Junior

Third Milestone

For my final milestone, I have managed to have a speaker play out the noise that corresponds to the animal. I used the mixer class from the Pygame library to load and play the .wav files. The mixer was told to play the sounds once it had figured out the label of the prediction. I learned that if the model wasn’t able to figure out what an object was, the list that contains the labels would be empty. Using this knowledge, I made it so that the program would print out “No recognizable objects found” if the list was empty, and run through the regular check for what the label is otherwise. I trained the model to detect pigs, so the model can now recognize dogs, cats, birds, and pigs. I have also added an LED that lights up once the model has made a prediction. This serves as a visual indicator, placed at the top of the else statement that runs if the model had detected an object. Reflection: For the future, I am hoping to expand upon what I have learned about object detection and build a smart mirror. I’m still thinking about what I need to include, but I have already decided on implementing facial recognition in it. I have learned a lot about my ability as well as machine learning and I’m hoping to use that in my new project.

Second Milestone

For my second milestone, I managed to get my program to detect objects through the raspberry pi camera. I have also figured out some code that tells the program what object the pi thinks something is. For the camera, I had it wait 3 seconds after a pressed a button before taking a picture. The computer then feeds the image to the model and returns out a dictionary containing the label and the confidence score. Within this dictionary, there are many nested dictionaries and lists within the big dictionary. In order to have the computer read what the label is, I needed to enter these nested dictionaries and lists. Once I got to check what the label was, I had the program print out a message based on the result. I am planning to use this to play the corresponding animal noise for my final milestone.

First Milestone

My first milestone is training a successful model. So far, I have trained a model with around 300 samples of dogs and cats. The accuracy percentage was 89.5% and it recognized a cat with a 99.2% confidence. The training was done using Nanonets by labeling the faces of both cats and dogs, which is an instance of leading by example. It was effective because many pictures had convoluted backgrounds as well as other animals blocking the faces of the cats/dogs, which trained the model to avoid possible distractions as well as recognize cats and dogs. I plan to train the model to recognize more household animals such as birds in order to be more versatile.

Smart Mirror with Motion Detection and Facial Recognition

Leave a Comment

Start typing and press Enter to search

Bluestamp Engineering