File size: 1,801 Bytes
0c49241
 
 
 
 
 
 
 
 
 
 
 
 
49d297d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Thai License Plate Detection
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 Detection App πŸš—

This Streamlit application detects and recognizes Thai license plates and provinces from images. It uses YOLOv8 for object detection and TrOCR for text recognition.

## Features

- πŸ“· Upload images containing Thai license plates
- πŸ” Detect and extract license plate numbers
- 🏠 Recognize and match province names
- πŸ–ΌοΈ Display cropped regions of detected plates and provinces
- 🎯 High accuracy text recognition using TrOCR

## How to Use

1. Upload an image containing a Thai license plate using the file uploader
2. Wait for the processing to complete
3. View the results:
   - Detected license plate number
   - Cropped license plate image
   - Detected province name
   - Cropped province image

## Technical Details

The application uses:
- YOLOv8 for license plate and province detection
- TrOCR (Thai) for text recognition
- OpenCV for image preprocessing
- Levenshtein distance for province name matching

## Models

- Object Detection: YOLOv8 (custom trained for Thai license plates)
- Text Recognition: openthaigpt/thai-trocr

## Deployment

This app is deployed on Hugging Face Spaces. The deployment includes:
- Streamlit web interface
- Pre-trained YOLO model weights
- Required Python dependencies

## Requirements

All required packages are listed in `requirements.txt`. The main dependencies are:
- streamlit
- opencv-python-headless
- transformers
- ultralytics
- torch
- python-Levenshtein

## License

[Your chosen license]

## Credits

Created by [Your Name/Organization]