This project implements a real-time object detection system using the SSD MobileNet V2 FPNLite 320x320 model, optimized for efficiency and speed, making it suitable for applications requiring real-time performance on limited computational resources. The model is pre-trained on the COCO 2017 dataset, allowing for the detection of a wide variety of objects with high accuracy.
- Real-Time Detection: Leverages the SSD MobileNet V2 FPNLite model for fast object detection.
- COCO Dataset Labels: Utilizes the complete COCO label map for recognizing and labeling 80 different object types.
- Optimized for TPU: Model performance is optimized for Tensor Processing Units (TPU), but it's also compatible with CPU and GPU setups.
- Python 3.x
- TensorFlow 2.x
- OpenCV
- NumPy
-
Clone the repository and open it locally
git clone https://github.com/Yonas650/Real-Time-Object-Detection.git cd Real-Time-Object-Detection
-
install dependencies
pip install tensorflow opencv-python numpy
- Download the SSD MobileNet V2 FPNLite model
The SSD MobileNet V2 FPNLite model, optimized for the COCO dataset and TPU inference, is too large to include directly in this repository. Follow the instructions below to download and set up the model:
-
Visit the TensorFlow Model Zoo and download the SSD MobileNet V2 FPNLite 320x320 model file. [
if you have trouble downloading it directly, copy the link address and paste it in a new tab and press enter. It will be automatically downloaded.
] -
Extract the downloaded file into the project directory:
tar -xvf ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8.tar.gz
This will create a ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8 directory containing the model files in your project folder.
- Ensure the COCO label map is in place
For object recognition and labeling, the mscoco_complete_label_map.pbtxt file is required. If it's not already in your project directory, download it using:
curl -o mscoco_complete_label_map.pbtxt https://raw.githubusercontent.com/tensorflow/models/master/research/object_detection/data/mscoco_complete_label_map.pbtxt
- Running the Detection System
To start the object detection system, run the main script:
python model.py
This will activate your webcam and begin detecting objects in real-time. Press q to quit the detection window.
- Model Information
- Model Architecture: SSD MobileNet V2 FPNLite
- Input Size: 320x320 pixels
- Training Dataset: COCO 2017
- Optimization: Optimized for TPU (compatible with CPU and GPU)
Label Map
The COCO label map included with this project maps numerical class IDs to human-readable labels, covering 80 object categories such as person, bicycle, car, and many more.
Acknowledgments
- TensorFlow Object Detection API for providing the model and training data.
- The COCO dataset for the extensive labeled dataset used for training the model.