How to Set Up TensorFlow Object Detection on the Raspberry Pi

preview_player
Показать описание
Learn how to install TensorFlow and set up the TensorFlow Object Detection API on your Raspberry Pi! These instructions will allow you to detect objects in live video streams from your Picamera or USB webcam.

I created this video using a Raspberry Pi 3 Model B running Raspbian Stretch. It should also work for the Raspberry Pi 2.

---- Link to steps in video ----
1:00 Step 1. Update the Raspberry Pi
1:38 Step 2. Install TensorFlow
4:14 Step 3. Install OpenCV
6:03 Step 4. Compile and Install Protobuf
10:29 Step 5. Set up TensorFlow directory structure
14:39 Step 6. Test out object detector!

---- Links mentioned in video ----

Music: Broke For Free - My Always Mood
Рекомендации по теме
Комментарии
Автор

Hey everyone! There are two MAJOR updates that make this guide much easier:
1) Installing TensorFlow on the Pi is now much easier. Rather than downloading and installing the wheel file at the beginning of Step 2 of this video, you can simply issue "sudo apt-get install libatlas-base-dev" and then "pip3 install tensorflow" to install it. You still need to issue "sudo pip3 install pillow lxml jupyter matplotlib cython" and "sudo apt-get install python-tk" after installing TensorFlow.
2) You don't have to build protobuf from source anymore! In Step 4, simply use "sudo apt-get install protobuf-compiler". Now you can skip everything from 6:05 to 10:28 .


Also, it seems opencv-python has one more package requirement now. In Step 3, when doing the apt-get commands, add "sudo apt-get libatlas-base-dev".

This guide works on both the Raspberry Pi 3 and Raspberry Pi 4 (Raspbian Stretch and Raspbian Buster).

EdjeElectronics
Автор

Hi everybody! Two updates:
1) Installing TensorFlow on the Pi is now much easier. Rather than downloading and installing the wheel file at the beginning of Step 2 of this video, you can simply issue "sudo apt-get install libatlas-base-dev" and then "pip3 install tensorflow" to install it. You still need to issue "sudo pip3 install pillow lxml jupyter matplotlib cython" and "sudo apt-get install python-tk" after installing TensorFlow.
Good luck with your projects!

EdjeElectronics
Автор

I can't thank you enough to explain everything step by step. Liked and subbed.

barskorkmaz
Автор

After two days and going though couple of errors, I finally got it working. Thank you for the tutorial, I learned a lot during this project.

RossRocks
Автор

Man you should be a professor. You explain everything easily

TheBeatboxHitmanTwo
Автор

Edje - You are the best. Tried couple of other instructions, but yours is the only one working! THANK YOU

paulhoekstra
Автор

May i know if I trained my own model, did i need to use ssd mobile net model to train my dataset? I have use my frozen inference graph that have been trained using faster rcnn and the fps on the raspberry pi is very slow. Please enlighten me.

muhammadsalehuddin
Автор

Great job. You have helped me so much with this tutorial, keep up the great job it's extraordinary

samahyadri
Автор

I have been using your tutorials for the past 3 weeks and they have been really helpful. I just wanted to say thanks I really appreciate the work you have done.

DanialStreetFighter
Автор

how can I intergrate your Object_detection_picamera with .hi5 model?

wpcgncs
Автор

witch python version for because 3.5.1 is not compatable?

ThePhobosPL
Автор

Hi, I just followed your tutorial and it works! Thank you so much!

xinyueyang
Автор

Hi, may I know if I want to replace the model path to others model in the python file for the object_detection_picamera.py, do I need to change other code in this file?

echeetay
Автор

Hi. During I execute the "make" command in the protobuf directory i get this error of
"libtool: error: is not a valid libtool object"
I need your consultancy since I couldnt figure out what to do.

egeyuceel
Автор

Hi,
I'm getting the following error "ImportError: undefined symbol: __atomic_fetch_add_8
".
Any idea?
Thx in advance

habibabassi
Автор

Hey, thank you for your tutorial!
I got this after i wan to start some object-detecting
No such file or directory
How do I fix this?
Thank you in advance for any help given!

kaisze
Автор

please help me out im stuck at
Traceback (most recent call last):
File "Object_detection_picamera.py.2", line 23, in <module>
import cv2
File "/usr/local/lib/python3.5/dist-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: libQtGui.so.4: cannot open shared object file: No such file or directory

ViralFeedHD
Автор

i tried using keras but the model save .h5 file and your example frozen inference graph. I need help.

focus_on_X
Автор

Hi,
when I want to run the Object_detection_picamera.py i have some issue from module 'tensorflow' has no attribute 'gfile'?

ThePhobosPL
Автор

Great video! Thanks for sharing!!

I just followed the steps and I was able to configure TF on my RPi. When I ran initially, I got a couple of errors. But the fixes were easy.

1. Had to upgrade numpy:
pip3 install numpy --upgrade

2. Made few changes in Object_detection_picamera.py. Diff below:
82, 83c82, 83
< od_graph_def = tf.compat.v1.GraphDef()
< with tf.compat.v2.io.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
---
> od_graph_def = tf.GraphDef()
> with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
88c88
< sess =
---
> sess =

UjjalDey