Files
julian dd2dd53d7e wiki: H.264 test on park-lab, event-driven refactor decided
- zone-anpr-poc: H.264 instead of MJPEG (load, delay, a car in the zone,
  staff traffic, bad weather); the relay-less test copy is left running
- event-driven-refactor (new): the user's decisions of 2026-11-23, what
  is not decided, what they touch in today's code; waits for the user's
  guidelines
- passage-confirmation: the 2026-11-19 phase order superseded; where the
  video work lives
- vision-hardening, zone-anpr-poc-review: on-screen label read as a
  plate (moved by the user), day-time oversized box, still pause carried
  over
- pointers on vision-service, camera-live-view, lane-presence-and-anpr-entry,
  dingtian-vs-mqtt, entry gates, standing decisions, open questions,
  overview, index

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RZgP5oZdzvo92Eouc9eRv5
2026-11-23 12:02:18 +01:00

76 lines
4.6 KiB
Markdown

---
type: decision
tags: [parking, decisions, vision, anpr, anti-fraud]
sources: []
updated: 2026-11-23
status: open
---
# Decision: Host-side Vision Service (ANPR + vehicle verification)
Taken 2026-06-15, as part of the business-layer build ([[session-model]]).
> **2026-11-23:** decision 3 below (the Node backend calls the service over localhost HTTP, with
> pictures the camera driver pulled) is to be replaced: the user decided that the server holds no
> video or image work and that the vision side talks to the cameras
> ([[event-driven-refactor]]). Not built; the page describes what runs today. The fallback to
> the ticket path when the service is unavailable stays as it is.
## Decisions
1. **Build a host-side vision service** ([[opencv-anpr-service]]) that does ANPR (plate → identity)
**and** vehicle-attribute verification (anti-spoofing witness) on snapshots from ordinary
Hikvision/Dahua cameras.
2. **It replaces the dedicated edge-AI [[lpr-camera]]** as the recognition path: ordinary IP cam →
snapshot (`Snapshot.bytes`, already pulled by the camera driver) → vision service → plate +
vehicle. Removes the special LPR camera from the [[bom]] as a requirement (still allowed as an
option).
3. **Deployment: a separate local Python/OpenCV microservice** on the appliance, called over
**localhost HTTP** by the Node backend. Fully offline ([[offline-first]]); its own process and
failure domain; the host falls back to the ticket path if it's unavailable. **Source lives in THIS
monorepo at `apps/vision/`, wired into Turbo via a thin `package.json` shim** — separate *process*,
co-located *source*; see [[vision-service-packaging]].
4. **Licensing exception:** AGPL components (e.g. YOLO plate/vehicle models, OpenALPR) are
**permitted inside this service only**, because it's a separate process not linked into the app —
the app stays strictly MIT/Apache/BSD. Amends [[standing-decisions]].
5. **Recognition is advisory, evidence is authoritative.** A read never single-handedly authorizes
a paid/access barrier open; it flags for [[reconciliation]] and attaches (with the source image)
to the signed [[append-only-event-chain]] entry. Low confidence → fallback, never strand a car
([[fail-state-safety]]).
## Why
- **Replace vs. edge-AI camera:** host-side recognition on cheap IP cams shifts cost from per-lane
smart cameras to one compute box + our software; gives us the raw image for the second job below.
- **Vehicle verification is the real prize (user-driven, 2026-06-15):** plate-only ANPR can't catch
a **printed/spoofed plate on a different car**. Extracting vehicle attributes/fingerprint lets the
system reconcile *the car*, not just the number — directly filling the independent-witness gap the
[[append-only-event-chain]] calls out as unbuilt.
- **Separate-process + AGPL-scoped** keeps the app's permissive-license guarantee intact while not
crippling accuracy (the strict permissive-only ANPR path is markedly weaker — that tradeoff was
weighed and the scoped exception chosen).
## Rejected / alternatives
- **Strict permissive-only ANPR in-app** — license-clean but weaker accuracy and more build; the
separate-process AGPL exception was chosen instead.
- **Keep the edge-AI LPR camera as primary** — viable fallback if host-side accuracy disappoints;
not chosen now, kept on the table in [[opencv-anpr-service]].
- **Embed OpenCV in Node** (opencv4nodejs/WASM) — rejected: native-build pain, weaker model
ecosystem, no process isolation, shares the app's failure + license surface.
## Open / next
- Recognizer selection: **fast-alpr (MIT, YOLOv9 detector + CCT OCR on ONNX Runtime) is the evaluated
baseline** as of 2026-06-19 — fits this decision's shape (separate offline localhost process,
swappable) and is permissive end-to-end, so the ANPR path may not need the AGPL exception (pending a
model-**weight-provenance** check). Plate-only: it does NOT cover the vehicle-verification job. Open:
the provenance check + an accuracy benchmark on real Albanian plates (default global vs. the 40+
country EU model). See [[opencv-anpr-service]] "Recognizer evaluation".
- Vehicle-model selection + fingerprint method + anomaly threshold (the Job-2 anti-spoofing stage,
still ours to build on the same ONNX runtime) ([[opencv-anpr-service]]).
- Appliance compute footprint (CPU vs. small GPU/NPU) — [[bom]] / [[open-questions]].
- Service API + the Node-side adapter; per-camera opt-in wiring.
- Reconciliation logic that consumes plate+vehicle witness vs. commanded opens (still unbuilt — see
[[append-only-event-chain]], [[reconciliation]]).