Skip to content

kiena-dev/Raspberry-PI-MobileNetSSDv2-tflite-LED

Repository files navigation

Raspberry-PI-MobileNetSSDv2-tflite-LED

Detect object, output the class using LED

Raspberry Pi Python Jupyter Notebook OpenCV

This GitHub repository show real-time object detection using a Raspberry Pi, MobileNetSSDv2 TensorFlow Lite model, LED indicators, and an LCD display. the feature of this project include:

  • Show fps for each detection
  • Output the class using LED for each class (there is 5 classes: car, person, truck, bus, motorbike)
  • Show CPU and temperature of raspberry pi using LCD 16x02.

Demo

Below is the following demo video showcasing the Raspberry Pi in action. When real-time object detection processed, video frames show the fps, LED indicators will trun on based on detected classes, and CPU usage and temperature information displayed on the LCD screen.

Overview

Prerequisites

  • Raspberry Pi 4 (I'm using 8 GB version)
  • Raspberry Pi OS 11 Bulleyes 64-bit
  • Pi Camera v2/v1/Web-Camera
  • PCB or PCB Dot
  • LCD 16x2 Biru/Blue 1602 SPI I2C
  • ✨ Wiring cable ✨

Wiring Diagram

Overview

Follow this organized table to establish the proper connections, you can also read the reference here GPIO on Raspberry Pi4.

LED Wiring - Raspberry Pi
Wire Color GPIO Pin
Red GPIO 17
Green GPIO 18
Yellow GPIO 23
Cyan GPIO 27
White GPIO 22
Black (GND) GND
I2C Wiring - Raspberry Pi
Wire Color Connection
Red 5V
Black GND
Purple SDA
Brown SCL

Installation

To run this project, you need Python 3.5 or higher installed on your system. Follow these steps to get started:

  • Clone the repository and navigate to the project directory: :
  git clone https://github.com/kiena-dev/Raspberry-PI-MobileNetSSDv2-tflite-LED.git
  cd Raspberry-PI-MobileNetSSDv2-tflite-LED
  • Create a Python virtual environment (optional but recommended):
  python3 -m venv venv
  • Activate the virtual environment:
  source venv/bin/activate
  • Install the required dependencies using pip3:
  pip3 install -r get_requirement.txt

Now you have successfully installed the project and its dependencies.

Usage

Video Usage

Default (without LED/LCD):

  python3 RPI_detect_video.py --modeldir=mobilenetssd_320 --video=video_test.mp4 --graph=detect.tflite

With LED/LCD:

  python3 RPI_detect_video_led.py --modeldir=mobilenetssd_320 --video=video_test.mp4 --graph=detect.tflite
Image Usage
  python3 RPI_detect_image.py --modeldir=mobilenetssd_320 --graph=detect.tflite --imagedir=image --save_results

Remove --save_results if you don't want to save images and change --graph to switch the model.

Webcam Usage

Default (without LED/LCD):

  python3 RPI_detect_webcam.py --modeldir=mobilenetssd_320 --graph=detect.tflite

With LED/LCD:

  python3 RPI_detect_webcam_led.py --modeldir=mobilenetssd_320 --graph=detect.tflite

Change --modeldir to modify the model file location as needed.

Training Dataset

If you want to train your own model, you can utilize the resource provided below:

Open In Colab

Reference Jupyter Notebook File:

Open In Colab

Dataset from Roboflow:

Be sure to make use of these resources to train your model and achieve optimal results!

Authors

Reference

Special thanks to the following resources that inspired and contributed to this project:

About

This GitHub repository show real-time object detection using a Raspberry Pi, MobileNetSSDv2 TensorFlow Lite model, LED indicators, and an LCD display.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors