Raspberry-Object-Detection
Upcomings
- Guideline to run this project.
- Abstract Code WalkThrough
- Basic Learning Resources
- Raspberry Pi
- OpenCV
- Fun Project for Contributors. Reference Materials
- A blog from OpenCV
- A video from sentdex (pythonprogramming.net)
Guidelines
- This repository contains python script for the object detection on Raspberry Pi in real time using OpenCV.
- It uses a already trained MobileNet Architecture stored as Caffe Model.
- This model uses Single Shot Detection(SSD) algorithm for prediction.
- Look for the architecture detail here
- This code stores the input images in a queue and output the predictions along with box in queue.
- This code runs on real time videostream to output the prediction as well as bounding box across it.
- Above codes can be directly run on raspberry pi having packages imutils and cv2
- To Install, run
pip install imutils pip install opencv-python
- USAGE, To run the videostream, clone the repo and in working directory, run
python real_time_object_detection.py --prototxt MobileNetSSD_deploy.prototxt.txt --model MobileNetSSD_deploy.caffemodel
Note : Press ‘q’ to stop the videostream.
Abstract Code WalkThrough :
Overviewing real_time_object_detection.py
- Importing packages
-
Creating the argument parser for the python script
-
Initializing the list of class labels MobileNet SSD was trained to detect, then generate a set of bounding box colors for each class.
- Load the model and initialize the video stream.
- For each frame, obtain the detections and predictions.
- For each detection, if prediction is above confidence (self-defined), draw the bounding box over it.
- Shows the output frame with break condition key “q”. On Break condition, it destroys all the windows.