Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Problem Statement

This project implements a simple object detection system using the pre-trained YOLOv5 model. It processes images from a small built-in dataset (e.g., scenes with people, vehicles, or animals), detects objects (from 80 COCO classes like "person", "car", "sports ball"), draws bounding boxes with class labels and confidence scores, counts detected objects by class, and displays/saves both the original and annotated images. The goal is to showcase end-to-end object detection, visualization, and basic tracking (via counting) without custom training.

Tech Stack

  • Language: Python 3.7+
  • Deep Learning Framework: PyTorch (with YOLOv5 from Ultralytics)
  • Computer Vision: OpenCV (for image loading, drawing, and display)
  • Data Handling: NumPy (array operations), Requests (image downloads)
  • Utilities: Collections (for object counting), Pathlib (file paths)
  • Model: Pre-trained YOLOv5s (small variant; detects 80 classes from COCO dataset)

No additional training or large datasets required—uses public sample images.

Steps to Run the Project

  1. Install Dependencies:

    • Install PyTorch: pip install torch torchvision torchaudio (for CPU). For GPU (e.g., CUDA 11.8): pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 (adjust for your CUDA version).
    • Install other packages: pip install opencv-python requests numpy.
    • Optionally, clone YOLOv5 repo for local loading: git clone https://github.com/ultralytics/yolov5 && cd yolov5 && pip install -r requirements.txt.
  2. Save the Code:

    • Copy the provided Python script into a file, e.g., object_detection.py.
  3. Run the Script:

    • Execute: python object_detection.py.
    • It will download a selected sample image (change selected_index in code to pick from the dataset), run detection, print counts and details, save original_image.jpg and detected_image.jpg, and display images (if GUI is available; skips in headless environments like servers).
  4. Outputs:

    • Console: Selected image info, total detections, per-class counts, and bounding box details.
    • Files: Original and detected images with annotations (bounding boxes, labels, overall count).
    • GUI: Windows showing original and detected images (press any key to close).# ImageDetection

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages