Object Detection with Deep Learning on Raspberry Pi

This project is about how we can make a Raspberry Pi detect objects and identify what object it is. The Raspberry Pi learns to identify the object by training with many different images and predict images that never seen.

Engineer

Albert C.

Area of Interest

Software Engineering; AI

School

Cupertino High School

Grade

Incoming Junior

Final Milestone

objectdetection-process
In my final milestone, I added a device called a Coral USB accelerator, which helps my Raspberry Pi compute faster predictions. In addition, I was able to use the picamera module instead of cv2, since I discovered that the picamera module has a smoother a less laggy camera than cv2. To get the picamera module, I installed zope.annotation and Pillow, a library to open, manipulate, and saving different images on distinct image file formats. Previously, I can only get about 9 fps, but now, I can get 16 fps, which is a huge improvement in my project. Now my object detection has a fast camera and an accurate prediction. The process of object detection is to gather many training images. These images will help the computer identify the objects it needs to detect. All of the images will be combined into a model. When the program is running, an image is captured from the camera and will make a prediction from four parameters, which are the class (the object it detected), the score (which is the accuracy of the prediction), a rectangle (to surround a rectangle around the specified object), and the number of objects it detected. The image on the bottom is a diagram of the process of object detection. Overall, I learned many concepts on deep learning and I hope it will be very beneficial to my future.

Second Milestone

img_4430
In my second milestone, instead of object detection from a picture, I detected the objects in real-time, so it involves a camera. Before creating object detection in real-time, I successfully created a somewhat real-time object detection in Nanonet. But, the real-time was very slow, and I can only call for a limited amount of times, so I decide to go back to Tensorflow. In the process of building a real-time object detection, I used a pre-trained model and the code was very similar to a previous code I used on Nanonet, only the model ID is different. As a result, the object detection in real-time was working and was able to detect objects by surrounding them by a rectangle. Some problems that occurred were installing a protocol buffer because I did not have a file or directory. Eventually, I was able to solve the problem by searching in Google and continued making my object detection. Another problem that occurred was that the object-detection was ten seconds behind, so I tried to use a newer model. Although it improved the delay by two seconds, I decided to order the Coral USB accelerator to boost the computing. After making minor changes in the code, I was able to have a three-second delay. For my next milestone, I want to make the model compute faster because the computing now is roughly two to three seconds behind.

First Milestone

My first milestone was to increase the accuracy of the images and to identify more images other than just the objects. I made an account in Nanonet to train with the images I annotated and tested with different images to make the Raspberry Pi predict an image that it never has seen. A problem that occurred was the Raspberry Pi was not able to predict a basic image of a cup, so I annotated more images that were similar to that image and it was able to predict that image. Soon, I will annotate more images to predict more objects. I also hope to have object-detection in real-time, but not by a picture.

Leave a Comment

Start typing and press Enter to search

Bluestamp Engineering