Road-Scene OCR with Qwen3-VL on ROCm
A containerised OCR service that reads US and Chinese licence plates and road signs (stop, speed limit, advisory plaques, multi-line work-zone signs) with a vision-language model, Qwen3-VL-8B-Instruct in bf16, running on an AMD GPU with ROCm and Hugging Face Transformers.
Accuracy came from measured prompt engineering. A generic prompt scored 7/10 on the public samples, and every error was a formatting error: US plates returned the state banner with the number. A rule-based prompt that explains the transcription convention, without hard-coding any sample, reached 10/10, and 40/40 on a synthetic degraded set (noise, motion blur, low light with glare, tiny images).
The main engineering problem was the harness contract: it starts a new process for every image, with a 30 s limit. Loading the model inside app.py took up to 31 s, which would zero the whole run. The container entrypoint therefore starts a resident model server that loads and warms up the model once, during the start-up window. app.py is a stdlib-only HTTP client that answers in about 0.4 s and always writes its JSON before an internal 25 s deadline, even if the server fails. A HEALTHCHECK signals readiness.
The image is built on the mandated ROCm base with untouched layers (no squash). It is 45.7 GiB, with the weights baked in, and uses 16.3 GiB of VRAM.