Files
parking_solution/wiki/decisions/vision-service.md
T
julian 8a8e74561d wiki: design the business layer (session, tariff, permit, vision, shift, ops)
Pivot from the hardware/integrity layer to the parking operation. All
wiki-only; no code yet. Core principle throughout: business entities are
projections over the signed append-only event log, never mutable tables.

New concepts: parking-session, tariff (composable/versioned, FX-ready),
shift (manned-only Z-report), capacity-occupancy, validation-discounts,
reporting-analytics, clock-integrity, ticket-encoding, anti-passback.
New entities: permit, opencv-anpr-service, blocklist.
Decisions: session-model, vision-service (host-side ANPR + vehicle
verification; scoped AGPL exception for the isolated service).

Updates: append-only-event-chain (new event types + vision witness),
local-jwt-auth (drop 8h expiry -> until logout; code change pending),
lpr-camera (host-side recognition supersedes edge-AI), standing-decisions
(AGPL exception), open-questions (+FX, +pay-station money corners, backup).

Deferred + flagged: intercom/help-call, receipts/refunds/change, FX engine,
lane topology (#1).
2026-06-15 17:41:38 +02:00

3.4 KiB

type, tags, sources, updated, status
type tags sources updated status
decision
parking
decisions
vision
anpr
anti-fraud
2026-06-15 open

Decision: Host-side Vision Service (ANPR + vehicle verification)

Taken 2026-06-15, as part of the business-layer build (session-model).

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.
  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 + vehicle-model selection and accuracy targets; fingerprint method + anomaly threshold (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).