File size: 2,114 Bytes
1a2f286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
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

1. Clone the repository:
```bash
git clone <repository-url>
cd <repository-name>
```

2. Create and activate a virtual environment:
```bash
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
```

3. Install dependencies:
```bash
pip install -r requirements.txt
```

## Usage

1. Start the application:
```bash
python app.py
```

2. Open your web browser and navigate to:
```
http://localhost:7860
```

3. 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 model
- `ANPR_IND/licence_character.pt`: Character recognition model
- `Helmet-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
```bash
python app.py
```

### Docker Deployment
```bash
docker build -t traffic-detection .
docker run -p 7860:7860 traffic-detection
```

## Contributing

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a new Pull Request

## License

This project is licensed under the MIT License - see the LICENSE file for details.