Building a real-time license plate detection system using YOLOv8 and EasyOCR
- Overview
- Features
- System Architecture
- Installation
- Usage
- Project Structure
- Development Progress
- Technical Details
I'm working on an ALPR system that can automatically detect and read license plates from images and videos in real-time. The goal is to create something that works well in different lighting conditions and camera angles - basically making it robust enough for real-world use.
This project tackles the challenge of automated vehicle identification, which has practical applications in parking management, traffic monitoring, and security systems.
- Real-time processing: Works with live video feeds
- Custom trained model: Built using 11,776+ CCPD dataset images for high accuracy
- Handles Chinese plates: Specialized character recognition for Chinese license plates
- Weather resistant: Performs well across different lighting and environmental conditions
- Modular design: Easy to integrate into existing systems
- Well documented: Includes detailed exploration notebooks showing the development process
The system works in stages:
- Data Processing: I explored and converted the CCPD dataset to YOLO format
- Detection Module: Custom YOLOv8 model finds license plates in images
- Recognition Module: EasyOCR extracts the actual text from detected plates
- Pipeline Integration: Everything works together seamlessly
- User Interface: Planning a Streamlit dashboard for easy interaction
- Python 3.8 or higher
- A decent GPU helps (but not required - I optimized for CPU training too)
- At least 8GB RAM if you want to train from scratch
- Get the code
git clone https://github.com/yourusername/alpr-system.git
cd alpr-real-time- Set up your environment
python -m venv alpr_env
source alpr_env/bin/activate - Install everything
pip install -r requirements.txtfrom src.detect_plate import LicensePlateDetector
# Setup the Detector
detector = LicensePlateDetector()
# Load the trained model
detector.load_model('models/license_plate_detection/best.pt')
# Detect plates in your image
results = detector.detect_plates('path/to/image.jpg')jupyter notebook notebooks/01_ccpd_exploration.ipynb- Project setup and environment configuration
- CCPD dataset exploration and analysis (11,776 images)
- Dataset conversion pipeline (CCPD β YOLO format)
- YOLOv8 training pipeline implementation
- Model training completed with 99.5% mAP50 accuracy
- CPU-optimized training configuration
- Professional project documentation
- Model Performance: 99.5% mAP50 accuracy achieved in 4 epochs
- Training Method: YOLOv8n with early stopping (patience=10)
- Dataset: 11,776 CCPD images with Chinese license plates
- Status: Production-ready model available at
models/license_plate_detection/yolov8_ccpd_optimized/weights/best.pt
- OCR integration with EasyOCR
- Complete ALPR pipeline (YOLOv8 β OCR β Text extraction)
- 95% OCR confidence achieved on test license plates
- Energy-efficient testing framework with model reuse
- End-to-end license plate text recognition working
- OCR Performance: 95% confidence on synthetic test plates
- Pipeline Status: YOLOv8 detection + EasyOCR text extraction functional
- Language Support: English and Chinese character recognition
- Implementation:
src/ocr_reader.pywith preprocessing and error correction - Testing: Comprehensive test suite in
src/test_ocr.py - Character Accuracy: Handles common OCR errors (Oβ0, Iβ1, Sβ5, Zβ2)
- Video processing pipeline implementation
- Enhanced testing framework with video capabilities
- Test video generation for development and validation
- Live camera feed processing integration
- Frame-by-frame license plate detection in video streams
- Video Support: MP4 file processing with configurable frame skipping for performance
- Live Camera: Real-time webcam integration with detection visualization
- Test Generation: Synthetic video creation with moving license plates for validation
- Performance: Optimized processing every 3rd frame for real-time capability
- Implementation: Extended
src/utils.pywith video utilities and enhancedsrc/test_ocr.py - Processing Results: Successfully detecting and reading license plates in video sequences
- Streamlit dashboard interface development
- Real-time video stream integration with web interface
- Detection history and logging system
- Performance metrics dashboard
- User interface for video upload and processing