Object and Animal Recognition With Raspberry Pi and OpenCV

Hi, First of all thanks for uploading this master piece of machine learning . I followed every step that you provided on website but still I am getting this kind of error which I am not sure how to solve. Any help will be great.

1 Like

Hi I hope you doing well. I followed every step You mention on this page and still I am getting some kind of error. Please will You be able to look at this for me. I am doing my university project. I have posted a comment today with a picture of an error.

1 Like

Hey Afnan,

Thanks for your very kind words :slight_smile: !

Just want to double-check two things. Are you using the older ‘Buster’ Version of Raspberry Pi OS or the Newer ‘Bullseye’ Raspberry Pi OS one? For this guide, we must use the Buster Version.

Also what camera module do you have attached to your system? Could you send through an image of your hardware as it is currently hooked up?

Kindest regards,
Tim

Hi, I recently came up with a project that I would like to develop, what I want to accomplish is to detect an object of a few millimeters onto a moving object. Would this be possible? Thanks in advance.

1 Like

Hey Con

Anything is possible :blush: not exactly sure what you want though, like what is this tiny object?

Have a look at Edge Impulse - https://www.edgeimpulse.com/ - That website will let you create your own Machine Learnt systems Completely FREE. It is really really cool.

Hope that helps some,
Tim

Hi, I have recently sent you an email regarding a project that I am working on. What I want to accomplish is tracking an object on an insect. Could this be possible? Thanks in advance.

Just imagine tracking a small sphere ball of 2 millimeters on a flying butterfly as exame or even smaller than a butterfly.

Just imagine tracking a small ball of 2 millimeters on a flying butterfly as an example or even smaller than a butterfly.

hi i use buster os and came this error also is working after that error but is laggy 4 sec .model pi 4 8gb with 2.1 camera …
[ WARN:0] global /home/pi/opencv-4.4.0/modules/videoio/src/cap_gstreamer.cpp (1761) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Failed to allocate required memory.
[ WARN:0] global /home/pi/opencv-4.4.0/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/pi/opencv-4.4.0/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

Hi, did you managed to fuse animal recognition with tracking? I was exactly after this but I have not been skilled enough to overcome…
Thanks
Regards

Hi Tim, thanks for such an incredible tutorial!
I’ve never done anything like this before but I am interested in setting up a system in my kitchen to play a sound if it detects my cats on the kitchen counter or bench (I have a cheeky cat who loves to steal food). I would also like to keep my dogs out of the kitchen and was wondering if it’s possible to mark out only specified areas of the frame as the ‘no-go zones’ for the cats and dogs respectively?
I assume the benches and counter might be easier as they are visually different but we have an open plan kitchen so I was wondering if I’d be able to manually select a certain region of the frame as the ‘no-go zones’ for the dogs to gently remind them to stay out of the area.
Thank you! Mia

Im having error that persists after make -j $(nproc) command

1 Like

I have some errors in Thony when trying to launch the camera.


@Tim Greetings from the UK. Thank you for this tutorial! It worked first time, perfectly. I’m trying to understand all the scripts. I’m planning on using it to detect cats in my garden, then trigger a squirt of water to move them on. I’m tired of picking up cat business ( I don’t have cats ) and the simple PIR systems I tried before ended up spraying me, the family, neighbour etc.

Thanks again :smiley:

Hey E,

That is an awesome sounding project and it lit up something in my mind that I saw a little while ago, there was a youtuber (Australian) that made a similar device to what you are trying to build about 4 years ago. It is a bit different as you are trying to incorporate Animal Recognition, but it may be useful to your project in some way.
Check it out here.

Cheers,
Blayden

Thanks Blayden, that was a fun watch. I had a proper LOL when I saw the servo switch :smiley:

I’m making great progess on my project, it’ll be a couple weeks until it’s all done. I’m time starved at the moment, so a bit hard to write it up and publish it. I’ll do what I can. When I’m done, I’ll pop back and place a link here to inspire others.

hi @Tim

I am unable to install the below packages:

E: Unable to locate package libjasper-dev
E: Package ‘libpng12-dev’ has no installation candidate

image

Kindly need assistance

Regards

Hello, can you tell me why I’m getting warnings with Gstreamer even though my picamera is installed correctly and I have the necessary access rights for Gstreamer? The code is also about object detection.
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (1824) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Device ‘/dev/video0’ has no supported format
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (914) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

The error messages you’re seeing are coming from OpenCV trying to use GStreamer to open a video capture stream from a video device.

  1. The first warning is telling you that the GStreamer v4l2src0 module has halted because the device at /dev/video0 does not have a supported format. v4l2src0 is a GStreamer plugin for using Video4Linux2 devices, and /dev/video0 is the device file for the first V4L2 device on the system. This usually means your camera.
  2. The second warning is saying that GStreamer was unable to start the pipeline. The pipeline in GStreamer is a series of processing steps that the video data will go through. In this case, it’s likely failing because of the problem with v4l2src0 mentioned in the first warning.
  3. The third warning is related to the second one. OpenCV is checking whether the GStreamer pipeline is playing, and it’s not, because it couldn’t be started.

Here are a few things you can check to troubleshoot this issue:

  1. Check Camera Compatibility: Make sure your camera is compatible with V4L2 and that it’s working properly. You can check this by running v4l2-ctl --list-formats in a terminal, which should list the formats supported by your camera.
  2. Check Camera Connection: Make sure your camera is properly connected and powered on, and that it’s correctly detected by your system. You can check this by running ls /dev/video* in a terminal. You should see /dev/video0 listed, and possibly other video devices as well.
  3. Check GStreamer Installation: Make sure GStreamer and the necessary plugins are correctly installed. You can check which plugins are installed by running gst-inspect-1.0 in a terminal.
  4. Check OpenCV Installation: Make sure OpenCV is correctly installed and built with GStreamer support. If you installed OpenCV from a package manager, you might need to install a separate package for GStreamer support, or if you built OpenCV from source, you need to make sure GStreamer was enabled when you configured the build.

If none of these steps solve your problem, you might need to provide more information about your setup for more specific advice.

Hello. I’m unsure why I’m getting the error message “FileNotFoundError”. I’ve put the download on my desktop then extracted it. Does anyone have any solutions? Thank you.