Skip to content

This project implements an object detection system using TensorFlow and OpenCV, designed to identify and classify objects in images or video streams. By utilizing pre-trained models from the TensorFlow Object Detection API, this project allows users to detect multiple objects in real-time or from static images.

Notifications You must be signed in to change notification settings

konynour/TF-Object-Detection

Repository files navigation

Object Detection using TensorFlow and OpenCV

📌 Overview

This project implements object detection using a pre-trained SSD MobileNet v2 model from the TensorFlow Model Zoo. The model is loaded using OpenCV's Deep Neural Network (DNN) module, and it performs real-time object detection on images.

⚠️ Disclaimer

This project is intended for educational purposes only. The author is not responsible for any misuse.

🚀 Features

  • Loads and processes images for object detection.
  • Uses a pre-trained SSD MobileNet v2 model.
  • Detects multiple objects in an image and labels them with bounding boxes.
  • Configurable detection threshold.

📂 Requirements

  • Python 3.x
  • OpenCV (cv2)
  • Matplotlib
  • numpy
  • os
  • urllib
  • zipfile
  • TensorFlow Model Zoo (pre-trained models)

🔧 Installation

  1. Clone this repository:
    git remote add origin https://github.com/konynour/TF-Object-Detection.git   ```
  2. Navigate to the project folder:
    cd ObjectDetection
  3. Install dependencies:
    pip install opencv-python numpy matplotlib

⚙️ Usage

1️⃣ Load and Configure the Model

  • Download and extract the SSD MobileNet v2 model from TensorFlow Model Zoo.
  • Place the frozen_inference_graph.pb and its configuration file .pbtxt inside the models/ directory.

2️⃣ Run Object Detection on an Image

import cv2
import os
from detect import detect_objects, display_objects

# Load an image
im = cv2.imread(os.path.join("images", "street.jpg"))

# Detect objects
objects = detect_objects(net, im)

# Display results
display_objects(im, objects)

3️⃣ Adjust Detection Threshold

If you want to adjust the confidence threshold, you can modify the detection function call:

im = cv2.imread(os.path.join("images", "baseball.jpg"))
objects = detect_objects(net, im)
display_objects(im, objects, threshold=0.2)

About

This project implements an object detection system using TensorFlow and OpenCV, designed to identify and classify objects in images or video streams. By utilizing pre-trained models from the TensorFlow Object Detection API, this project allows users to detect multiple objects in real-time or from static images.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published