Abs6187/Helmet_Detection_OCR_ANPR
1
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.txtUsage
- 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.pyDocker Deployment
docker build -t traffic-detection .
docker run -p 7860:7860 traffic-detectionContributing
- 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.
