Robust Traffic OCR with Qwen3-VL on AMD ROCm
An OCR system that reads licence plates and road signs from difficult images, running on AMD GPUs with ROCm.
It uses the open-source vision-language model Qwen3-VL-8B-Instruct (bf16, ~18 GiB VRAM) through Hugging Face Transformers on the mandated rocm/pytorch base image. A strict transcription prompt encodes the challenge rules: return only the plate number and drop state banners and slogans (CALIFORNIA, EXCELSIOR), keep the Chinese province character and letter (京A·12345), keep every word on signs (SPEED LIMIT 65), never add units, and join multi-line text top to bottom.
To handle adverse conditions, images are normalised (PNG/JPEG/TIFF, 16-bit, alpha, EXIF rotation) and resized. Dark, low-contrast or uncertain reads trigger a second pass on an enhanced image (denoise, contrast stretch, gamma, sharpen), and the more confident answer is kept. Deterministic post-processing removes labels, quotes and leaked state names and fixes full-width characters.
For speed, a persistent model server loads the model once at container start; each app.py call is a thin client, giving 0.3-1.2 s per image (10 images in 5 s). Hard timeouts guarantee no image ever exceeds the 30 s limit. Result: 10/10 on the sample set.