Raspberry Pi Object Detection Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ก.ค. 2024
  • Here's how you can make your Raspberry Pi perform real-time object detection. It's a fun project and I hope you enjoy. Leave a comment if you have any questions or future video requests.
    I may earn commission if you purchase from the links below:
    RASPBERRY PI 4: amzn.to/3BC4i9I
    ELECTRONICS COMPONENT STARTER KIT: amzn.to/3qB23xg
    USB 1080P WEBCAM: amzn.to/3Lq0OL7
    0:00 Intro
    Tensorflow github repo: github.com/tensorflow/example...
    Subscribe for more Raspberry Pi tutorials :) th-cam.com/users/samwestbytech...
    0:43 Setup Raspberry Pi
    Here's my setup tutorial: • Raspberry Pi Headless ...
    ssh into your Pi or open a terminal on your pi
    Update
    sudo apt-get update
    sudo apt-get upgrade -y
    python3 -V
    sudo -H python3 -m pip install virtualenv
    mkdir project
    cd project
    python3 -m virtualenv env
    source env/bin/activate
    4:00 Install libraries
    python3 -m pip install "picamera[array]"
    python3 -m pip install tflite-runtime
    python3
    import tflite_runtime
    tflite_runtime.__version__
    Both of the commands above should execute without errors
    quit()
    5:25 Install the example code
    git clone github.com/tensorflow/examples --depth 1
    sh setup.sh
    sudo apt-get install libatlas-base-dev
    NOTE:
    If the "git clone" command gives you trouble, you can manually download the examples folder here github.com/tensorflow/example...
    6:50 Testing!
    python3 classify.py
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 132

  • @pratyushprajapati3908
    @pratyushprajapati3908 2 ปีที่แล้ว +4

    Thank you thank you thank you so much sir... 🙏🙏🌹🌹
    I was doing this object detection using raspberry Pi for my final year project. Because of you I have learned a new thing and saved my thousands of rupees... Again thank you sir... 🙏🌹

  • @user-tk6qg2ig7i
    @user-tk6qg2ig7i ปีที่แล้ว

    great video!
    thank you for teaching me how to implement object detection with my raspiberry 4.

  • @BigGetit1
    @BigGetit1 ปีที่แล้ว

    Great video, thanks for making this!

  • @jeremy_tt4341
    @jeremy_tt4341 2 ปีที่แล้ว

    Awesome video!Thanks so much

  • @robertoguerra5375
    @robertoguerra5375 ปีที่แล้ว

    NICE!!! Thank you for this video!!!
    At least we know that the raspberry has not become self-aware 😅

  • @swat36085
    @swat36085 6 หลายเดือนก่อน

    Thank you for you brief and precise tutorial ! LMS (France)

  • @SiriusFuenmayor
    @SiriusFuenmayor 4 หลายเดือนก่อน

    really nice, it worked perfeclty with my raspberry pi3 model A. I was identified as a person an my face as a dog which is quite accurate.

  • @monerbenor6624
    @monerbenor6624 ปีที่แล้ว

    amazing, worked :)))))))))))))))))))))))))))))))) thanks alot

  • @calmrelaxangelicmusicph
    @calmrelaxangelicmusicph 2 ปีที่แล้ว +8

    can you please make a tutorial on training your own data using google colab?

  • @RETROGAME-FIX
    @RETROGAME-FIX ปีที่แล้ว

    Hi sir your tutorial was the one that worked after 3 days of finding. I wanted to know how to shutdown the video feed? And how can i get the boundries around the object? And how can we make it a standalone live feed system to a android phone or tablet? I mean i dont have to put the commands all the time. Thank you.

  • @gemininyte279
    @gemininyte279 ปีที่แล้ว

    I got to the end and it asked to install open cv2, so do I need to install that into the env?

  • @PCGamer20-YT
    @PCGamer20-YT 8 หลายเดือนก่อน

    Very cool, is there a way to add a highlighted box around the object?

  • @sudhanshugorwadkar3839
    @sudhanshugorwadkar3839 ปีที่แล้ว

    Which algorithm is used for image classification in this tutorial?

  • @matr2237
    @matr2237 2 ปีที่แล้ว

    I get an error in the end. Last command (python3 classify.py) starts but then stops and says "struct.error: unpack_from requires a buffer of at least 4 bytes". How to fix this?

  • @charleslinquist
    @charleslinquist 4 หลายเดือนก่อน

    I would like to perform object detection on a pi, and don't know if OpenCV or TensorFlow is the best tool. I want train the sw to detect any given object, and I also need an output that indicates the position, direction and (hopefully) speed of a moving object - a "follow me" or "follow a given object" feature. Any ideas or help would e appreciated. I'm a relative novice.

  • @chaitanyavekaria2025
    @chaitanyavekaria2025 ปีที่แล้ว

    Hi, I get following error when I try to install tflite-runtime using command "python3 -m pip install tflite-runtime"
    ERROR: Could not find a version that satisfies the requirement tflite_runtime(from version: none)
    ERROR: No matching distribution found for tflite_runtime

  • @drubug
    @drubug 2 ปีที่แล้ว

    After about 19 failed attempts, this one finally worked...
    My issue was trying to use Bullseye - PiCam and VNC... a combo that doesnt work!

    • @dronnomical
      @dronnomical 8 หลายเดือนก่อน

      How did you fix this ? I'm running into the same issue

  • @miguelposada3684
    @miguelposada3684 5 หลายเดือนก่อน

    Thank you so much for the video, pretty clear! However when I get to the final step after running python3 classify.pi I get errono 2 no such file in directory. Could anyone help me solving this?

  • @gasiboi3734
    @gasiboi3734 12 วันที่ผ่านมา

    Hi, i noticed that the video streaming of your Pi have 14 fps on it. I have tried installing Ultralytics YoloV8 on my Pi with the models also exported to NCNN. Now I also use a 720p webcam, however, my Pi can only give me 2fps max. I wonder if you were using a Google Coral USB Accelerator making it possible to reach 14fps for your stream. Did you? Or was it just the Raspberry Pi's power to deliver 14fps. Or does the brand of webcam even matters when it comes to fps? Would greatly appreciate a reply.
    Thanks.
    PS. I am using a Raspberry Pi 4B 8gb

  • @acmadianfaizalcasarungan5181
    @acmadianfaizalcasarungan5181 2 ปีที่แล้ว

    do you have a guide in running yolov4 tiny on raspi

  • @mkpula11
    @mkpula11 ปีที่แล้ว

    Hi Sam, fantastic video tutorial. Thank You. Have you tried (and what is necessary) to run with the Coral USB Accelerator?

    • @SamWestbyTech
      @SamWestbyTech  ปีที่แล้ว

      I have not but they look really cool!

  • @sudhanshugorwadkar3839
    @sudhanshugorwadkar3839 ปีที่แล้ว

    Can I stream this opencv object detection footage to a webpage?

  • @almegdadkhalid5522
    @almegdadkhalid5522 ปีที่แล้ว

    Hi Sam ,When I try to import tensorflow I get this error, Descriptor can't be created directly

  • @mohamedshoeib8279
    @mohamedshoeib8279 4 หลายเดือนก่อน

    hey this is so cool ,
    i have a question ... what if i take your code(python) and trying to connect it with oher devices using C programming ?

  • @valemanriquez2317
    @valemanriquez2317 7 หลายเดือนก่อน

    Hi sam can you help me? please, so sorry for my bad english but i have an error when i copy and paste in raspberry, the raspberry asks me for a user and password from git hub and i dont know what is that

  • @nanaba9027
    @nanaba9027 9 หลายเดือนก่อน

    hey how do i do this with pi camera 3

  • @sibiselvaraj9116
    @sibiselvaraj9116 ปีที่แล้ว

    Raise 0SError (port audio library not found) how do I fix this

  • @eeksy29
    @eeksy29 2 ปีที่แล้ว +1

    Hi Sam, I get a ModuleNotFoundError: No module named 'tflite_runtime' in the python process, what should I do?

    • @eeksy29
      @eeksy29 2 ปีที่แล้ว

      I have followed the process well

  • @yasmineboucetta1397
    @yasmineboucetta1397 23 วันที่ผ่านมา

    Can I use this tutorial with python3.7.3 version ?

  • @Ducerobot
    @Ducerobot ปีที่แล้ว +1

    Couldn't get it to load numpy for pi camera array . That pretty much stopped me right there is there some numpy package not mentioned here that must be installed first?.......it went on the third try wonder why ahhhhh the wonder years 😁

  • @loll1057
    @loll1057 11 หลายเดือนก่อน

    how is the fps on this one soo decent, i did couple of projects on opencv and all of them were really slow despite few optimizations

  • @VissuSalvatore
    @VissuSalvatore 3 หลายเดือนก่อน +1

    it keeps saying no module named tflite_support is found. can someone please help me?

  • @qutebamazen5491
    @qutebamazen5491 2 ปีที่แล้ว

    Thank you so much bro. can you implement Real-Time face emotion detection using raspberry pi 4 because I have a task about it and I got some error can you help us to implement it. Thank you again.
    Have a nice day and coding.

  • @charlesblithfield6182
    @charlesblithfield6182 ปีที่แล้ว

    Thanks for this video Sam. I ran a similar set but my version has bounding boxes around the objects. It also always detects my hand, bounds it and labels it “person “.
    I want to do object detection of a custom data set, specifically I want to use the pi to identify tree species from their bark. Do you know how to make a custom labelled data set to be used as training data and how to implement it?

    • @shahriarrashid1071
      @shahriarrashid1071 4 หลายเดือนก่อน

      Did you ever get a reply about this?

    • @charlesblithfield6182
      @charlesblithfield6182 4 หลายเดือนก่อน

      @@shahriarrashid1071 no reply. It’s for a system to detect Ontario tree species from just the bark pattern. I’ve been assembling image sets for training, I understand I need a lot of images but am not sure how much is enough.

    • @shahriarrashid1071
      @shahriarrashid1071 4 หลายเดือนก่อน

      @@charlesblithfield6182 i tried to detect plant disease from leaf images and i used about 500-800 images per disease for a test accuracy of 90%+.. so i guess same could apply to you? (i used a version of the plant village dataset available online)

  • @aynonsense7716
    @aynonsense7716 ปีที่แล้ว

    Will it work on raspberry pi 2?

  • @AbdullahiAhmad-po7qx
    @AbdullahiAhmad-po7qx ปีที่แล้ว

    Sir Help me on how to draw bounding box on detecting picture

  • @joachimhomann8663
    @joachimhomann8663 ปีที่แล้ว

    Thank you for this nice video.
    But i have just a IP-camera with a rtsp-stream. How can I use this cam?

    • @SamWestbyTech
      @SamWestbyTech  ปีที่แล้ว

      I haven't worked with wireless cameras before, sorry

  • @akpamsokon
    @akpamsokon ปีที่แล้ว

    hi, i need help with the script

  • @eliotcousseau3049
    @eliotcousseau3049 หลายเดือนก่อน

    I need help i tap this sudo apt-get upgrade -y and you wait like 5min me i juste have this line apt-listchanges : Reading changelogs. . . for like 45 min do you know why ?

  • @marvinjaycampana4017
    @marvinjaycampana4017 ปีที่แล้ว +1

    I've got an error missing cv2. Does this needs installing Open CV before anything else?

    • @alexpadilla3446
      @alexpadilla3446 8 หลายเดือนก่อน

      Where you able to fix it? Same error

  • @DHTSciFiArtist
    @DHTSciFiArtist 2 ปีที่แล้ว

    Can you use a webcam with the raspberry PI and this program as well.

    • @SamWestbyTech
      @SamWestbyTech  2 ปีที่แล้ว

      Yes you can. That is what I'm doing

  • @christianbrunner1199
    @christianbrunner1199 ปีที่แล้ว

    Hi, thank you for that great video. Do you think it’s possible to take a Foto, select an area in it and then compare the next photos to that area and check if the same object is in it?

    • @MidwestMusicEnthusiast
      @MidwestMusicEnthusiast 6 หลายเดือนก่อน

      Looking for a similar solution. Did you find anything?

    • @christianbrunner1199
      @christianbrunner1199 6 หลายเดือนก่อน +1

      Unfortunately not. I solved my problem in a different way. wanted to check if tax stamps are applied to a product. I just got a luminescence sensor now. @@MidwestMusicEnthusiast

  • @carmengomezalarcon1850
    @carmengomezalarcon1850 2 หลายเดือนก่อน

    Failed to import tflite_runtime: cannot import name 'core' from 'tflite_support'

  • @MrknisterKanister
    @MrknisterKanister 8 หลายเดือนก่อน +1

    would it be possible to differ between different cats (they have differnt fur pattern)?

    • @wanalmakamelia956
      @wanalmakamelia956 5 หลายเดือนก่อน

      do you already know? because im also want to different 2 different cats, longhair and shorthair

  • @woodenkadegaming4191
    @woodenkadegaming4191 2 ปีที่แล้ว +3

    hey very good till i got to the last line of code with this error
    Traceback (most recent call last):
    File "/home/pi/project/examples/lite/examples/image_classification/raspberry_pi/classify.py", line 20, in
    import cv2
    File "/home/pi/project/env/lib/python3.9/site-packages/cv2/__init__.py", line 5
    from .cv2 import
    ^
    SyntaxError: invalid syntax
    how do Ifix?

    • @mxchaotic
      @mxchaotic 4 หลายเดือนก่อน

      I have this same issue, by anychance were you able to fix?

  • @TheTobiasEnglev
    @TheTobiasEnglev ปีที่แล้ว +1

    Hello, i followed your guide, but i am getting this error code: ImportError: libIlmImf-2_5.so.25: cannot open shared object file: No such file or directory, i cant seem to get around it, any ideas how?

    • @user-ve4lw6hg6s
      @user-ve4lw6hg6s 2 หลายเดือนก่อน +1

      run this sudo apt-get install libatlas-base-dev

  • @Team23762
    @Team23762 3 หลายเดือนก่อน +1

    Mini robot based to get and place objects using tf

  • @kevingeorgejohn607
    @kevingeorgejohn607 2 ปีที่แล้ว

    Can I get the list of objects this code can detect using the pi board and camera?

    • @staj-io3fw
      @staj-io3fw ปีที่แล้ว

      could you help if you did

  • @Bllackmage
    @Bllackmage ปีที่แล้ว

    what web cam do u use for the project. or what would u consider

    • @SamWestbyTech
      @SamWestbyTech  ปีที่แล้ว

      I have the logitech 720p. It's easy and cheap

  • @jane4039
    @jane4039 ปีที่แล้ว

    Sir can you make a video “how to use Resnet50 in raspberry pi for face recognition “ thank u

  • @ineeditpvp172
    @ineeditpvp172 8 หลายเดือนก่อน

    what is the meaning of
    PEP 517

  • @francessaubreyballestra
    @francessaubreyballestra หลายเดือนก่อน

    How do I activate it if I use rpi camera?

  • @karanashu639
    @karanashu639 5 หลายเดือนก่อน

    Hey I am getting error message of : externally -managed-environment
    in setup of virtual environment

    • @Ellixified
      @Ellixified 4 หลายเดือนก่อน

      do python3 -m venv venv then source venv/bin/activate and type the command again

  • @SohanDomingo
    @SohanDomingo ปีที่แล้ว

    How to enable the bounding box for an object ?

    • @staj-io3fw
      @staj-io3fw ปีที่แล้ว

      how can i add a bounding box

  • @alagappauniversityMCA
    @alagappauniversityMCA ปีที่แล้ว

    hi bro now 2023 , raspberry pi source/apt not upgrade (connection error)

  • @Aaaa-ew8ji
    @Aaaa-ew8ji ปีที่แล้ว

    I used the object detection for my graduation project
    It’s work at the first time
    But when I run it again it’s give me that it doesn’t have a python project file
    I returned all the steps and re-download python and I still have the same problem
    Please help

    • @SamWestbyTech
      @SamWestbyTech  ปีที่แล้ว

      Perhaps you need to re-activate your virtual environment

  • @AmanChauhan-xu7iw
    @AmanChauhan-xu7iw หลายเดือนก่อน

    Hello sir, Many thanks for the video, while running the example fielERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
    [end of output]
    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-errorpip install numpy
    any idea anyone has how i can remove from this error
    I am using python 3.11.2 and tpu 2.14.0

  • @HEMANGSHUKLA_
    @HEMANGSHUKLA_ 2 ปีที่แล้ว

    import cv2 no module named cv 2
    please help

    • @SamWestbyTech
      @SamWestbyTech  2 ปีที่แล้ว

      Make sure you reactivate your virtual environment

  • @shahriarrashid1071
    @shahriarrashid1071 4 หลายเดือนก่อน +1

    Hi I'm trying this on a Raspberry pi4B with Debian 12 and raspberry pi NoIR camera V2 and I'm getting and error: "Unable to read from Webcam. Please verify your webcam settings." Could you please advise.

    • @narendradesilva3126
      @narendradesilva3126 4 หลายเดือนก่อน

      got the same issue, if anyone knows how to resolve it, I would welcome some help

    • @tammymathews8455
      @tammymathews8455 26 วันที่ผ่านมา

      did you figure it out? have the same problem

    • @shahriarrashid1071
      @shahriarrashid1071 26 วันที่ผ่านมา

      @@tammymathews8455 i downgraded to debian 11 bullseye to make it work.

  • @alexfernandesportrai
    @alexfernandesportrai ปีที่แล้ว +3

    Hi I get an error everytime I try to install picamera array. I used a fresh SD card with Raspberry Pi buster legacy.
    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for numpy
    Failed to build numpy
    ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

    • @mxchaotic
      @mxchaotic 4 หลายเดือนก่อน

      I have this same issue

    • @geshtoolee
      @geshtoolee 3 หลายเดือนก่อน

      did you find the solution to it? i'm cramming a school project and ran into this problem @@mxchaotic

    • @fifossucrilhos
      @fifossucrilhos 13 วันที่ผ่านมา

      Try python 3.7

  • @toanmatsumoto8828
    @toanmatsumoto8828 2 ปีที่แล้ว

    awesome video!
    but everytime after I trued to download the example I am asked for an username and password. I there something wrong on my end?

    • @SamWestbyTech
      @SamWestbyTech  2 ปีที่แล้ว

      Ahh thanks for pointing this out. This likely means you don't have git setup. You don't have to set it up. You can download the files manually here github.com/tensorflow/examples/archive/refs/heads/master.zip
      Just download and extract the zip and put it in your project folder

  • @Satish_Lakhan29
    @Satish_Lakhan29 2 ปีที่แล้ว

    I want to make when any object detect then voice output via speaker so know which object detect

    • @SamWestbyTech
      @SamWestbyTech  2 ปีที่แล้ว +1

      Yes you can! You can edit the sample python code take the object it detects and then use a text to speech library to read that through your speakers

    • @Satish_Lakhan29
      @Satish_Lakhan29 2 ปีที่แล้ว

      @@SamWestbyTech I want to glow led when my custom object detect.where I put this code for this?

    • @Satish_Lakhan29
      @Satish_Lakhan29 2 ปีที่แล้ว

      @@SamWestbyTech thanks

  • @benardmumba3338
    @benardmumba3338 ปีที่แล้ว

    Hai Sam great staff going on here I have been trying to implement a new one security camera that detects an object and unlike sending email but it gives you a call.. when object is detected..

    • @SamWestbyTech
      @SamWestbyTech  ปีที่แล้ว

      Sounds like an interesting project!

    • @benardmumba3338
      @benardmumba3338 ปีที่แล้ว

      @@SamWestbyTech yeah and I thought you could help

  • @user-vc8ks7sg5i
    @user-vc8ks7sg5i 2 ปีที่แล้ว +1

    I have picamera but your code can not run with me.
    look what is the error unable to read from webcam

    • @mathusudhanbaskaran8497
      @mathusudhanbaskaran8497 2 ปีที่แล้ว

      The same problem for me also... it shows an error.
      "ERROR: Unable to read from webcam. Please verify your webcam settings."

    • @staj-io3fw
      @staj-io3fw ปีที่แล้ว

      could you find a solution

  • @meontheweb5628
    @meontheweb5628 ปีที่แล้ว

    Hi does it work with color classification?

  • @KavinSRA
    @KavinSRA ปีที่แล้ว

    Hey its a good work, can we add another webcam to detect the object that detecting object using multiple cameras?

    • @SamWestbyTech
      @SamWestbyTech  ปีที่แล้ว

      Yes that should be possible. You'll have to run two scripts at the same time accessing the separate cameras

    • @Aaaa-ew8ji
      @Aaaa-ew8ji ปีที่แล้ว +1

      What should I write to run by usb camera instead of picamera[array] ?

  • @marianafernandes5131
    @marianafernandes5131 2 ปีที่แล้ว

    Hello, Sam. I am trying to run this script with a Google Teachable Machine model, but I got some errors. Do you know if it's possible to use this type of model?

    • @marianafernandes5131
      @marianafernandes5131 2 ปีที่แล้ว

      If you could make a video about it that would be great.

    • @SamWestbyTech
      @SamWestbyTech  2 ปีที่แล้ว +1

      What kind of errors do you have? I found this tutorial on Teachable Machine and TFLite github.com/christianversloot/machine-learning-articles/blob/main/using-teachable-machine-for-creating-tensorflow-models.md

    • @franciscovelasquezferrada1165
      @franciscovelasquezferrada1165 2 ปีที่แล้ว +1

      OMG Teachable machine looks great to create models.. the easiest way possible, thank you

    • @sameerwork8553
      @sameerwork8553 ปีที่แล้ว

      were u able to figure it out? I'm also trying to do this. Need it urgently for my final year project

  • @madhurareddy7143
    @madhurareddy7143 28 วันที่ผ่านมา

    Hii sam, its been 1hr but sh setup.sh is not executed completely, it just paused, I tried many times but always stopping at the same line(i.e; Installing build dependencies).
    Please help me to resolve this problem .

    • @fifossucrilhos
      @fifossucrilhos 13 วันที่ผ่านมา

      I had an issue when using pyton 3.11, try using 3.7

  • @monerbenor6624
    @monerbenor6624 ปีที่แล้ว

    Great Video, thank you so much...
    do you have a camera pi setup video?

    • @SamWestbyTech
      @SamWestbyTech  ปีที่แล้ว

      Thanks! No, sorry I don't have a pi camera setup video

  • @mathusudhanbaskaran8497
    @mathusudhanbaskaran8497 2 ปีที่แล้ว +1

    When I run the code classify.py, it shows an error.
    "ERROR: Unable to read from webcam. Please verify your webcam settings."

    • @mathusudhanbaskaran8497
      @mathusudhanbaskaran8497 2 ปีที่แล้ว

      can anyone help me

    • @Andreas2048
      @Andreas2048 2 ปีที่แล้ว

      @@mathusudhanbaskaran8497 Try this:
      sudo raspi-config
      Select 'Interface Options' and then enable 'Legacy camera support'. Finish then restart your Raspberry Pi and then run classify.py again.

    • @staj-io3fw
      @staj-io3fw ปีที่แล้ว

      @@Andreas2048 didnt work can you help me

  • @obelusstem199
    @obelusstem199 4 หลายเดือนก่อน

    Damn, bro. I am more impressed with your jawline😂

  • @user-ve4lw6hg6s
    @user-ve4lw6hg6s 2 หลายเดือนก่อน +1

    I am getting error python -m pip install subprocess-exited-with-error
    while sh setup.sh pls respond as quick as possible.love your videos bye!
    Thanks,
    Jaidev

  • @dhruvlamba1118
    @dhruvlamba1118 ปีที่แล้ว +1

    Did anyone encounter the following error? ERROR: Unable to read from webcam. Please verify your webcam settings.

    • @staj-io3fw
      @staj-io3fw ปีที่แล้ว

      could you find

  • @schlingelgen
    @schlingelgen ปีที่แล้ว

    With that thumbnail you make it seem like this is real object detection with positioning information, while in reality this is only image classification. I don't think that you're misleading people on purpose, and many viewers seem to like the solution, but it would save future viewers time when they are looking specifically for object detection ...

  • @ruhulislam3034
    @ruhulislam3034 2 ปีที่แล้ว +1

    is there a way to make a custom object detection and or after training your own model and adding that to make it classify objects that would be much appreciated if you could contact me as I need this for dissertation work

    • @SamWestbyTech
      @SamWestbyTech  2 ปีที่แล้ว +1

      It is possible. Look up a tutorial for “transfer learning object detection”