Raspberry Pi Pet Detector Camera Using Python, TensorFlow, and Twilio

  Рет қаралды 91,279

Edje Electronics

Edje Electronics

Күн бұрын

Пікірлер: 220
@RarePupper
@RarePupper 5 жыл бұрын
I'm imagining a horror story where you are sitting on your couch with your dog and your cat and suddenly you receive a text that your pet wants inside.
@mattizzle81
@mattizzle81 4 жыл бұрын
Hah! This is one of the cooler more interesting/practical ideas for object detection that I've seen.
@antonzolotov9738
@antonzolotov9738 5 жыл бұрын
Great video! Many technical videos are unnecessarily long, and this one was just the right length!
@zainahmed6502
@zainahmed6502 3 жыл бұрын
Thank you for making this. I wanted my final project for a class to be a human detector in empty room, this will help a lot. Thanks!
@racar7211
@racar7211 3 жыл бұрын
hi, me and my friend are doing a project too where the system counts the people going in and out. Could you help us? Sincerely yours Sven and Sascha
@zainahmed6502
@zainahmed6502 3 жыл бұрын
@@racar7211 So I kind of ended up doing it a little differently. For some reason I could not get TensorFlow to run on my Pi. I tried for hours and hours, even restarting from scratch about 4 times, but it didn't work. The error I kept getting had to do with the Pi camera and TensorFlow. I believe TensorFlow could not access the live video feed from Pi camera properly. Instead of using TensorFlow, I used OpenCV library and simply detected motion through the camera by taking consecutive pics and comparing them. If motion is detected, camera alerts the user via text and sends them a picture of the motion. I can email you the specific details. Hope that helps.
@ayeegabbay
@ayeegabbay 3 жыл бұрын
@@zainahmed6502 Hi, I was wondering if you could email me the details of this project? I'm trying to detect humans in an empty room as well and would love to see your code on how you went about this.
@zainahmed6502
@zainahmed6502 3 жыл бұрын
@@ayeegabbay Sure, would love to help. Email me: thezainahmed98@gmail.com
@selenaycakc9584
@selenaycakc9584 3 жыл бұрын
@@zainahmed6502 . I want to ask you a little question. Sometimes identifies a 50% different object as my library cat. I want my cat to accept values above 75% in the tensorflow library. Is something like this possible? My programming knowledge is very poor, how should I add / change the code? I would be glad if you help me. Thank you so much.
@julienpierre9041
@julienpierre9041 4 жыл бұрын
Really cool. I will be trying for my raccoon detection project.
@milanscienceacc3041
@milanscienceacc3041 3 жыл бұрын
😂😂😂
@markt9933
@markt9933 5 жыл бұрын
Thank you for creating these great videos. I am new to all this, but have now implemented a security camera and your code was just perfect and got me 98% in the right direction. I took out some parts of code after learning by trial and error exactly how your python script worked (lots of testing on the cats at first in fact!). I added a second confidence trigger by reading all detected items into an array and simply looked for the coco text descriptions with a specific score threshold and list them to another terminal window. I found that at lower scores the frame drawing was slowing down a bit the PI, and the text listing helped the testing as well. So essentially I decoupled the trigger at which frames are drawn and the detection trigger takes place. I also found the coco v1 ppn 300x300 model from the zoo seemed to work better. After adding GPIO for a test trigger LED, an IFFFT trigger and a trigger to my Pushover alerts account and a trigger to announce an spoken alarm on my Sonos, I have mounted it outside and it seems to be working really well at about 1.3 FPS average. I had to tweak out some background noise once it was positioned (a plant stand it occasionally thinks is human! ) by setting the confidence trigger to 70% and I also added a time limit for getting a set of frames with a positive hit. Once again, very many thanks for sharing your expert knowledge! No way could I have done this otherwise. I also need to now thank Jishi for his excellent Sonos API code which I have sitting on a separate PI.
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
You're welcome, that sounds like a fun project! Glad you got it working. Very cool that you incorporated an alarm trigger with the Pi GPIOs.
@amrmzkr
@amrmzkr 4 жыл бұрын
This is so useful for my final year project. thank you sir!
@Tekergul
@Tekergul 5 жыл бұрын
Hi, thats amazing i never see case recognition before. that is what Object recognition evolution like
@santaoct
@santaoct 5 жыл бұрын
Thank you so much for this tutorial, I got the coral accelerator and was planning to use it to monitor my dog, this tutorial is great will post when I succeed
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Yes please do let me know if you get the Coral working! I'm planning to release a video soon showing how to use it with the Pi.
@josephlalicata9013
@josephlalicata9013 5 жыл бұрын
The level of detail provided in this tutorial is awesome, thank you! I was able to get my Pi up and running. I tweaked the code to play an audible sound when my pet was inside a border. This works great within 6 feet. But at 10-12 feet, my pet is not detectable (but a person being much larger can still be sensed). I tried a bunch of things to improve sensitivity (manually adjust focus on lens, increased resolution, etc), but still not good enough. Would you have a recommendation for a camera with greater range (trying to keep the camera form-factor the same)? Thanks again, great job!
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Hello and thanks! It's cool that you're tweaking the script and testing it in different scenarios. You're right, it won't work at long distances, especially with the Picamera. This TensorFlow model already has a hard time accurately recognizing a cat/dog, and the smaller the pet gets in the image, the less accurate it will be. Check out the OpenMV camera ( openmv.io/ ). I haven't used it before, and I'm not sure how to get it working with the Pi, but it has optical zoom capabilities and good picture quality. On the software side, you could try training your own detection model specifically for detecting pets. If you feed it enough images (maybe 300-500), you can probably get better accuracy out of it than the default MobileNet model. If you train it with images where the pet is small in the picture (i.e. at the size it would be at a distance of 10-12ft), it may detect pets better at that range. I have another video that shows how to train your own detection model: kzbin.info/www/bejne/iJjTl55smr6rgKM . Good luck with your work!
@josephlalicata9013
@josephlalicata9013 5 жыл бұрын
Thanks for your response! I just checked out the OpenMV. Wow! That product looks purpose-built for machine vision applications. Since I’ve already got Pi, I will try learning a new model based on your suggestions. Thanks for the link and keep up the good work!
@Stelios.Posantzis
@Stelios.Posantzis 3 жыл бұрын
Great stuff. Potentially such systems can be fitted to cars in the future in order to avoid running over stray animals or kids in cities or all kinds of wildlife on the motorways.
@EdjeElectronics
@EdjeElectronics 3 жыл бұрын
Thanks! Yep, there's a ton of applications for this technology. I'll eventually be making a video of my "do-it-yourself blind spot monitor" project for my car. It's not animal-related, but uses a machine learning object detection model. It lights up an LED when it detects that there's another car in your blind spot (for both sides of the car). I'm pretty terrible about checking my blind spots :)
@Stelios.Posantzis
@Stelios.Posantzis 3 жыл бұрын
@@EdjeElectronics Blind spots is one area where another vehicle, person, cat etc. could be hidden from view. Another area is that in front of a parked car on a junction corner as we're approaching it. Some drivers choose to cross a junction even when a parked car or other obstacle obstructs their view of oncoming traffic in the crossed street. A camera, however, would have to be mounted at some distance in front of the car on some kind of protruding element - I'm not sure whether that is allowed at all in any country.
@ogunniransiji2686
@ogunniransiji2686 3 жыл бұрын
@@EdjeElectronics Hello, I will really need to see this. Can I be notified when it is available
@SciHeartJourney
@SciHeartJourney 3 жыл бұрын
Twilio gives you a starter balance of $15. Each text cost about $0.015, so you get about a thousand texts for free. At this rate, if you don't text very often, it looks very cost effective.
@gorudonu
@gorudonu 5 жыл бұрын
Cool project! Would be even better to have mobile app with notifications and sending actual image of your pet 😉
@IqweoR
@IqweoR 5 жыл бұрын
gorudonu that’s easily reachable if you switch from twilio to telegram bot api, which can send photos
@ak20ak20
@ak20ak20 4 жыл бұрын
can i run this on tensorflow lite? Do i need to make changes in pet_detector.py file?
@muhammadyoga3985
@muhammadyoga3985 Жыл бұрын
you can try bro ?
@annahy7491
@annahy7491 4 жыл бұрын
If you keep the pi on all day to see if your pet needs to go outside, has the device had any problems while running for extended periods of time?
@EdjeElectronics
@EdjeElectronics 4 жыл бұрын
If it doesn't have a fan and a heatsink, the Pi will overheat and freeze up after running the program for about 10 minutes. Beyond that, I've ran the program for about 30 minutes straight with no problems. I haven't tried running it for longer than that! (This project was just a functionality demo 😺)
@Airbag888
@Airbag888 4 жыл бұрын
my rpi4 gets to 85C (ambiant 30C) and throttles making my fps go from ~4 to around ~1-2fps . It may fry itself eventually. I also have no cooling on it so I'll look at that next. I feel like pausing the detection for 5 seconds every 12 secs could help slightly
@cowmix
@cowmix 5 жыл бұрын
I, too, need to be more responsive to my pets. thx for this video!
@OldKing2
@OldKing2 2 жыл бұрын
I love this, but also consider a pet door. That way if the pet is outside and you (human) become incapacitated, the pet can still come back inside and eat your face. :)
@DavidHodges47
@DavidHodges47 5 жыл бұрын
Great video! Thanks for the very clear explanation of how you did this. One question though: Where did you get that white case for the Raspberry Pi with a holder for the video camera? Did you 3D print it, or is it an off-the-shelf item one can buy online?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Thank you! It's an off-the-shelf part. Allow me to happily direct you to my Amazon Associates link for the Picamera case 😃. amzn.to/2LxaUed
@trixond9211
@trixond9211 5 жыл бұрын
Hi is it possible that if the model can detect an object for example if it detects a cat it will trigger the pi's gpio pin such as turning on an led or etc?
@harrywilshere4989
@harrywilshere4989 5 жыл бұрын
I have the same question, hopefully someone knows the answer
@harrywilshere4989
@harrywilshere4989 5 жыл бұрын
he indirectly tells how around time 3:30. use the ID of the class you want and a if statement like he does, then write regular output statement to send it to the GPIO. I literally just did it!
@trixond9211
@trixond9211 5 жыл бұрын
@@harrywilshere4989 woooowww thanks bro I finally got it, it is working 😊
@shirazushsalekinchowdhury8291
@shirazushsalekinchowdhury8291 5 жыл бұрын
@Trixon D Can you share your modified code?
@trixond9211
@trixond9211 5 жыл бұрын
@@shirazushsalekinchowdhury8291 just follow how the video get the id of the detected object using the if statement then under the if statement is your code for triggering the gpio, in my case , I just put a code to turn on and off the LED
@janekatsumi9927
@janekatsumi9927 5 жыл бұрын
I really like your videos, you are doing a great job, keep it up!
@sugarcubedealer7275
@sugarcubedealer7275 5 жыл бұрын
Fab video Edje! for a great project to get people started on TF. Lots of fun, well coded, and configured. I guess occasionally you have a grizzly bear visit your door??? or is it that sometimes the dog gets gets mistaken as a teddy bear, and so the program still counts this ;) btw, if it is a grizzly, doesn't it just let itself in :-?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Haha, well out here in Montana, sometimes we do get visits from grizzly bears! I will see if I can find the picture of a grizzly bear peering into the window at my uncle's house near Glacier National Park. However, I only included "teddy bear" so that I could test if it was working or not by holding a teddy bear inside the detection area. 🐻🐻🐻
@sugarcubedealer7275
@sugarcubedealer7275 5 жыл бұрын
@@EdjeElectronicsI understand now, although surely waving the cat in front of the camera (monty python style) would have worked instead :) . Montana sounds great! Looking into Tenserflow 2.0 (beta) a bit, and trying to get this setup on a pc, so far with issues. But also considering buying a Google Coral USB stick for the laptop and PI, are either of these things you'd be interesting in working on. I think tf 2.0 or the USB coral could make connecting up multiple IP cameras possible (h264) and therefore making a low powered laptop, or m-itx into a viable smart IP camera server, or a pi for 1 or 2 cameras running at high throughput (crica 0.1sec/frame), or robo mini car, at least that's what I'm trying to see the possibilities of. This ML setup looks better than the nvidia nano for the mobilenet models, and most PC's by a long shot which is great to see for extending the pi.
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
@@sugarcubedealer7275 lol these days that would get me thrown in jail! I actually just bought a Coral USB Accelerator and plan to make a video on how to use it with the Pi sometime next month. Stay tuned for that!
@anthonyhampton3561
@anthonyhampton3561 5 жыл бұрын
Amazing! Thank you so much for creating such a great video!!! Much Appreciated.
@R1M337
@R1M337 5 жыл бұрын
you could make a laser turret with object detection for cat that the laser run away from the cat if she try to catch. cam + raspberry 4? + 2 servos + laser + Python, TensorFlow.
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Haha yep that would be a fun project! It's definitely possible.
@R1M337
@R1M337 5 жыл бұрын
@@EdjeElectronics the only problem i see is the to low framerate from the pi. maybe better with Pixy2 - PixyCam / google coral usb
@roosboom
@roosboom 5 жыл бұрын
Great and clear tutorial!
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Thanks Niels!
@NesbyBone
@NesbyBone 4 жыл бұрын
Thanks for sharing this project! One question, it is possible to do the same with a camera night vision? Or we need to make son adjustment to the code? You know, sometimes they return home late at night.
@mike0rr
@mike0rr 2 жыл бұрын
Is there a reason you use TensorFlow and MobilNet rather than OpenCV? From what I can gather as a noob, is that TF suited for training, and CV is best for detection and I'm trying to better grasp when to use what exactly. I'm trying to detect cats in my house, but I don't really need to train a model since cat images have been pretty well trained on the internet. So I would be better off focusing more on OpenCV for this particular project of mine, right? Your videos have honestly been the biggest help on all of this for me. Just about able to jump into my first video detection project. Only watched each video about 10 times, but I think I understand now :P
@shreevlogs8853
@shreevlogs8853 5 жыл бұрын
How can I print out the detected objects on to the console? Please guide me on this! Thankyou for this amazing tutorial @Edje Electronics
@muhammadnouman5984
@muhammadnouman5984 5 жыл бұрын
I want to thank you for this tutorial your videos were very helping and informative .
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
You're welcome, I'm glad it was helpful!
@MrSiciro
@MrSiciro 5 жыл бұрын
Good day. Wow what an amazing series and exactly what I have been looking for. Just a question. Would if be possible to have a camera feed from a secondary raspberry pi and have the image fed in via UDP?
@achalasamapriya2701
@achalasamapriya2701 5 жыл бұрын
really enlightening .thanks for sharing
@gilshahar7
@gilshahar7 5 жыл бұрын
Amazing, wish my cat would like to go inside the house sometimes :( I'd totally replicate this.
@pawelpekala1585
@pawelpekala1585 5 жыл бұрын
Thank you very much for another amazing tutorial video. Have you ever tried to send data over CAN-Bus using python?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
You're welcome, I'm glad it was useful 😃. No, I'm not familiar with the CAN bus. Hope you can figure it out!
@WindyHillVineyard
@WindyHillVineyard 5 жыл бұрын
Thank you. Once we find out how to do it I will share with you.
@pawelpekala1585
@pawelpekala1585 5 жыл бұрын
Hi. As promised, I found helpful info on how to send CAN bus message over. Here is the link I used to get my code going python-can.readthedocs.io/en/3.0.0/
@jhosteny
@jhosteny 5 жыл бұрын
"Your pet wants outside!" You must be from Pittsburgh :)
@user-cm2on5uo6w
@user-cm2on5uo6w 5 жыл бұрын
can make a tutorial about adding audio feedback please i really need it
@frustrated3880
@frustrated3880 4 жыл бұрын
Hello! Instead of sending a text, can you program this to take a picture and send it to a webserver?
@senatlaramasu4730
@senatlaramasu4730 4 жыл бұрын
Hi, did you manage to do this?
@frustrated3880
@frustrated3880 4 жыл бұрын
Senatla Ramasu hey. Unfortunately, not exactly. I was only able to take interval-ed screenshots every 5 seconds or so, but not triggered upon detection
@brucefarley7495
@brucefarley7495 5 жыл бұрын
How could you get this to trigger power to turn something on when it sees my dog? Thinking electric dog door.
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Hi Bruce, you can modify the code to set one of the Raspberry Pi's GPIO pins HIGH (i.e. switch it from 0V to 3.3V) when it sees the dog. Here's a good tutorial on how to do that: raspi.tv/2013/rpi-gpio-basics-5-setting-up-and-using-outputs-with-rpi-gpio . You can then wire that pin to a 3.3V-compatible mechanical relay (like this one: www.digikey.com/product-detail/en/kemet/EC2-3NU/399-11042-5-ND/4291108 ), which in turn can power on a motor or something similar. I'm currently working on a project that does just that! :)
@brucefarley7495
@brucefarley7495 5 жыл бұрын
@@EdjeElectronics Great thanks! I was thinking of using a car window motor to open the dog door. www.carparts.com/details/Jeep/Liberty/Replacement/Window_Regulator/2006/65th_Anniversary_Edition/6_Cyl_3-dot-7/REPJ462910.html?TID=gglpla&origin=pla&gclid=Cj0KCQiAm5viBRD4ARIsADGUT25-MzW92MXBMesVim4qk9Sa7eD3ahOSq0giTvZo1Bo58QssYvoKNAAaAhIJEALw_wcB&gclsrc=aw.ds
@ClubedoMaker
@ClubedoMaker 5 жыл бұрын
Hi, nice video! Have u the image raspbian OS with all configuration complete this video for download?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Thanks! No I don't 😓 you can set it up by following the instructions in my other video: kzbin.info/www/bejne/pKG9XmuEn5aMrbs
@CT-if2tt
@CT-if2tt 4 жыл бұрын
Very clever. Good job!
@taurnilcelebrindal2745
@taurnilcelebrindal2745 4 жыл бұрын
Hello Great project, tahnk you so much for sharing ! I tried you Pet detector and I get an error: Line 26, in from picamera.array import PiRGBArray ModuleNotFoundError: No module named 'picamera' Can you help me ? i'm using TensorFlow Lite version Thank you Regards
@MilanRotovnik
@MilanRotovnik 4 жыл бұрын
i have the same problem please hint
@shourav52
@shourav52 3 жыл бұрын
pip install "picamera[array]" command is something like this
@muhammadyoga3985
@muhammadyoga3985 Жыл бұрын
you can fiks this bro ?
@notsofastph
@notsofastph 5 жыл бұрын
Hi. I tried using twilio but im using opencv instead of tensorflow. The simple code on twilio doesnt work when im on workon cv environment. Any solutions???
@objectdetection3252
@objectdetection3252 5 жыл бұрын
Great video. Please how can I add speech to this example? Like the model will say "cat wants out".
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Here's a good website on doing text-to-speech in Python: pythonprogramminglanguage.com/text-to-speech/ . You can add this text-to-speech code after the line of code where it sends my phone a text.
@pranavk1473
@pranavk1473 5 жыл бұрын
Quick question : how to get IM_Width and IM _height to extract the co-ordinates and further use it to apply hsv colour filtering . I build a model using your another tensorflow video , build on faster rcnn model , fit the detector to work well , now I want to extract its roi (bounding boxes ) and color filter in it . Please help me out ...I tried input your above code , but it shoots me with name error :im_width is not defined .
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Make sure you are using "IM_WIDTH" and "IM_HEIGHT" rather than "IM_Width" and "IM_height". The capital letters matter! Otherwise, this video explains how to find the bounding boxes that give you the ROI.
@dominic8570
@dominic8570 5 жыл бұрын
Hi. for the part of the code where you generate a dot on the centre of the object. How can I make it to that if it detects 2 or more objects it draws a dot on all bounding boxes? Because I noticed it only draws a dot on 1 object
@minhhoangle536
@minhhoangle536 5 жыл бұрын
Amazing. Im waiting for a long time. Ty bro
@zephirawt4997
@zephirawt4997 5 жыл бұрын
Cat has bespoken here..
@zerohour2751
@zerohour2751 4 жыл бұрын
Hi Sir can we record a video instead of sending message. thanks for your great videos
@user-ct5mb6hq4k
@user-ct5mb6hq4k 5 жыл бұрын
ValueError: NodeDef mentions attr 'Truncate' not in Op y:DstT; attr=SrcT:type; attr=DstT:type>; NodeDef: ToFloat_3 = Cast[DstT=DT_FLOAT, SrcT=DT_UINT8, Truncate=false](image_tensor). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.). help me please
@reynardnalla1375
@reynardnalla1375 5 жыл бұрын
Do i have to train with many classes so that it will not say that it detects the cat even if it does not? Coz i only trained with one class
@Airbag888
@Airbag888 4 жыл бұрын
Would it be possible to make some tutorials using raspbian-lite instead of desktop (in addition to the ones made using desktop)? Using desktop: it all works but there's some overhead due to running a full desktop in the background Using lite and even adding in xserver there's a lot of dependencies missing even after running the script at the beginning for versions and packages checking. I feel it could be a way to eek out some performance. Also can we limit the fps manually to hopefully keep the rpi cool? Final question using a coral does it properly offload processing such that the rpi cpu stays cool? Do you feel a rpi+coral combo would be usable 24/7 ?
@carrotzombi
@carrotzombi 4 жыл бұрын
I might not be able to answer all of your questions but, I have been working with edje's and sentdex's write ups(tutorials) for a school project this semester. If you are asking if you can just do the whole process on the raspberry pi? My answer is yes. I was able to setup the whole thing on the Pi to detect object, label/train. Admittedly, it was tensorflow 1.13.1 but it should be similar if not the same except for tensorflow lite in this case you have to build from source in edje's case he uses bazel to do so. This is so that you need to covert/optimize models from 32bit to 8 bit(this is where my knowledge is hairy). It also requires alot of swap memory even with the new Pi models, and will take a much longer time to train versus a desktop. In case you was wondering im useing the Rpi4 4 2GB + heaksink.
@Pavementhdngg
@Pavementhdngg 5 жыл бұрын
Pleasse make a full tutorial on this!!!
@siddhantsangal5298
@siddhantsangal5298 5 жыл бұрын
Is it possible to run the code on my laptop and use a raspberry pi zero for controlling the servo motors? I am trying to sort the playing cards into 4 baskets of the 4 suits. I have searched a lot on the internet, could not find much. Thanks for the video!
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
See my response to your question on Twitter buddy! 😃
@nguyenluu3082
@nguyenluu3082 4 жыл бұрын
Hi Edje, I’m following this methods but FPS on my Pi only 0.18 Fps. Does the Pi memory effect to real time tracking result? Best Regards
@EdjeElectronics
@EdjeElectronics 4 жыл бұрын
Dang, 0.18FPS is slow! Yes, the less RAM you have, the slower it will run. What model of Pi are you using?
@nguyenluu3082
@nguyenluu3082 4 жыл бұрын
The model is Pi 4B. I’ve thought because of the model fast r-cnn is hight accuracy but slow speed. I will try train by SSD mobilenet model. What about it?
@t-lm
@t-lm 5 жыл бұрын
Can you please make a version for IP camera stream?
@sparrowhawk2112
@sparrowhawk2112 4 жыл бұрын
is there any way to actuate mechanical door lock to lock and unlock to let pet inside and automatically closes door ? i mean when program detects an object, is there any way to power up an actuator(motor) via wired connection?
@danielmurphy6226
@danielmurphy6226 4 жыл бұрын
i'd look into using relays with the rpi. I've seen some people activate lamps using relays and rpis so i would guess that would work for you.
@mohamedosama4033
@mohamedosama4033 5 жыл бұрын
Hi, great video! but I am wondering if there is a way to export the coordinates of the detected object in a file? What about the time of detection if it is to be a video, can we get the time when the object was detected?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Here's a brief explanation of how to write values to files: www.w3schools.com/python/python_file_write.asp . You can do something like f.write(x), f.write(y) to write the x-y coordinates of the object. The time of detection is also doable. If you know the FPS (frames per second) of the video, you can increment a counter variable count the number of frames since the start of the video to determine how much time has elapsed. For instance, if the video runs at 30FPS, and you detect an object at frame 90, then the detection occurred 3 seconds into the video. Note: The Raspberry Pi processes video very slowly, so it will take a while!
@krizkyfitria
@krizkyfitria 4 жыл бұрын
Hi edje, did you used some method to detector and counter the pet?
@lesliemondalla2653
@lesliemondalla2653 5 жыл бұрын
Thank you for the video. Have you tried detecting plastic bottles with raspberry pi?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
You're welcome! The MobileNet-SSD model I used for this video can also detect bottles. You can see it correctly identifying a plastic bottle in the first few seconds of my other video: kzbin.info/www/bejne/pKG9XmuEn5aMrbs
@gonzothegreat1317
@gonzothegreat1317 3 жыл бұрын
This is awesome!
@maxrizzato
@maxrizzato Жыл бұрын
Can you please share where you did find the raspi case with tilting camera support?
@EdjeElectronics
@EdjeElectronics Жыл бұрын
Shoot, it looks like it's not available anymore. You'll have to search around for an alternative!
@ranjodhcheema
@ranjodhcheema 5 жыл бұрын
Do I need to change the numbers in box array if I want to detect more than one object in class array. If so, then how would I go about it?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Check out line 185 of Pet_detector.py . That line says "if a cat, dog, or teddy bear is detected: do this". You can add more classes to that line if you want to your script to react to more objects. Good luck! github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/blob/master/Pet_detector.py
@personnenul1820
@personnenul1820 4 жыл бұрын
Would the program work using tensorflowlite ?
@EdjeElectronics
@EdjeElectronics 4 жыл бұрын
Yes, but you'd have to modify the Pet_detector.py code quite a bit to make it work with TensorFlow Lite.
@kitsen13
@kitsen13 4 жыл бұрын
@@EdjeElectronics hello, can you help us to make this code working to tensorflow lite? (It would be great !)
@aexelmaexel
@aexelmaexel 3 жыл бұрын
Hi@@EdjeElectronics, what exactly do you have to modify to use TensorFlow lite? I tried to find out for hours but I couldn't find an answer
@shourav52
@shourav52 3 жыл бұрын
he should have done it with tensorflow lite because of using raspbery pi bt i didn't understand why he uses frozen file
@muhammadyoga3985
@muhammadyoga3985 Жыл бұрын
you can try bro ? please help me
@reynardnalla1375
@reynardnalla1375 5 жыл бұрын
How can i let the system know that it detects nothing in the frame so that i can add a statement for that clause
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
You could check to see if there are any objects detected above a certain confidence level like 20%. If the confidence for the top object is not above 20%, you can say nothing has been detected in the frame. Here's a quick couple lines of code that would achieve this: if scores[0][0] < 0.20: print("Nothing detected in frame")
@flipsydeification
@flipsydeification 5 жыл бұрын
AWESOME !!! THANK YOU SOSOSOS MUCH~~~
@myworldbox
@myworldbox 4 жыл бұрын
frame.setflags(write=1) ValueError: cannot set WRITEABLE flag to True of this array What am I doing wrong?...
@myworldbox
@myworldbox 4 жыл бұрын
The issue was solved by changing the code frame = frame1.array to frame = np.copy(frame1.array) in Object_detection_picamera.py and Pet_detector.py
@maurice812
@maurice812 4 жыл бұрын
@@myworldbox Thank you I had the same problem.
@myworldbox
@myworldbox 4 жыл бұрын
@@maurice812 you welcome,XD I know the feeling of not having an answer; therefore, I post it to all comment sections to try to help others.
@muhammadsalehuddin2443
@muhammadsalehuddin2443 3 жыл бұрын
@@myworldbox man thank you very much. This single error give me headache. Thanks man.
@hum4n593
@hum4n593 4 жыл бұрын
Thank you so much ! It's simply amazing ! 😃
@erictansweebeng5498
@erictansweebeng5498 5 жыл бұрын
What is the size of your SD card ?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
I used a 32GB SD card for this project!
@erictansweebeng5498
@erictansweebeng5498 5 жыл бұрын
@@EdjeElectronics Noted, thanks bro! Much appreciated!
@marielandoy4291
@marielandoy4291 5 жыл бұрын
Pls answer my question Can object detection view on the web page?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Hi Mariel, check out this page for an explanation of how to capture a window on your desktop (such as a web page) into a frame. Once you capture the frame, it can be passed into the object detection neural network. stackoverflow.com/questions/35097837/capture-video-data-from-screen-in-python/43560140
@yosanmelese4549
@yosanmelese4549 4 жыл бұрын
I never met a cat that sits on the door without meowing
@thejustm332
@thejustm332 4 жыл бұрын
is there any way to use teachable machine to make a model that can be used for raspberry pi
@guruprasaadh6125
@guruprasaadh6125 4 жыл бұрын
i too have the same doubt....teachable uses mobilenet itseems... please do reply if u had got a solution
@IqweoR
@IqweoR 5 жыл бұрын
Nice video!
@MrHypermole
@MrHypermole 5 жыл бұрын
"Raspberry Pi powered Pet Detector" is a hell of a tongue twister..
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
I had to practice that one a few times before recording! :)
@cbara568
@cbara568 11 ай бұрын
Your next project: Pi pico powered pet probe pls
@escx1613
@escx1613 5 жыл бұрын
Hello, can i ask about the max fps when running on rpi with the object detection? Can I reach like about 20 fps? Good tutorial btw
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Thanks! The max FPS I get is about 1.5FPS. You can see the FPS at various points in this video. Unfortunately, you won't be able to reach 20FPS on the Pi, because it just isn't powerful enough. You can look in to using higher-power devices like the Nvidia Jetson TX2 (which costs about $450 😪): developer.nvidia.com/embedded/buy/jetson-tx2 . There are also some APIs out there that let you use Wi-Fi to stream the camera data to a more powerful PC, which performs the detection and sends the results back to the Pi.
@escx1613
@escx1613 5 жыл бұрын
Thank you sir!
@erictansweebeng5498
@erictansweebeng5498 5 жыл бұрын
I had resorted to using a 16GB SD card as I had issues flashing the 32GB and 64GB cards
@TheAlexharnozd
@TheAlexharnozd 5 жыл бұрын
Hi, followed all the tuts. All great without error. Till i m abiut to run pyhton3 Objectetcetc.py Got error about : cant connect to X server I m running headless rpi b+ Test with startx : error with no display foubd Anything to do with xorg. Conf?
@minhhoangle536
@minhhoangle536 5 жыл бұрын
Hope you can find out a way to fps!
@daniyalasif104
@daniyalasif104 4 жыл бұрын
is it possible to detect rat using image processing algorithms?
@BeastModeDR614
@BeastModeDR614 5 жыл бұрын
Thank you
@objectdetection3252
@objectdetection3252 5 жыл бұрын
Also, can we add as many cameras as possible from different doors?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Probably not with just Raspberry Pi, that would be too much for it to handle! But you could set up multiple Raspberry Pis to accomplish it.
@PraYogiz
@PraYogiz 4 жыл бұрын
is other way to notify with free chat message, maybe use telegram api
@Davidnguyen-ck5bv
@Davidnguyen-ck5bv 5 жыл бұрын
Nice man. Greet from Vietnam
@PercyKalelChavezShica
@PercyKalelChavezShica 5 жыл бұрын
Hola como puedo cambiar el idioma de los objetos que detecta? y reproducirlos por audio ?
@raghavs6554
@raghavs6554 5 жыл бұрын
Hi edje can you tell how to print detected objects on raspberry pi terminal?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Yep! To print the top detected object in each frame, use print(classes[0][0]) .
@bid0u12345
@bid0u12345 Жыл бұрын
What if I want to detect my cat over other cats?
@samjithraj7467
@samjithraj7467 5 жыл бұрын
Is normal CCTV night vision outdoor camera compatible with this Rasberry pi
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
I'm not sure! If it has a USB cable, it might be compatible. It's worth trying.
@samjithraj7467
@samjithraj7467 5 жыл бұрын
Edje Electronics i think CCTV camera doesn’t have USB cable, can i convert it into USB ? any suggestions please?
@estebanfranco954
@estebanfranco954 3 жыл бұрын
Hi , I have problems running the Pets detection program with the TFLite tutorial you made. Do they work together without any changes?
@valentindanneville8695
@valentindanneville8695 5 жыл бұрын
Don't you have to use tensorflow lite ? I trained my own model to detect object on a GPU -tensorflow windows computer but I can't make the object detection script work with my model on the raspberry Pi . I keep getting the shell restarting, and I seems like an Out of Memory problem given the dmesg output. What do you recommend ?
@balajis6374
@balajis6374 4 жыл бұрын
sir,,,regarding the previous comment on GPIO,,,can we use a set of hardware's along with your concept.if it is possible where to add the hardware program in the main program of yours,,,,,and can we us tensor flow lite instead of tensor flow for improved performance,,,,how to replace twilio with telegram bot,,,,,(please give any suggestions sir as im in desperate of finding the result)
@davidbeiler6364
@davidbeiler6364 2 жыл бұрын
is it easy to incorporate deeplabcut to get notified if my dog is pooping?
@MrSpaceboyy
@MrSpaceboyy 5 жыл бұрын
Is it possible increase the FPS to at least 30?
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Hmm, I don't know... even when using the lightweight MobileNet model on my gaming PC (which is much more powerful than the Pi), it only gets about 12 - 15 FPS. I'm not sure what setup you would have to use to get 30 FPS. It may be possible, but it would probably be expensive!
@siddhantsangal5298
@siddhantsangal5298 5 жыл бұрын
You might want to try using YOLO v3 for higher frame rates. Just check out the comparison here pjreddie.com/darknet/yolo/
@alfrecletero
@alfrecletero Жыл бұрын
Any way I can add detecting which of my cats is in the frame? Maybe by colour?
@EdjeElectronics
@EdjeElectronics Жыл бұрын
Good question! You could try training a model that can distinguish between your cats. If you take 50 - 100 pictures of the cats and label them, then train a model with TensorFlow, it should do a decent job of detecting which cat is which. I recently made a Colab that makes it pretty easy to train a new TensorFlow model, check 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
@alfrecletero
@alfrecletero Жыл бұрын
@@EdjeElectronics nice, I will certainly look into that, I was wondering how many pictures would be needed, but 100 seems a fair number, I probably have that amount. Just in case anybody reads this, I need it to try and control access to individual feeders since one of my cats needs special food and the second one is constantly eating it hehe so maybe this solution works for somebody else as well
@alfrecletero
@alfrecletero Жыл бұрын
@@EdjeElectronics just two more questions, before investing in this hehe my cats are a ginger and a calico, pretty much the same size, so I'm wondering if there are enough differences to tell one from the other, and whether or not this would work both for night and day detection. Maybe there's a site or way to test this without buying a Raspeberry and cam? Thanks for your help!
@EdjeElectronics
@EdjeElectronics Жыл бұрын
@@alfrecletero Good questions! The best way to tell if it will do a good job distinguishing between your cats is to try training a model. Once it's trained, you can move your cats in front of your computer's webcam (assuming they will allow you to do so 😸), run the object detection program from my GitHub, and see how well it does at ID'ing the cats. You can also take a video using your phone and see how well it does on the video. Planning to release a video on how to train models using my Colab notebook in the first week of 2023! The video should make it easy to see how to train a model.
@reni_christian
@reni_christian 5 жыл бұрын
you are really amazing
@shirazushsalekinchowdhury8291
@shirazushsalekinchowdhury8291 5 жыл бұрын
Can you make a video to show how to get output of the detected images to the GPIO pins of Raspberry pi? For an example, when the Pi detects a pet inside the box for some frames, then a GPIO pin will give a high signal. Thank you.
@EdjeElectronics
@EdjeElectronics 5 жыл бұрын
Hi Salekin, here's a good example of how to use GPIO on the Raspberry Pi: www.raspberrypi.org/documentation/usage/gpio/python/README.md
@shirazushsalekinchowdhury8291
@shirazushsalekinchowdhury8291 5 жыл бұрын
@@EdjeElectronics Thank your for your link. But it shows how to use GPIO pin. I know how to use it. What I want is to make something like when camera will detect an object, GPIO pin should go high so that this signal can be used as control signal. Can you help me on this? Thank you.
@siddhantsangal5298
@siddhantsangal5298 5 жыл бұрын
@@shirazushsalekinchowdhury8291 did you find a solution to your problem?
@hayyanyousufkhan6032
@hayyanyousufkhan6032 3 жыл бұрын
does this deal with the situation that there are both pets inside and outside at the same time?
@reynardnalla1375
@reynardnalla1375 5 жыл бұрын
Hi, can anyone tell me how to increase the fps
@RobBrulinski
@RobBrulinski 5 жыл бұрын
very nice!
@nayjelalas289
@nayjelalas289 Жыл бұрын
Instead of Tensorflow, can this also be applied to Yolov5?
@johnangula7313
@johnangula7313 4 жыл бұрын
amazing!
@shourav52
@shourav52 3 жыл бұрын
how to send video feed to local webserver so that anyone can view the video feel without connecting to monitor
@youknowwho9724
@youknowwho9724 2 жыл бұрын
Any idea how to do this if im using tensorflow-lite?
@muhammadyoga3985
@muhammadyoga3985 Жыл бұрын
excuse mir, this source support tensorflow lite?
@Baxtexx
@Baxtexx 5 жыл бұрын
I need this
How To Run TensorFlow Lite on Raspberry Pi for Object Detection
10:48
Edje Electronics
Рет қаралды 868 М.
Tensorflow Lite with Object Detection on Raspberry Pi!
11:31
Lazy Tech
Рет қаралды 22 М.
Modus males sekolah
00:14
fitrop
Рет қаралды 12 МЛН
Zombie Boy Saved My Life 💚
00:29
Alan Chikin Chow
Рет қаралды 35 МЛН
АЗАРТНИК 4 |СЕЗОН 1 Серия
40:47
Inter Production
Рет қаралды 1,2 МЛН
Pi Solar Camera - Astronomy with the Raspberry Pi
43:46
DroneBot Workshop
Рет қаралды 27 М.
Use Raspberry Pi Camera from Python
12:21
Gary Explains
Рет қаралды 43 М.
How to Set Up TensorFlow Object Detection on the Raspberry Pi
19:26
Edje Electronics
Рет қаралды 347 М.
Object Detection Raspberry Pi using OpenCV Python
31:34
Murtaza's Workshop - Robotics and AI
Рет қаралды 173 М.
Modus males sekolah
00:14
fitrop
Рет қаралды 12 МЛН