Skip to content

mysfks/object_detection_with_yolo

Repository files navigation

Object Detection with YOLO

This project implements Object Detection using the YOLO (You Only Look Once) algorithm, which is a fast and accurate deep learning model for object detection. YOLO divides the image into a grid, then predicts bounding boxes and probability scores for each region in the image.

🚀 Project Overview

In this project, we aim to detect objects from images or videos in real-time using the YOLO model. This repository provides an easy-to-use pipeline for training YOLO on your custom dataset or using pretrained weights for object detection.

This project uses YOLOv5/YOLOv8 (or any YOLO version your project is based on) for performing multi-class object detection tasks like detecting vehicles, pedestrians, animals, etc.


📝 Table of Contents


Features

  • Integration of YOLO for real-time object detection
  • Easy setup for inference with pre-trained or custom models
  • Supports both image and video input
  • Custom dataset support for training (using YOLO configuration)
  • Visualization of detection results (bounding boxes, labels, confidence scores)
  • Uses PyTorch for GPU-based computation

⚙️ Setup and Installation

Follow these steps to set up the project on your local machine:

  1. Clone the repository:

    git clone https://github.com/your-username/object_detection_with_yolo.git
    cd object_detection_with_yolo
  2. Set up a virtual environment (optional but recommended):

    python -m venv yolo_env
    source yolo_env/bin/activate   # On Windows use: yolo_env\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt

    The dependencies typically include:

    • torch: Deep learning framework for YOLO model
    • opencv-python: For image processing
    • PyYAML: For configuration files
    • matplotlib: For visualizing detection results
    • tqdm: For progress bars
  4. Download pre-trained YOLO weights

    • For YOLOv8 (depending on your YOLO version):
      # Command to download weights for YOLOv8 model goes here

🧑‍💻 Usage Instructions

Object Detection on Images:

  1. Run YOLO detection on an image:

    python detect.py --source path_to_image.jpg --weights path_to_yolov_weights.pt --output output_folder
  2. Parameters:

    • --source: Path to the input image or folder containing images
    • --weights: Path to YOLO model weights
    • --output: Folder to store the output results
    • Other options include --img-size, --conf-threshold, --iou-threshold, etc.

Object Detection on Video:

  1. Run YOLO detection on a video:
    python detect.py --source path_to_video.mp4 --weights path_to_yolov_weights.pt --output output_folder

🧮 Evaluating the Model

Once the model is trained, you can evaluate the performance using the validation set:

python val.py --weights path_to_weights.pt --data custom_data.yaml --task test
  • This will output metrics like [precision, recall, mAP (mean Average Precision)] for object detection performance.

📚 References

Make sure to check these resources for better understanding and guidance.


About

This project implements Object Detection using the YOLO (You Only Look Once) algorithm, which is a fast and accurate deep learning model for object detection. YOLO divides the image into a grid, then predicts bounding boxes and probability scores for each region in the image.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages