Skip to content

OBJECT DETECTION project using PyTorch, Torchvision, and OpenCV (cv2). Implements advanced detection models to identify and classify objects in images with high accuracy.

Notifications You must be signed in to change notification settings

pratham-asthana/Object-detection

Repository files navigation

Object Detection

This repository contains an object detection project using PyTorch, Torchvision, and OpenCV (cv2). The project demonstrates how to implement and fine-tune state-of-the-art detection models for identifying and classifying objects in images.

Requirements

  • Python 3.8+
  • PyTorch 1.10+
  • Torchvision 0.11+
  • OpenCV 4.5+
  • NumPy
  • Matplotlib

Overview

This repository contains a comprehensive object detection pipeline built using PyTorch, Torchvision, and OpenCV. The project focuses on leveraging pre-trained models for object detection, customizing them for specific use cases, and providing an end-to-end solution for training, evaluation, and inference. The repository is designed to be flexible and extendable for various object detection tasks.

Table of Contents

Features

  • Pre-trained Models: Utilizes state-of-the-art pre-trained models from Torchvision, including Faster R-CNN, SSD, and RetinaNet.
  • Custom Training: Offers support for training on custom datasets with configurable hyperparameters.
  • Evaluation Metrics: Implements evaluation metrics like mean Average Precision (mAP) for model performance assessment.
  • Real-time Inference: Provides scripts for real-time object detection on images, videos, and webcam feeds.
  • Modular Design: Structured in a modular way, allowing easy customization and extension of the pipeline.

Installation

To get started, clone this repository and install the required dependencies:

git clone https://github.com/pratham-asthana/object-detection.git
cd object-detection
pip install -r requirements.txt

Usage

Dataset Preparation

To train the model on your custom dataset, organize your data in the following structure:

dataset/ │ ├── train/ │ ├── images/ │ └── annotations/ ├── val/ │ ├── images/ │ └── annotations/ └── test/ ├── images/ └── annotations/

Ensure that annotations are in a compatible format, such as COCO or Pascal VOC. You can modify the dataset loading script in datasets.py to accommodate different formats.

Training

Customize the config.yaml file to specify your dataset path, model type, learning rate, and other hyperparameters. Then, start the training process with the following command:

python train.py --config config.yaml

Results

The model's performance has been evaluated on various test cases. Below are some sample results showcasing the model's ability to detect and classify objects accurately:

Sample Images

Example 1

object_Detection Description: Detected objects in Example 1 with bounding boxes, labels, and confidence scores.

Example 2

object Detection Description: Detected objects in Example 2 demonstrating the model's performance on different object types and scenes.

Sample Video

Video

Sample of a video for the same is uploaded in the repository itself! Any queries are accepted.

Contributing

We welcome contributions to improve this project. If you have ideas for new features, bug fixes, or improvements, please follow the guidelines below:

How to Contribute

  1. Fork the Repository: Click the "Fork" button at the top right of this repository page to create a copy of the project under your GitHub account.

  2. Create a New Branch:

    git checkout -b feature-branch-name

About

OBJECT DETECTION project using PyTorch, Torchvision, and OpenCV (cv2). Implements advanced detection models to identify and classify objects in images with high accuracy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published