Asset Label Photo Matching
Updated: 2026-05-29
New system for matching label photos (serial numbers, barcodes, QR codes) against the assets database.
Normalization
classify_makes.py contains normalize_identifier() which:
- Strips label prefixes (
S/N:, ID#, Machine ID:, Monyx ID, etc.)
- Removes dots, dashes, spaces, slashes, colons
- Uppercases, keeps alphanumeric only
Examples:
"2500.0100.0025534" → "2500010000255534"
"S/N: 2500.0100.0025534" → "2500010000255534"
"RY10006338" → "RY10006338"
DB Matching
find_asset_by_normalized_id() searches across serial_number, connect_id, equipment_id, machine_id, and barcode columns — normalizing all before comparing.
OCR Pipeline (priority order)
- Ollama vision model (qwen2.5vl:3b) — runs on Windows gaming PC (192.168.0.181) via persistent SSH tunnel (systemd
ollama-tunnel.service on localhost:11434). Most accurate. Resizes images to 640x480 before sending.
- Tesseract (pytesseract) — local fallback, only used if Ollama is unavailable.
Response includes ocr_source field ("ollama" or "tesseract").
API Endpoints
POST /api/ocr
Existing photo upload endpoint enhanced. Now returns matched_assets and ocr_source in addition to the legacy machine_id field. Ollama takes priority over Tesseract.
POST /api/match-text
New endpoint for client-side processing:
Returns {raw_text, matched_assets[], match_count}.
CLI Tool
Windows PC Setup
- Host: gamingpc (100.84.53.121 / 192.168.0.181)
- Service: Ollama with qwen2.5vl:3b model
- Connection: SSH tunnel via systemd
ollama-tunnel.service
- Auth: SSH key at
~/.ssh/id_comfyui
- Tunnel:
ssh -N -L 11434:127.0.0.1:11434 gamingpc
- Auto-start:
sudo systemctl enable ollama-tunnel.service
Results with qwen2.5vl:3b on test photos:
| Photo |
Raw Text |
DB Match |
| Keurig label |
S/N: 2500.0100.0025534 |
✅ Asset #5144 (636671 / 956 Cypress Way) |
| Coca-Cola cooler |
2010378A00039 / RCUCC095.6 |
❌ Not in DB (bottler tags) |
| Telemetry device |
ID# 44343331624226353 / Monyx ID 48602143 |
❌ Not in DB (GPS tracker) |