File size: 2,119 Bytes
7ced5c0
22280fb
7ced5c0
 
 
 
22280fb
7ced5c0
22280fb
 
 
 
 
7ced5c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

---
title: Thai License Plate Detection V1.2
emoji: πŸš—
colorFrom: blue
colorTo: green
sdk: streamlit
sdk_version: "1.29.0"
app_file: app.py
pinned: false
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# Thai License Plate Recognition App

This Streamlit application performs Thai license plate detection and recognition using deep learning models.

## Features

- License plate detection using YOLO
- Character recognition for Thai license plates
- Province name detection and recognition
- Real-time processing with visual feedback
- User-friendly web interface

## Setup

1. Install the required dependencies:
```bash
pip install -r requirements.txt
```

2. Download the required model files and place them in the `models` directory:
   - `best.pt` - YOLO model for license plate detection
   - `read_char.pt` - YOLO model for character recognition

3. Ensure the configuration file `config/data.yaml` is present with character mappings.

## Running the Application

To run the application:

```bash
streamlit run app.py
```

The application will be available at `http://localhost:8501` by default.

## Usage

1. Open the application in your web browser
2. Click the "Choose an image..." button to upload an image containing a Thai license plate
3. Wait for the processing to complete
4. View the results:
   - Detected license plate number
   - Detected province name
   - Visual detection results

## Models

The application uses three main models:
1. YOLO model for license plate detection
2. YOLO model for character recognition
3. TrOCR model for province text recognition (automatically downloaded)

## Directory Structure

```
streamlitapp/
β”œβ”€β”€ app.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ best.pt
β”‚   └── read_char.pt
└── config/
    └── data.yaml
```

## Notes

- The application requires an internet connection for the first run to download the TrOCR model
- Supported image formats: JPG, JPEG, PNG
- For optimal results, ensure the license plate is clearly visible in the image