Skip to content

This repository contains a Python script for real-time object detection using TensorFlow and OpenCV. The script utilizes a pre-trained deep learning model to detect objects in a webcam feed, providing a visual representation of the detected objects along with their corresponding class labels and confidence scores.

Notifications You must be signed in to change notification settings

Shrinkhal01/-Real-time-Object-Detection-using-TensorFlow-and-OpenCV

Repository files navigation

Object Detection using SSD MobileNet v3

  • This project demonstrates object detection using SSD MobileNet v3 with pre-trained models on the COCO dataset. The code captures video from your webcam, detects objects in real time, and labels them with bounding boxes and confidence scores.

Table of Contents

  • Overview
  • Requirements
  • Setup
  • Usage
  • COCO Classes
  • References

Overview

This project uses OpenCV's DNN module to detect objects in real-time using a pre-trained model on the COCO dataset. The detection process is powered by the SSD MobileNet v3 architecture.

Key Features:

  • Real-time object detection from a webcam feed.
  • Bounding boxes and confidence scores are displayed for detected objects.
  • Utilizes pre-trained models for quick and accurate detection.

Requirements

  • Python 3.x
  • OpenCV (cv2)
  • Pre-trained weights and config files for SSD MobileNet v3
  • COCO class names file

Install the required packages:

pip install opencv-python

Setup

Clone the repository or download the necessary files:

OD.py (Main Python script)
coco.names (COCO class labels)
frozen_inference_graph.pb (Pre-trained weights)
ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt (defines a node in the neural network configuration. Specifically, it describes a FusedBatchNormV3 operation applied)

Place all the files in the same folder.

Make sure your webcam is connected and working. Tested on Python 3.7 and 3.12 It works great

Run the Python script:

python OD.py
  • The script will open a window showing the webcam feed, and detected objects will be highlighted with bounding boxes along with their labels and confidence scores.

  • Press q to quit the window.

COCO Classes

The model is trained on the COCO dataset, which contains 80 common object classes such as:

-Person -Bicycle -Car -Dog etc.

The full list of classes is in the coco.names file included in this project.

References

  • SSD MobileNet v3
  • COCO Dataset
  • OpenCV DNN module

About

This repository contains a Python script for real-time object detection using TensorFlow and OpenCV. The script utilizes a pre-trained deep learning model to detect objects in a webcam feed, providing a visual representation of the detected objects along with their corresponding class labels and confidence scores.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages