Create simple recognition object detection in the live time on the Raspberry Pi — version 2. Using TensorFlow Lite
Short summary:
In this article, I will explain how to create a solution for object detection on Raspberry Pi 4 (4 GB) from Pi-camera in live time.
I will use pre-trained model.
Code for this article is available here
Note before you start:
So, Let’s start :)
Hardware preparation:
Software preparation:
For run this application just run the next commands:
Clone models list from Tensorflow repository:
sudo mkdir object_detectioncd object_detectionsudo git clone --depth 1 https://github.com/tensorflow/models.gitcd models/research/sudo protoc object_detection/protos/*.proto --python_out=.cd object_detection
Upload Object detection pre-trained model and unzip
wget http://download.tensorflow.org/models/object_detection/ssdlite_mobilenet_v2_coco_2018_05_09.tar.gzsudo tar -xzvf ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz
Preparing VNC (if you have)
If you go to VNC Server Options (right-click on the VNC status icon in the top right) and check to Enable direct capture mode on the Troubleshooting page. This will allow you to see the camera output via VNC. Like on the screenshots:
Clone my Python script for object detection to this directory where you located and run this script.
wget https://raw.githubusercontent.com/oleksandr-g-rock/object-detection/main/OD.py && python3 OD.py
Result:
So in this article, we created simple recognition object detection in the live time. Code from this article here.