Object Identification & Animal Recognition With Raspberry Pi + OpenCV + Python

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey gang tim here acro electronics and today we're using a raspberry pi 4 to search and identify common household objects and commonplace animals all in real time and i'll show you how to build one in your own makeovers [Music] we're going to be using a trained library which is going to enable our raspberry pi in combination with a pi camera to identify 91 unique objects and animals in real time whilst providing an updating confidence rating later on in the video i'm also going to refine the identification so it searches only for particular desired targets with that in the bag we're going to take this to the next step and demonstrate how you can make the raspberry pi control physical hardware through the gpio whenever it identifies that particular target this will be the second foray into the opencv landscape with raspberry pi and facial recognition being the first link down below to that having the tools to solve real-time computer vision problems has never been more accessible so let's jump in on the table is all the components you'll need to get this system up and running real fast you're going to need a raspberry pi official camera module v2 or you could optionally use the raspberry pi high quality camera a micro sd card flash with raspberry pi os a power supply naturally you're also going to want a hdmi cord a mouse a keyboard and a monitor to connect it all to i'm also using a raspberry pi 4 model b for gigabytes for this setup as having the extra computing power that comes with the raspberry pi 4 is a must for this kind of application once you power up the raspberry pi you're going to see the desktop boot it up and from here you can connect it to the internet next open the raspberry pi configuration menu found by using the top left menu and scrolling over preferences and make sure the camera found under the interfaces tab is enabled if you had to enable this setting go ahead and reset the raspberry pi so the changes can take effect having done this it's time to install opencv to raspberry pi and this software provides us a huge resource to help us solve those real-time computer vision and imaging processing problems that we're going to be encountering this is a series of terminal commands that will take some time to complete it is a good opportunity to have some cups of tea as you work through the process every terminal command to do this is found on the written article so all you need to do is copy and paste each line with that complete you'll have opencv installed onto a fresh version of raspberry pi os and once that is complete the very next step is to download the zip file found at the bottom of my article page and unzip the contents into the desktop it is important that it goes in this directory as this is where the python code will be searching for to get data about the object's name and also to get data from the trained library the coco common object in context library is a large scale object detection segmentation and captioning data set this trained coco library is how the raspberry pi will know what certain animals and certain objects generally look like you can find pre-trained libraries for all manner of objects and animals and even sounds so if this particular library here does not suit your needs you can find many others freely accessible online so with that all the setting up is done so grab yourself some props like i have here a mouse a cup a keyboard and let's jump right in and run that code the first code you're going to start with is object ident.py and you're going to open it up by right-clicking it and opening it with either thony or jenny both are just python language interpreter softwares as soon as you press play you're going to see a window open up showing a live feed of exactly what the raspberry pi 4 model b is singing through the official high quality raspberry pi camera whenever it sees an object it knows it's going to draw a green box around it as well as give it a label and a confidence rating if it sees multiple objects that it knows it's going to be creating multiple boxes and labels it's awesome hey it's honestly incredible how clever this little tiny raspberry pi can be writing this code continuously gets the raspberry pi really hot so definitely a good idea to provide it with some kind of cooling jumping back into the code a value worth tinkering with is the threshold percentage value which you can find right here increasing this means the software will only draw a box around an object when it has a high confidence factor and is absolutely sure that it has identified the object correctly another option worth tinkering with is the nms percentage value which you can find here increasing this will limit the amount of simultaneously identified objects it is immensely valuable to be able to look for just one object and ignore all the other objects that way for example you can count how many cups seen during a day but not how many humans are holding those cups this is also a very useful way to make the raspberry pi run the live preview window with a higher frame rate but hey what if you wanted to identify a cup and a horse and only those two things well you're going to edit that line in this manner then once you save the code and press play it's going to do just as you desired we can do so many things with this code now simply let's start by jumping into the folders and opening up object identify three dot py with a python editor in this file i've added just a few lines of code to the original code so that every time a particular target is seen it's going to send out signals by the gpio pins of the raspberry pi it's going to be commanded to rotate whenever the raspberry pi system sees a cup if anything else is seen it's not going to do anything all the code i'm going to be adding here is completely explained in the guide controlling standard servos with the raspberry pi link down below in the description and so with my cup and servo in hand let's run this system and as soon as i show the camera the cup boom we have rotation there is just so much potential with this software to take projects to amazing places big thanks goes to the opencv and coco teams that work on this amazing software which lets things like this happen so that's it for today until next time stay cozy [Music] you
Info
Channel: Core Electronics
Views: 181,227
Rating: undefined out of 5
Keywords: object recognition with raspberry pi, indentify humans with raspberry pi, identify animals with RASPI, how to use a HQ camera to identify cups, identify things with Pi, GPIO control through object identification, Coco library, Open CV, Open-cv, Raspberry Pi, machine learning, detection
Id: iOTWZI4RHA8
Channel Id: undefined
Length: 6min 15sec (375 seconds)
Published: Mon Aug 23 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.