A newer version of the Gradio SDK is available:
5.49.1
metadata
license: mit
title: Helmet_Detection_OCR_ANPR
sdk: gradio
emoji: π
colorFrom: red
colorTo: yellow
short_description: Helmet_Detection_OCR_ANPR
Combined ANPR and Helmet Detection System
A comprehensive traffic violation detection system that combines Automatic Number Plate Recognition (ANPR) and Helmet Detection using YOLOv8.
Features
- Real-time license plate detection and recognition
- Helmet detection for two-wheeler riders
- Modern Gradio interface with real-time processing
- Adjustable confidence threshold for detection
- Combined visual annotations from both models
- Queue support for multiple users
- Comprehensive error handling
Prerequisites
- Python 3.8 or higher
- CUDA-capable GPU (recommended for better performance)
- 8GB RAM minimum
Installation
- Clone the repository:
git clone <repository-url>
cd <repository-name>
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
Usage
- Start the application:
python app.py
- Open your web browser and navigate to:
http://localhost:7860
- Upload an image or use the example images to test the system.
Model Files
The following model files are required:
ANPR_IND/licence_plat.pt
: License plate detection modelANPR_IND/licence_character.pt
: Character recognition modelHelmet-Detect-model/best.pt
: Helmet detection model
API Endpoints
The application exposes the following endpoints:
/api/predict
: POST endpoint for image processing/api/health
: GET endpoint for health check
Deployment
Local Deployment
python app.py
Docker Deployment
docker build -t traffic-detection .
docker run -p 7860:7860 traffic-detection
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.