An open API service indexing awesome lists of open source software.

https://github.com/bee1997/anpr-yolov8-paddleocr

Automatic Number Plate Recognition (ANPR) using YOLOv8 and PaddleOCR for vehicle tracking and license plate extraction
https://github.com/bee1997/anpr-yolov8-paddleocr

ai-ml anpr computer-vision paddleocr python tracking vehicle-detection vehicle-tracking yolov8

Last synced: 3 months ago
JSON representation

Automatic Number Plate Recognition (ANPR) using YOLOv8 and PaddleOCR for vehicle tracking and license plate extraction

Awesome Lists containing this project

README

          

# Automatic Number Plate Recognition (ANPR) with YOLOv8 and PaddleOCR

This project implements Automatic Number Plate Recognition (ANPR) using the YOLOv8 model for vehicle detection and tracking and PaddleOCR for optical character recognition (OCR) of license plates. The application detects vehicles, recognizes license plates, and logs them to a CSV file.

## Project Structure

- **`run.py`**: Main script that loads the YOLOv8 and PaddleOCR models, processes the video frame-by-frame, and annotates detected license plates.
- **`requirements.txt`**: List of required packages to set up the environment.
- **`demoVideo.mp4`**: Sample video file used for vehicle and license plate detection.
- **`Car-List.csv`**: Output file that logs detected car IDs and corresponding license plate numbers.

## How It Works

1. **Vehicle Detection and Tracking**: YOLOv8 detects vehicles in the video frames.
2. **License Plate OCR**: PaddleOCR recognizes and extracts license plate numbers from detected vehicles.
3. **CSV Logging**: Each unique vehicle’s license plate number is saved to `Car-List.csv`.
4. **Annotated Video**: A video (`demoVideo_out.mp4`) is generated with annotated bounding boxes and recognized license plate numbers.

## Setup

### Prerequisites
- Python 3.x

### Installation
Install the dependencies:

```bash
pip install -r requirements.txt
```

## Usage

### Run the Program

```bash
python run.py
```

## Example

Below are some example visualizations generated by running run.py:

- **Annotated video(.gif) of detected vehicles**:
![Annotated video(.gif)](demoVideo_out_gif.gif)

- **CSV output(image) of recognized license plates.**:
![CSV output image](CSV-output-img.PNG)

- **Average processing time for each frame**:
- Average processing time per frame ~0.2392 seconds which includes:
1. Reading the frame from the video.
2. Running YOLOv8 for object detection and tracking.
3. Cropping the regions of interest and running PaddleOCR.
4. Annotating the frame with bounding boxes and text.

## Future Enhancements

- Reducing the processing time for each frame.
- Improve OCR accuracy for license plates in challenging environments.
- Extend the tracking to handle multiple vehicles with overlapping paths.
- Integrate real-time camera feeds instead of processing static video files.

## Acknowledgments

- [YOLOv8](https://github.com/ultralytics) - A state-of-the-art object detection model used for vehicle detection in this project.
- [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) - A powerful OCR tool utilized for recognizing license plates.
- Original video (demoVideo.mp4) from YouTube: [YouTube Video Link](https://www.youtube.com/watch?v=3DLwGZv4tpQ&ab_channel=RICOMTECK-Vehicle%26PedestrianAccessControl).