raspberrypi / picamera2

New libcamera based python library
BSD 2-Clause "Simplified" License
891 stars 188 forks source link

Add real-time object detection example for Raspberry Pi 4 #928

Closed ranizouaoui closed 4 months ago

ranizouaoui commented 10 months ago

Pull Request Description

What does this PR do?

This pull request adds a real-time object detection example for Raspberry Pi 4 using TensorFlow Lite with metadata format. The example leverages OpenCV, MediaPipe, and Raspberry Pi OS (64-bit).

How to Test

  1. Ensure you are using a Raspberry Pi 4 with Raspberry Pi OS (64-bit).
  2. Install the required dependencies by running the following commands:
    sudo rm /usr/lib/python3.11/EXTERNALLY-MANAGED
    sudo pip3 install opencv-python==4.8.1.78
    sudo pip3 install mediapipe==0.10.8
  3. Convert your TensorFlow Lite model to metadata format following the steps mentioned in the README.
  4. Navigate to the real-time-object-detection-rpi4 directory.
  5. Run the real-time detection script:
    python3 real_time_detection_with_labels_on_raspberry4.py
davidplowman commented 9 months ago

Hi, and thanks for this PR. In principle I'm happy to have more up to date TensorFlow example so would be happy to merge this. I had just a few questions about it, perhaps you could tell me what you think before we do that. I'll put some comments inline in your commits. Thanks!