Skip to content

damiaoterto/object_detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Object Detection

This repository contains a Python script for object detection in images using the YOLOv4 neural network and the OpenCV library. The script loads pre-trained weights and configuration, performs object detection on a given image, and displays the resulting image with the detections drawn.

Requirements

  • Python 3.6+
  • pipenv for virtual environment management
  • OpenCV
  • NumPy
  • Matplotlib

Environment Setup

To install the dependencies and set up the virtual environment, follow the steps below:

  1. Clone this repository:

    git clone https://github.com/your-username/yolov4-object-detection.git
    cd yolov4-object-detection
  2. Download yolov4 weights on project path:

    wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights
  3. Use pipenv to create and activate the virtual environment:

    pipenv install
    pipenv shell
  4. Install the dependencies listed in the requirements.txt file:

    pip install -r requirements.txt

How to Use

  1. Place your input images in the data folder.

  2. Ensure you have the following files in the cfg folder:

    • coco.names: File containing the class names.
    • yolov4.cfg: YOLOv4 network configuration file.
    • yolov4.weights: Pre-trained YOLOv4 weights file.
  3. Run the main script main.py:

    python main.py

Project Structure

β”œβ”€β”€ cfg
β”‚   β”œβ”€β”€ coco.names
β”‚   β”œβ”€β”€ yolov4.cfg
β”‚   └── yolov4.weights
β”œβ”€β”€ data
β”‚   β”œβ”€β”€ dog.jpg
β”‚   β”œβ”€β”€ horses.jpg
β”‚   └── humans.jpg
β”œβ”€β”€ main.py
β”œβ”€β”€ Pipfile
β”œβ”€β”€ Pipfile.lock
β”œβ”€β”€ requirements.txt
└── README.md

Features

  • Loading YOLOv4 network weights and configuration.
  • Reading input image.
  • Object detection using the YOLOv4 network.
  • Displaying the resulting image with bounding boxes and labels of detections.

Contribution

Contributions are welcome! Feel free to open issues or pull requests for improvements and fixes.

Licence

This project is licensed under the MIT License. See the LICENSE file for more information.

About

A simple image object detector using python 🐍

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages