Skip to content

Mayur3sh007/Car-Counter

Repository files navigation

YOLOv8 Car Counter

YOLOv8 Car Counter is a powerful and optimized solution for counting cars in video streams or images using the YOLOv8 object detection model. This project focuses on enhancing performance by utilizing a tracer instead of capturing cars in every frame and applying masking to focus on the relevant area.

Features

  • High Accuracy: Utilizes the YOLOv8 model for precise car detection.
  • Optimized Performance: Uses a tracer to track cars across frames, reducing the computational load.
  • Area Masking: Focuses on a specific area of interest to improve detection efficiency.

Getting Started

Prerequisites

  • Python 3.8+
  • pip (Python package installer)
  • NVIDIA GPU with CUDA support (recommended for optimal performance)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/YOLOv8-Car-Counter.git
    cd YOLOv8-Car-Counter
  2. Create a virtual environment:

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

    pip install -r requirements.txt
  4. Download the YOLOv8 model weights:

    • Download the YOLOv8 weights from the official YOLOv8 repository or use your trained model.
    • Place the weights file in the models directory.

Usage

  1. Prepare your input data:

    • Place your video files or images in the input directory.
  2. Run the car counter:

    python car_counter.py --input_path ./input --output_path ./output
  3. Check the output:

    • Processed videos or images with car count annotations will be saved in the output directory.

Configuration

You can customize the behavior of the car counter by modifying the config.yaml file. Key parameters include:

  • confidence_threshold: Confidence threshold for YOLOv8 detections.
  • nms_threshold: Non-max suppression threshold.
  • mask_area: Coordinates for the area of interest.

Example

python car_counter.py --input_path ./input/sample_video.mp4 --output_path ./output

Contributing

Contributions are welcome! Please fork the repository and create a pull request with your changes. Ensure your code adheres to the project's coding standards and includes appropriate tests.

License

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

Acknowledgements

About

My first ML project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages