A comprehensive YOLO-based system for detecting and reading Vietnamese license plates from images and live camera feeds. This project combines two deep learning models: one for plate detection and another for character recognition.
- Real-time License Plate Detection: Uses YOLOv8 to detect license plates in live camera feeds
- Character Recognition: Reads and extracts text from detected license plates
- Automatic Cropping: Saves high-confidence detections for further analysis
- GPU/CPU Support: Optimized for both GPU and CPU inference
- Batch Processing: Process multiple images at once
- Confidence Thresholding: Configurable confidence levels for detection and cropping
├── README.md # This file
├── TRAINING_SUMMARY.md # Training progress and results
├── requirements.txt # Python dependencies
│
├── Training Scripts/
│ ├── plate_train.py # Train the license plate detection model
│ └── reader_train.py # Train the character recognition model
│
├── Detection & Recognition/
│ ├── cropped_camera_detector.py # Real-time camera detection with cropping
│ ├── gpu_detector.py # GPU-optimized batch detection
│ ├── predict_plates.py # Standalone plate prediction
│ └── reader_plates.py # Character recognition from cropped plates
│
├── Models/
│ ├── yolo11n.pt # Pre-trained YOLO11 base model
│ ├── yolov8n.pt # Pre-trained YOLOv8 base model
│ └── yolo_training/ # Trained model weights
│ ├── vnlp_model7/ # Vietnamese license plate detection model
│ ├── LPR_model1/ # License plate reader model v1
│ └── LPR_model2/ # License plate reader model v2
│
├── Datasets/
│ ├── VNLP yolov8/ # Vietnamese license plate dataset
│ └── LP reader yolov8/ # Character recognition dataset
│
├── Output/
│ ├── detected_plates/ # Cropped license plates (high confidence)
│ ├── read_detected_plates/ # Processed plates with recognized text
│ ├── batch_predictions/ # Batch processing results
│ └── runs/ # Training logs and metrics
│
└── Resources/
├── Photos/ # Test images
└── Videos/ # Test videos
- Python 3.8+
- CUDA (optional, for GPU acceleration)
- Clone this repository:
git clone <repository-url>
cd Prototype4-Yolo- Install dependencies:
pip install ultralytics opencv-python torch torchvision numpy pillow- Ensure you have the trained models in the
yolo_training/directory
Detect and crop license plates from live camera feed:
python cropped_camera_detector.py- ESC: Exit the application
- SPACE: Pause/Resume detection
- Automatically saves high-confidence detections to
detected_plates/
Read text from detected license plates:
python reader_plates.py- Processes all images in
detected_plates/ - Outputs annotated images to
read_detected_plates/
Process multiple images efficiently:
python gpu_detector.pyTest the model on a single image:
python predict_plates.pypython plate_train.py- Uses Vietnamese license plate dataset (
VNLP yolov8/) - Trains YOLOv8 to detect license plate regions
- Saves model to
yolo_training/vnlp_model*/weights/best.pt
python reader_train.py- Uses character-level dataset (
LP reader yolov8/) - Trains YOLOv8 to recognize individual characters
- Saves model to
yolo_training/LPR_model*/weights/best.pt
confidence_threshold: Minimum confidence for displaying detections (default: 0.5)crop_threshold: Minimum confidence for saving crops (default: 0.9)plate_model_path: Path to plate detection modelchar_model_path: Path to character recognition model
- Plate Detection:
yolo_training/vnlp_model7/weights/best.pt - Character Recognition:
yolo_training/LPR_model2/weights/best.pt
- Architecture: YOLOv8n
- Dataset: 1,005 Vietnamese license plate images
- Classes: 1 (license plate)
- Architecture: YOLOv8n
- Classes: Alphanumeric characters (A-Z, 0-9)
- Purpose: Extract text from cropped license plates
- Input: Live camera feed or image
- Detection: Plate detection model identifies license plate regions
- Cropping: High-confidence detections are cropped and saved
- Recognition: Character recognition model reads text from cropped plates
- Output: Annotated frames with license plate text
ultralytics>=8.0.0
opencv-python>=4.5.0
torch>=1.9.0
torchvision>=0.10.0
numpy>=1.21.0
pillow>=8.0.0- Model not found: Ensure trained models exist in
yolo_training/directory - CUDA errors: Install CUDA-compatible PyTorch version
- Camera not detected: Check camera permissions and connections
- Low accuracy: Retrain models with more diverse datasets
- GPU: Use
gpu_detector.pyfor faster batch processing - CPU: Reduce batch size for memory constraints
- Confidence: Adjust thresholds based on accuracy requirements
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Ultralytics YOLO for the base detection framework
- Vietnamese license plate dataset contributors
- OpenCV community for computer vision tools
For questions or support, please open an issue in this repository.
Note: This system is designed for educational and research purposes. Ensure compliance with local privacy laws when using with live camera feeds.