How To Run TensorFlow Lite on Raspberry Pi for Object Detection

Поділитися
Вставка
  • Опубліковано 11 лис 2019
  • TensorFlow Lite is a framework for running lightweight machine learning models, and it's perfect for low-power devices like the Raspberry Pi! This video shows how to set up TensorFlow Lite on the Raspberry Pi for running object detection models to locate and identify objects in real-time webcam feeds, videos, or images.
    I used a Raspberry Pi 4 4GB for this video, but it also works with the Raspberry Pi 3. If you want to see how much faster the Pi 4 is than the Pi 3, check out my performance comparison video: • Raspberry Pi 3 vs Rasp...
    Have questions? Ask me on Twitter @EdjeElectronics ! I usually respond faster there: / edjeelectronics
    -- Affiliate Links --
    Get a Rasbperry Pi 4: amzn.to/2Kf0el8
    Coral USB Accelerator: amzn.to/2wxTZ8d
    Webcam used in this video (works better than the Picamera!): amzn.to/2MMBTU3
    -- Tutorial Links --
    UPDATE (10/21/20): At 6:09 in the video, I instruct you to go to the TensorFlow Lite Object Detection Overview page and right click the "Download starter model" link to copy the link address. The page has changed since I made this video, and that link is no longer correct. Copy this link for downloading the starter model:
    storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip
    Written version of this guide: github.com/EdjeElectronics/Te...
    How to train your own custom TFLite model: • How to Train TensorFlo...
    -- Music credit --
    The Process by LAKEY INSPIRED: / the-process
    Creative Commons - Attribution-ShareAlike 3.0 Unported - CC BY-SA 3.0
  • Наука та технологія

КОМЕНТАРІ • 1,6 тис.

  • @EdjeElectronics
    @EdjeElectronics  Рік тому +10

    Want to learn how to train your own TFLite model to run on the Raspberry Pi? I released a video giving step-by-step instructions for training TFLite object detection models inside your web browser using Google Colab and deploying it on the Pi. Check it out here!
    ua-cam.com/video/XZ7FYAMCc4M/v-deo.html

    • @randomvideochamber1723
      @randomvideochamber1723 Рік тому

      FIRST!!!

    • @JoseMoreno-hp2le
      @JoseMoreno-hp2le Рік тому

      Edje Electronics is it better to use the 8G or 4G raspberry pi

    • @andreguimaraes6509
      @andreguimaraes6509 5 днів тому

      Can someone help me? I have a problem with the following command step "sudo pip3 install virtualenv", when I execute this command the following error "externally-managed-environment" appears, I performed all the previous steps but I was unable to resolve it

  • @NoHack_Know_How
    @NoHack_Know_How 3 роки тому +27

    BroHam !!!!! this is what I was looking for, something simple to catapult my curiosity to see if I like it !!! Excellent work my friend.

  • @AffectiveApe
    @AffectiveApe 4 роки тому +2

    I find it absurd, but also a complete testament to what you have done here, that I was able to get this working in about 15 minutes on the first try. Thank you!!!!

  • @tbx1024
    @tbx1024 4 роки тому +2

    Thank you so much, I used your older guide for Tensorflow with SSDLite before, and now you release this. Thank you!

  • @omarcruz6326
    @omarcruz6326 4 роки тому +3

    Oh Man, that's a really great video!
    I definitively have to try this !
    Thanks for the great work.

  • @Ko6i
    @Ko6i 3 роки тому +10

    9:49 nice acoustic person/backpack you've got there xP

  • @w2w900
    @w2w900 4 роки тому +1

    Dude! It worked!!! Thanks so much. I tried one of your older videos but had no luck so I'm pumped to have something that finally runs!

  • @KowPlayzMinecraft
    @KowPlayzMinecraft 4 роки тому +1

    No joke, I actually love you, I've been looking everywhere for a video like this!

  • @jonathangerard745
    @jonathangerard745 4 роки тому +5

    Amazing thing done on the Raspberry Pi, Sir. All this while I thought Tensorflow would never work properly on the Pi. But this video helped a lot, Sir. Please keep geeking Sir. :)

  • @koustubhkashalkar
    @koustubhkashalkar 4 роки тому +6

    This is super. very methodical and complete video. worked perfectly.

  • @crookedikon
    @crookedikon 4 роки тому +1

    So excited. I've been looking for a light weight model to put onto a pi in a RC car - this guide was straight forward, you've put a lot of hardwork in getting everything done, and to see it in action is amazing. Looking for that next video about what will speed up the FPS! Thanks man!

    • @simeonmarkoski278
      @simeonmarkoski278 4 роки тому

      Can you please tell me why my camera window is not showing? for webcam

  • @alldudu4583
    @alldudu4583 Рік тому +2

    Thank you so much for this guide, i was strunggling a lot with the object detection application until i found your guide :)

  • @EdjeElectronics
    @EdjeElectronics  2 роки тому +5

    I recently updated some of the setup scripts to work with newer versions of Raspberry Pi OS. (With Raspberry Pi and TensorFlow always releasing new versions of software, it's hard to stay on top of it all.) Everything should still work when following the instructions in this video. Please let me know if you run into any errors!

    • @georgoschalkiadakis2402
      @georgoschalkiadakis2402 2 роки тому

      hi i have arasberry pi 4 b 64 bit os and im getting this error at the very end when trying to run it. I am using a high quality pi camera
      [ WARN:0] VIDEOIO(V4L2:/dev/video0): can't open camera by index
      Traceback (most recent call last):
      File "/home/pi/tflite1/TFLite_detection_webcam.py", line 171, in
      frame = frame1.copy()
      AttributeError: 'NoneType' object has no attribute 'copy'

    • @syawal-eb1nb
      @syawal-eb1nb 2 роки тому

      i run it at virtualbox with raspberry OS Desktop 32Bit. the tensorflow cannot installed. it says caould not find a version that satisfied the requirements tensorflow (From version: )

    • @Valentin-vd8gz
      @Valentin-vd8gz 2 роки тому

      I have a question... How to change the rotation of the camera ? Mine is too much rotated ://

  • @JoshuaSeagroves
    @JoshuaSeagroves 4 роки тому +3

    Great video! Definitely subscribing for more. I already have the coral device's so I can't wait to see what you do with them.

  • @rhoniandjeff7453
    @rhoniandjeff7453 4 роки тому +1

    This looks like just what I need for a project. Thank you for this. Very good video.

  • @williamledda7660
    @williamledda7660 4 роки тому +1

    Incredibly simple and verry well explained! This is exactly what I was looking for. Congratulations!

  • @AaronEstebanSEO
    @AaronEstebanSEO 3 роки тому +3

    Dude! This is cool! I didnt even know that they had this type of technology.

  • @carlosvasquez-xp8ei
    @carlosvasquez-xp8ei Рік тому +3

    This is an outstanding tutorial.

  • @ShaneTalib
    @ShaneTalib 3 роки тому +2

    Absolutely great guide. Worked perfectly on Raspberry Pi4 8GB with Stretch installed!
    Thank you very much.

  • @isaacatia-abugbilla2476
    @isaacatia-abugbilla2476 3 роки тому +1

    Thank you for this video. This appears to be the material I needed to run a tflite object detection model from a pi cam.

  • @EdjeElectronics
    @EdjeElectronics  2 роки тому +15

    Hey all! If you're using the Raspberry Pi OS Bullseye release (which is the latest version), there's a couple things you have to do to get it working with the Raspberry Pi Camera:
    1. Make sure the OS is up-to-date by issuing "sudo apt update" and "sudo apt install" and then rebooting the Pi
    2. Open a terminal, enter "sudo raspi-config", go to the "Interface Options" menu, then go to the "Legacy Camera" option and enable it. Then, reboot the Pi (again).
    3. Run the TFLite_detection_webcam.py script as described in this video.
    Note: You only need to do these steps if you're using a Raspberry Pi Camera (HQ, v1, or v2). You don't need to do them if you're using a USB webcam. Also, you don't need to do them if you're using the Stretch or Buster OS releases.

    • @Satish_Lakhan29
      @Satish_Lakhan29 2 роки тому

      I want to glow led when car detected what will be the changes ?

    • @keshavharipersad2024
      @keshavharipersad2024 2 роки тому

      hey so i wanted to detect only a sertain ojbject iinstead of all kinds.. how can i do that?

    • @gregkirk893
      @gregkirk893 2 роки тому

      Thank you so much for creating, uploading, and updating this program. It’s brilliant!

    • @tredixion9315
      @tredixion9315 Рік тому

      Can you show how to setup and run in vscode or pycharm?

  • @michaelharris1370
    @michaelharris1370 4 роки тому +5

    Great video. For those looking to do this and get a higher FPS rate try using the pi camera connection instead of USB. The actual connection on the board itself will use less power and will have lower latency plus it goes directly to the GPU which is what you want for object detection. I haven’t tested this with TF Lite but the results are dramatic when running OpenCV

  • @andrewchen1744
    @andrewchen1744 4 роки тому +2

    Nice to watch this video on UA-cam! Thank you!

  • @Couchwurst
    @Couchwurst 4 роки тому +1

    Fantastic guide - clear, well sized steps, i love that install script, well documented, use cases! Thx!
    Btw, i like how to model at the end of the video is sure (more or less) that your guitar is a person or a backpack! :D

  • @yalcin1234
    @yalcin1234 4 роки тому +3

    Thank you 🙏 very useful tutorial

  • @MrSpaceboyy
    @MrSpaceboyy 4 роки тому +1

    Your tutorials are good for beginners, please keep doing them :)

  • @electricsheep2305
    @electricsheep2305 3 роки тому +2

    Thanks man I was looking for something exactly like this

  • @kyleheppler2860
    @kyleheppler2860 4 роки тому +3

    Let's get that next video! The people need the next videoooooooo

    • @simeonmarkoski278
      @simeonmarkoski278 4 роки тому

      Can you please tell me why my camera window is not showing? for webcam

  • @ThatOneHandsomeGamer
    @ThatOneHandsomeGamer 3 роки тому +3

    Thank you Jessie Pinkman

  • @sunimaliattanayake308
    @sunimaliattanayake308 5 місяців тому +1

    I am forever grateful for these video tutorials. Thank you

    • @sunimaliattanayake308
      @sunimaliattanayake308 4 місяці тому

      Hi @EdjeElectronics ! I have followed your tutorials for a project of mine. I have encountered some errors. Can you help me. I have followed you on twitter.

  • @ei23de
    @ei23de 3 роки тому

    Many thanks for this! I could use some of this in my diy smart home!
    Subscribed!

  • @parthk2317
    @parthk2317 4 роки тому +5

    It will be really useful to know How can you toggle GPIO when certain object is detected? Thanks.

  • @kaspey337
    @kaspey337 4 роки тому +3

    Yeah it works, pretty cool

  • @villagegreenpreservation7821
    @villagegreenpreservation7821 4 роки тому +1

    This was my first click researching a project and I live on one of the cross streets shown in the beginning of the video. So random! Helpful video too.

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому +1

      Nice! Feel free to say hi if you ever see me in Bozeman :)

  • @TT-so3hd
    @TT-so3hd Рік тому +2

    This was a great tutorial, thank you!

  • @itsmeintorrespain2714
    @itsmeintorrespain2714 4 роки тому +4

    I followed the recommendation, below in the comments, to install tensorflow 1.14 after running the requirements script. Everything works and my Pi4 4GB is giving about 5fps with the google sample.

  • @ryanford9310
    @ryanford9310 3 роки тому +3

    can u do this on an old pc or laptop aswell? and can you accelerate this process with a graphics card? @Edje Electronics

  • @spherebotics
    @spherebotics 4 роки тому

    Thanks, this is exactly what i needed to get started with TensorFlow

  • @qazxali
    @qazxali 4 роки тому

    this is the best tutorial ive seen on youtube, thank you so much !

  • @garrettkajmowicz
    @garrettkajmowicz 4 роки тому +3

    Is there a way to do text detection/capture? For example, reading street signs?

  • @syedumaidahmed6295
    @syedumaidahmed6295 4 роки тому +3

    Can I ask that can we train our own model on Tensorflow Lite ?
    As I have followed your previous tutorial for training my own model on Pi 3. It was good but in slow speed

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому

      Here's my GitHub guide showing how to train your own TensorFlow Lite detection model! github.com/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi

  • @MaciejStachowiak
    @MaciejStachowiak 3 роки тому +1

    I am recreating your turtorial this week!

  • @DashcamDriversGermany
    @DashcamDriversGermany 3 роки тому +2

    Nice video! Is there a way to let this detect numberplates from a video or pictures and pixelate them?

    • @weslyvanbaarsen666
      @weslyvanbaarsen666 3 роки тому

      yeah ofc

    • @DashcamDriversGermany
      @DashcamDriversGermany 3 роки тому

      @@weslyvanbaarsen666 you know how? I'm not programming a lot and I don't know how rn

    • @weslyvanbaarsen666
      @weslyvanbaarsen666 3 роки тому +2

      @@DashcamDriversGermany well you would use the tf api to actuate on by applying a pixel effect on the detected object region

  • @thanaponthanasakonpong1563
    @thanaponthanasakonpong1563 4 роки тому +4

    Hi ! I'm run tflite on Raspberry Pi 3 B+. Why i get 0.6-0.9 fps? Can you help me for more fps?

  • @devdylan6152
    @devdylan6152 3 роки тому +3

    great instructions! I use the pi4 on 64bit mode, idk if that is related or not, but, I did have a issue with the version of opencv not being installed, this was resolved by :
    pip install --upgrade pip
    pip install opencv-python
    just posting this if anyone else gets that this should do the trick for no matching distribution

  • @gabrielgraf2521
    @gabrielgraf2521 Рік тому +2

    What an amazing tutorial, thanks man👌🏻👍🏻

  • @rushbigmoney
    @rushbigmoney 4 роки тому +1

    Nice Job! Had a issue reviewed the comments reinstalled Raspbian, followed the video all working, thanks for sharing

  • @ismaelmendoza1235
    @ismaelmendoza1235 3 роки тому +4

    Hi, nice video, is it possible that when detecting a bird, turn on an LED light or send a pulse?

    • @Darth_Pig
      @Darth_Pig 3 роки тому +3

      I have a similar project, Pi will automatically track down the object e.g. Raccoon or human for my project(you can train your own model use OpenCV), and "fire" laser on the target and sound the alarm.
      My project is based on this: www.pyimagesearch.com/2019/04/01/pan-tilt-face-tracking-with-a-raspberry-pi-and-opencv/

  • @marcoagatino3071
    @marcoagatino3071 2 роки тому +1

    Really the best guide i found . Thank you

  • @alexanderreznik1700
    @alexanderreznik1700 2 роки тому

    Wow! The best guide for TensorFlow Object Detection! Thank you sir!

  • @felixalbert8098
    @felixalbert8098 4 роки тому +4

    Can I download you're bird squirrel and racoon model anywhere?

  • @lad7534
    @lad7534 3 роки тому +3

    Could it be done in ubuntu mate? I have a rock64 and im curious if it gam be done on a raspberry like board

    • @Klffsj
      @Klffsj 3 роки тому

      Yeah, it should work there. Raspbian and Ubuntu are both based on Debian after all. And, I'd be surprised if your PC doesn't hold up to a Raspberry Pi. All the steps should be the same.

  • @YarikSychov
    @YarikSychov 3 роки тому

    Thanks for the video, very detailed and easy to follow.

  • @IntegritySecurity
    @IntegritySecurity 4 роки тому

    Thanks for doing this man! Really great stuff.

  • @nurulsyazamohdasri543
    @nurulsyazamohdasri543 4 роки тому +3

    hi can I know how to write if labels= person it will rotate the motor and if not it will continue running ?

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому

      Hello, please watch my Pet Detector video. It explains how the variables work and gives an example of how to trigger actions if certain objects are detected. Good luck! ua-cam.com/video/gGqVNuYol6o/v-deo.html

  • @systemcheater9071
    @systemcheater9071 4 роки тому +3

    Works in the pi zero ?

  • @redmanhurricanes
    @redmanhurricanes 4 роки тому +1

    You the real MVP keep making content!

  • @EdwinHwuHacks4Science
    @EdwinHwuHacks4Science 3 роки тому +1

    Great tutorial! Thank you ultra much!

  • @barsgecgil3437
    @barsgecgil3437 3 роки тому +7

    Me and my team tried using a diffrent software and a pi 3 for object detection and it was hell. we only got results every 8 seconds and this was on a moving drone ship so by the time it detected what it had to it was already miles away lol. The detection speed in this is amazing.

    • @BinkiklouGaminglol
      @BinkiklouGaminglol 3 роки тому

      How big was the drone ship

    • @barsgecgil3437
      @barsgecgil3437 3 роки тому +1

      @@BinkiklouGaminglol well we had its 6 motors and sensors (mainly a bunch of MZ80s)running on a arduino mega and we had a pi3 with a pi camera on top) The physical dimensions are If I remmember correctly (it was some time ago so probably these might be off) İt was round 50 ish cm (how long it was) 30-40cm in height and again 30-40 cm in with. Why did you ask ? :D

    • @BinkiklouGaminglol
      @BinkiklouGaminglol 3 роки тому

      @@barsgecgil3437 wait what's a drone ship

    • @barsgecgil3437
      @barsgecgil3437 3 роки тому +1

      @@BinkiklouGaminglol An autonomous ship. In this case, we built it for a competition and the goal was that our "bigger" ship would be placed in a pool in which there were other "smaller ships" the smaller ships were red and green and you had to somehow capture the green ones and take them to a different part of the pool. I don't know if they have any English resources but you can search "Fetih1453 TeknoFest" that's the name of the competition. It would make more sense if you just looked at that :D

    • @BinkiklouGaminglol
      @BinkiklouGaminglol 3 роки тому +1

      @@barsgecgil3437 Oh nice, this is kinda like FRC robots but on water, and the participants are a little bit older.

  • @EdjeElectronics
    @EdjeElectronics  Рік тому +7

    I created a Google Colab notebook for making your own TensorFlow Lite model with custom data! You can train, convert, and export a TFLite SSD-MobileNet model (or EfficientDet), and then download it to your Raspberry Pi and use as shown in this video. I'm still working on the video that walks through the Colab notebook, but please try it out if you're interested!
    colab.research.google.com/github/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/Train_TFLite2_Object_Detction_Model.ipynb

    • @casualjay7428
      @casualjay7428 Рік тому +1

      You are a lifesaver, thank you!

    • @EdjeElectronics
      @EdjeElectronics  Рік тому +1

      You're very welcome! Were you successfully able to train a model with the Colab notebook? It hasn't been tested by many other users yet, so I'm curious to hear if you ran in to any errors or issues.

    • @casualjay7428
      @casualjay7428 Рік тому +1

      @@EdjeElectronics Well I wanted to train a clothes classifier using FASHION-MNIST, so I'm still in the process of figuring out how to change that dataset to fit the colab notebook.
      In short, not succeeded yet, but haven't had the time to properly test it, so fingers crossed!

    • @EdjeElectronics
      @EdjeElectronics  Рік тому +1

      @@casualjay7428 Oh! Actually, my guide won't work for that 🙁. My guide is for "object detection" models, while the FASHION-MNIST dataset is used to train "image classification" models. Here's a good guide from TensorFlow on training a basic classifier on the FASHION-MNIST dataset. www.tensorflow.org/tutorials/keras/classification

    • @casualjay7428
      @casualjay7428 Рік тому

      @@EdjeElectronics Oh I see! Thank you! I'm learning a lot so I still see this as a win!

  • @Vietnamcamping89
    @Vietnamcamping89 2 місяці тому +1

    This is a awesome tip bro
    Thank you
    I need to deep dive a little bit to make is work :)

  • @hakimke2
    @hakimke2 4 роки тому +1

    I really love your channel. I will also credit your Github repo in my project submission.
    Keep up the awesome work

  • @Amalokch
    @Amalokch 3 роки тому +4

    I am new on this and perhaps this is a silly question:
    I am running a headless rpi connecting via ssh, I've done everything on this tutorial except the last part where I've to execute the python code. But when I run it "python3 TFLite_detection_webcam.py --modeldir=Sample_TFLite_model"
    I got this message:
    ": cannot connect to X server"
    anyone has faced the same issue? is it correct run the python code over ssh? if not, do I need the raspberry desktop version instead?
    Thanks in advance!

    • @EdjeElectronics
      @EdjeElectronics  3 роки тому +3

      Unfortunately, it doesn't work with a headless RPi connected over SSH. The "X server" error message occurs because it's trying to display an image to the screen, but there is no screen. You'll have to either use a desktop version, or modify the code so it just saves image files instead of trying to display them.
      Nice cat picture btw 😺

    • @Amalokch
      @Amalokch 3 роки тому

      @@EdjeElectronics Many many thanks mate, now I get it, I also did some research in blogs and they pointed out to the same.
      About my profile pic, long live cat lovers 🐈 haha 👍🏻
      Cheers!

  • @aayogyadav
    @aayogyadav 4 роки тому +3

    hey, thanks for the video it really helped me a lot.
    but i have a question , how can i detect from any website like from url of youtube .
    please help me i have to complete my project and i am confused ..........
    and again thanks for the video.

  • @arifmunandar7280
    @arifmunandar7280 4 роки тому +2

    wow... i love this one... Thank you so much!

  • @gregoryM101
    @gregoryM101 4 роки тому +1

    Thank you! I really appreciate your efforts in clearing up how to get this working. So far things are working great after your set up instructions. I will be trying to set up some custom objects to detect and passing the locations via I2C to an Arduino. I'm looking forward to trying it with the USB Coral unit soon.

    • @mtheory1999
      @mtheory1999 4 роки тому

      Gregory Mazza hey Gregory, curious to know what kind of objects you are trying to detect. I’m working on my own algorithms and was wondering if you’d like to share information, thanks. My email is jatinderm19@gmail.com.

  • @AdrianFried
    @AdrianFried Рік тому +2

    How was your setup right at the beginning of the video in the car? How do you recorded the screen? what type of connection do you used to connect to the pi?
    thanks for the cool tutorial!

    • @EdjeElectronics
      @EdjeElectronics  Рік тому

      I had my Pi plugged into a monitor and recorded the screen using this HDMI recorder: www.amazon.com/gp/product/B00KMTYPXC . Looks like it's no longer available on Amazon, but you should be able to find something similar!

    • @AdrianFried
      @AdrianFried Рік тому

      @@EdjeElectronics Thanks!

  • @chanakanoearsakul8510
    @chanakanoearsakul8510 4 роки тому +5

    Hi Edje I have a problem about line 122 Traceback (most recent call last):
    File "TFLite_detection_webcam.py", line 122, in
    with open(PATH_TO_LABELS, 'r') as f:
    FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/tflitel/Sample_TFLite_model/labelmap.txt'

    • @lennderman5905
      @lennderman5905 4 роки тому +1

      Had the same problem, I just created the /home/pi/tflite1/Sample_TFLite_model/ folder and moved the labelmap.txt and detect.tflite from the tflite1 folder into it!

  • @martinh9099
    @martinh9099 3 роки тому

    Thanks so much for this! Far better than the google documentation which I found to be as clear as mud

  • @RPG_ash
    @RPG_ash 3 роки тому

    Wicked. Love the cat bit at the end.

  • @umairkamran8705
    @umairkamran8705 4 роки тому +5

    Can we use this to make smart traffic light differentiating between a normal vehicle and an emergency vehicle such as an ambulance? Can you make a video to demonstrate or help me out through any link. I will be obliged.

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому +1

      Yes you can, that would be a cool project! I don't have time to help, but check out my Pet Detector video, that might give you some ideas for how to control a program based on what is detected. ua-cam.com/video/gGqVNuYol6o/v-deo.html

  • @gugasevero76
    @gugasevero76 3 роки тому +3

    Man! It's awesome! Can i use my model i trained in teachable machine site? Since now, thank you.

    • @EdjeElectronics
      @EdjeElectronics  3 роки тому +2

      Thanks! Teachable Machine creates an "image classification" model rather than an "object detection" model. This video only works for object detection models. You can look at this GitHub page to see how to set up an image classification model on the Pi! github.com/tensorflow/examples/tree/master/lite/examples/image_classification/raspberry_pi

    • @gugasevero76
      @gugasevero76 3 роки тому

      @@EdjeElectronics actually i'm trying to run model for object detection i have trained there, Teachable Machine. I took model.unquanted.tflite, model.tflite and label.txt. And now i'm not getting to run my model in my Android device. I put the three files in assets folder but when i running the app nothing happen. After the android app works fine, i want to run in my raspberry pi.

  • @qazx71
    @qazx71 3 роки тому +1

    Wonderful tutorial, thank you!

  • @wen-chichang7399
    @wen-chichang7399 4 роки тому +1

    Great tutorial video for me! thank you very much for making this video.

  • @ryamoo
    @ryamoo 4 роки тому +5

    Is this something that would benefit being on a cluster? One Pi for the camera, one Pi for the processing?
    I don't know anything about tensor flow or Pi clusters, just curious.

    • @DieBastler1234
      @DieBastler1234 4 роки тому +1

      Reading in a frame from a USB camera vs reading it in from another Pi isn't really a difference in performance.
      But other processing steps after the detection might be heavy enough to benefit from multiple Raspberries.

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому +2

      Good question! No, I don't think a cluster would help for this. The main chunk of processing occurs when passing the image through the neural network to find the detected objects, and there isn't any (easy) way to split that between multiple Pis. And couka is correct that using a separate Pi to handle the camera wouldn't really help. I already have the camera running in a separate thread to speed things up (see www.pyimagesearch.com/2015/12/28/increasing-raspberry-pi-fps-with-python-and-opencv/ )

  • @carrotzombi
    @carrotzombi 4 роки тому +3

    Im looking to export label names as they come in / recognized by the pi. Does anyone happen to know where that string variable is? "for context, as a current student project, I am looking to pass this name on to another micro controller for a project I have been working. And now that i can "kind of" train a model, i would like to find this variable before moving forward" any and all help would be much appreciated.

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому +2

      The label names are held in the "object_name" variable. If you add "print(object_name)" line after line 183 in TFLite_detection_webcam.py , it will print the name of every detected object on every frame.

    • @carrotzombi
      @carrotzombi 4 роки тому +2

      @@EdjeElectronics Thank you so much for responding This genuinely helps a ton.

  • @Daniel-wi7ul
    @Daniel-wi7ul 4 роки тому +1

    Really helpful, thank you so much!

  • @santiagogonzalezcoladogarc7519
    @santiagogonzalezcoladogarc7519 4 роки тому +1

    great tutorial!!!!!, keep up with the great content

  • @ranahassankhalid6399
    @ranahassankhalid6399 2 роки тому +3

    can i adjust the code to detect only 1 specific class like a person?

  • @RAGNES7
    @RAGNES7 4 роки тому +3

    9:50 I'll be waiting

  • @christianegana4443
    @christianegana4443 4 роки тому

    Excellent tutorial!! worked great for me!! thank you!!!

  • @nekojoy7811
    @nekojoy7811 4 роки тому +2

    Thanks for this amazing Video :)

  • @genadimanoilenko1466
    @genadimanoilenko1466 2 роки тому +3

    Hello Evan! thank you very much for your tutorial, it was a great pleaser to learn from you. Hope you will do more projects like that!
    I successfully repeated your project with my custom model for one month ago (I got my model from google cloud). Yesterday I built another model with different dataset and got some trouble with implementation. The error says next:
    ValueError: Op builtin_code out of range: 130. Are you using old TFLite binary with newer model?
    I found out they updated their conversion with TensorFlow 2.5 runtime. I guess this is the problem, may be you know how to fix it?

    • @genadimanoilenko1466
      @genadimanoilenko1466 2 роки тому +1

      I tried update manually tflite-runtime package, but it did not help

    • @EdjeElectronics
      @EdjeElectronics  2 роки тому

      @@genadimanoilenko1466 Thanks, I'm glad the tutorial has been helpful! Hmm, if you updated tflite-runtime and you're still getting that error, then I'm not sure what the problem is. Can you check the version of tflite-runtime you're using on the Pi and the version of TensorFlow that you used for building your model? You should be able to use this to check the tflite-runtime version:
      import tflite_runtime
      tflite_runtime.__version__

    • @genadimanoilenko1466
      @genadimanoilenko1466 2 роки тому

      @@EdjeElectronics thank you very much for your response.
      The version of tflite_runtime on raspberry pi is 2.5.0
      and Google cloud uses TensorFlow 2.5.x (latest patch)
      cloud.google.com/ai-platform/training/docs/runtime-version-list
      package list

  • @BunillaCircus
    @BunillaCircus Рік тому +4

    github keeps asking me to login when I try to download the packages and it keep rejecting it. what should I do?

    • @Bit930
      @Bit930 Рік тому +1

      I am having the same issue.

    • @SchoolforHackers
      @SchoolforHackers 9 місяців тому

      Check the link you’re using. A git:// url requires a login, an url doesn’t.

  • @gavinknight8560
    @gavinknight8560 4 роки тому +1

    This is an excellent tutorial, thanks!

    • @simeonmarkoski278
      @simeonmarkoski278 4 роки тому

      Can you please tell me why my camera window is not showing? for webcam

  • @diggleboy
    @diggleboy 4 роки тому +2

    Clear. Concise. To the point. Great video! Looking forward to more.
    Liked. Subbed. Smashed the bell (HARD!)

  • @russelpamintuan4419
    @russelpamintuan4419 4 роки тому +6

    Can someone help? Im trying to control a servo motor once TF detected a specific object. Thank you

    • @arksindustry2171
      @arksindustry2171 4 роки тому

      Sorry i dont know that

    • @parthk2317
      @parthk2317 4 роки тому +1

      Anybody figured how to toggle GPIO in real time when XYZ object detected.

    • @pietrolungaro6411
      @pietrolungaro6411 4 роки тому

      Are you planning to use MQTT to start/stop the motor? That will work.

  • @stefanm2059
    @stefanm2059 4 роки тому +3

    Hi, the tutorial is relly great, but is there an option to access the raspberry gpio`s?
    Can somebody help me please. I am under a little time pressure.

    • @stefanm2059
      @stefanm2059 4 роки тому +2

      Ok i found a solution.
      Activate the virtual enviroment
      =>
      cd tflite1/
      source tflite1-env/bin/activate
      pip list #shows all installed packages
      pip install rpi.gpio

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому

      @@stefanm2059 Thanks for sharing your solution! 😃

  • @user-wp5cg8nc5s
    @user-wp5cg8nc5s 4 роки тому +2

    You are the great man. I'm computer science teacher from Thailand.

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому +1

      Thank you!! I hope this video can help your students 😃

  • @adityajawla723
    @adityajawla723 2 роки тому +1

    I love the content and thanks for it. One more subscriber added to the list🙌🏻 for future content .

  • @mohamedghezaiel5235
    @mohamedghezaiel5235 4 роки тому +3

    thank you for the video
    but i had this error when trying to open the pi camera
    VIDEOIO ERROR: V4L: can't open camera by index 0
    Traceback (most recent call last):
    File "TFLite_detection_webcam.py", line 171, in
    frame = frame1.copy()
    AttributeError: 'NoneType' object has no attribute 'copy'
    can you help me with this

    • @ZEDketa
      @ZEDketa 4 роки тому +2

      I don't know but I sometimes have this problem after 1 to 2 hours of use ...
      For me it would come from my camera ...

    • @sribharathsajja5736
      @sribharathsajja5736 4 роки тому

      @@ZEDketa you need to change index from 0 to -1 in line 32 and need to modify the code to
      frame1 = videostream.read()
      if frame1 is None:
      break
      frame = frame1.copy()
      in line 171
      in TFLite_detection_webcam.py

    • @darkgcn14
      @darkgcn14 2 роки тому

      @@sribharathsajja5736 any chance you have another solution to this problem, I've googled this and feel like I've tried everything. This fix didn't work either

  • @charleskentucky6323
    @charleskentucky6323 4 роки тому +3

    Hi, Edje thanks for the tutorial, the object detection works or certainly looks perfectly fine to me but after I run it, at first it says :
    ' HadoopFileSystem load error: libhfds.so: cannot open shared object file: No such file or directory '
    Could you please help me solve this issue :)

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому +1

      A few people have gotten this error! I haven't had time to look in to it yet. Can you tell me which Raspbian OS you are using? Buster or Stretch?

    • @charleskentucky6323
      @charleskentucky6323 4 роки тому

      Edje Electronics Buster, 4.19

    • @riccardoesclapon549
      @riccardoesclapon549 4 роки тому +1

      @@EdjeElectronics I am also getting this same error on Raspbian GNU/Linux 10 (buster)

    • @colbyhawker2659
      @colbyhawker2659 4 роки тому +1

      I'm also getting this error on Buster. Any straight-foward solution yet?

  • @fgc-technology51
    @fgc-technology51 2 роки тому

    Thank you so much, this is very informative!

  • @michaelgolan73
    @michaelgolan73 4 роки тому

    Excellent tutorial!! many thanks

  • @japerelectronics2568
    @japerelectronics2568 4 роки тому +3

    I did this 2 years ago and it was an nightmare. It was still fairly new and you had to find patches for the patches. You made this ridiculously simple.

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому +1

      Thanks! It's a pain staying on top of all the version changes. I did my best to make this one easy to follow and future-proof to new versions!

  • @Satish_Lakhan29
    @Satish_Lakhan29 2 роки тому +3

    I want to glow led when car detected what will be changes?

    • @keshavharipersad2024
      @keshavharipersad2024 2 роки тому

      just configure single class object detection and when a car is detected then : glow led for .. sec

    • @Satish_Lakhan29
      @Satish_Lakhan29 2 роки тому

      @@keshavharipersad2024 can u provide me code where can I put these..I train my custom object detection module with tf lite ...i want to glow led when my custom object detect

    • @keshavharipersad2024
      @keshavharipersad2024 2 роки тому +2

      @@Satish_Lakhan29 yeah.. i was working on it for u.. it really is hard to do... i could not find a solution so far

    • @justawhite
      @justawhite 2 роки тому +1

      Arduino. Modify the script to send a trigger via serial to the arduino and trigger a function in the arduino.

  • @Superteastain
    @Superteastain 2 роки тому +1

    Really good. Really clear.

  • @richardjames26
    @richardjames26 4 роки тому +1

    Great Tutorial.. also works well on the Jetson Nano

  • @questionablecommands9423
    @questionablecommands9423 4 роки тому +4

    0:02 Hotel Baxter?! HOLY SHIT! It's my home town of Bozeman!

    • @EdjeElectronics
      @EdjeElectronics  4 роки тому +2

      Haha yep!! I'm from Great Falls originally but living in Bozeman now. It's a great place to live! Check out my Raspberry Pi 3 vs Raspberry Pi 4 video, it's mostly footage of me driving around Bozeman :) ua-cam.com/video/TiOKvOrYNII/v-deo.html

  • @shubhankardeshpande2459
    @shubhankardeshpande2459 4 роки тому +3

    For those having the following error:
    (tflite1-env) pi@raspberrypi:~/tflite1 $ python3 TFLite_detection_webcam.py --modeldir=Sample_TfLite_model
    Traceback (most recent call last):
    File "TFLite_detection_webcam.py", line 122, in
    with open(PATH_TO_LABELS, 'r') as f:
    FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/tflite1/Sample_TfLite_model/labelmap.txt'
    Remember that the model files have been unzipped in Sample_TFLite_model and not Sample_TfLite_model or Sample_Tflite_model for that matter. Just make sure that you type *TFLite* correctly, and you're good to go.