OCR-assisted department candidate prototype

This experiment reads a manually selected text line using Microsoft's TrOCR, then compares the raw output with four department names. It does not insert Taftville as the answer. It reports a tentative candidate only when the string similarity is >=0.70 and leads the next name by >=0.20. Similarity is not a calibrated confidence score.

Two actual crops produced TAPTYILE and FTYILLE. Both are closest to Taftville among Taftville, Yantic, Occum and Laurel Hill. This is a proof of concept, not a validated department detector. Short/noisy readings and unrecognized names return Department unreadable. A known-name list can bias matching; test other departments and unrelated text before trusting it.

The full fire truck app and website demo remain generic, without department identification. This prototype is separate and needs manually selected coordinates; automatic text localization and tracking remain future work.

Dependencies: PyTorch, Pillow, transformers<5, sentencepiece, protobuf. First model load downloads microsoft/trocr-small-printed (about 250 MB). The existing firetruck-demo environment on this computer already has these installed.

Example:
python recognize.py --image /path/to/frame.jpg --roi 35 377 160 28 --output results/example

ROI is x, y, width, height in original image pixels. Save separate output folders for separate examples. Files include result.json (raw OCR plus candidate), lettering.png (crop), and evidence.jpg (annotated source).

Model source: https://huggingface.co/microsoft/trocr-small-printed

To reproduce the included examples in a separate environment:
python -m pip install -r requirements.txt
python recognize.py --image example-1/source.jpg --roi 35 377 160 28 --output results/example-1
python recognize.py --image example-2/source.jpg --roi 0 340 155 38 --output results/example-2

The example outputs were verified using the existing Linux CPU environment. Models are downloaded, not bundled. This prototype has not been tested on Windows or macOS.
