Files
Heimdall/skills/vision-identity/SKILL.md
T
arnaud.dartois 636154572b
Heimdall Gitea / Detect CI scope (push) Successful in 6s
Heimdall Gitea / Build and tests (push) Successful in 19m19s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan server image (push) Successful in 6m13s
Heimdall Gitea / Build and scan agent image (push) Successful in 14m44s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 1m48s
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Successful in 19m9s
Heimdall Gitea / CI policy (push) Successful in 10s
Complete remaining Heimdall features and acceptance
Merge pull request #138

Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-06 11:14:49 +01:00

8.2 KiB

name, description
name description
vision-identity Implement Heimdall's opt-in, self-hosted plate OCR and preserve the licensing/privacy gates for camera face and plate identity.

Vision identity in Heimdall

Read AGENTS.md and FEAT-03/UI-02 in todo.md. Current API contract only supports a human-triggered OCR request with an operator-supplied JPEG/PNG plate crop. It does not infer plate boxes from video frames or recognize faces.

Plate OCR currently implemented

  • PlateOcr:Enabled defaults to false. Explicitly enable the on-prem Central option to offer OCR; the camera detail UI sends only the file the user selected.
  • Central uses the system Tesseract executable and English LSTM data. Tesseract engine and the official tessdata_best model data declare Apache-2.0. Do not add other OCR or detection weights without reviewing their exact asset licenses and provenance.
  • The controller requires a human principal with Camera.Write, camera scope, JPEG/PNG signature, configured byte limit (at most 512 KiB), and rate limits. OCR rejects malformed, oversized, or over-4-megapixel crops and times out after a bounded interval.
  • OCR runs on the Heimdall Central host. The image is written to a random temporary path and deleted in finally; do not log the crop, extracted text, embedding, or raw image path.
  • Store only the normalized plate candidate, confidence, and a LicensePlateDetected event. The API may return a unique exact vehicle/person as a suggestion, but it does not persist identity links during OCR. CameraDetail presents the suggestion for operator review; the operator must explicitly confirm a vehicle. The confirmation API requires a human principal with both camera and vehicle write permissions, verifies access to the camera, the event-to-observation association, and an exact normalized plate match, and writes the observation/event links together. Never treat OCR output as verified identity.
  • OCR observations remain unassigned until a human confirms an association; unassigned plate rows are purged after 30 days. CleanupLicensePlatesJob also removes LicensePlateDetected events older than 30 days, including their label and metadata. If an event has stored snapshots, it deletes those objects from the exact captured destination before deleting the database row. Events with missing/incomplete storage provenance are retained with a warning rather than deleting from a guessed destination. Vehicle-owned plate records remain governed by their explicit vehicle lifecycle. Keep the wider privacy review open before production enablement.

Face-model gate

ONNX Runtime is already used by the Agent and is MIT licensed. A model runtime license does not grant rights to a particular model's weights or training data. InsightFace's model-zoo documentation restricts its distributed pretrained weights to non-commercial research. ONNX Model Zoo's ArcFace/UltraFace listing points to sourced models but does not establish one blanket weight/data license. Do not bundle SFace, ArcFace, YuNet, or plate-detector weights unless the exact asset and training-data rights are reviewed. An operator-provided model also needs a documented tensor/preprocessing contract, stable model ID stored with enrollments, explicit opt-in, deletion/retention semantics, and representative accuracy testing before face matches can create events.

Official sources reviewed:

Human confirmation workflow

  • Keep mismatches and ambiguous candidate lists unlinked until an operator selects a vehicle and confirms.
  • Confirm with the observation ID, event ID and selected vehicle ID; reject anonymous or camera-scoped requests, mismatched plates, unrelated events, and conflicting existing links.
  • Preserve the matching UI/API behavior with component/controller tests and handler tests. API authorization and camera scope stay at the Web boundary; the application handler independently checks camera access before persistence.

Acceptance

  1. Local targeted tests passed: PlateOcrTests 4/4, CameraDetailTests 6/6, PlateRecognitionControllerTests 1/1. These unit/component tests do not replace a browser-driven UI test.
  2. Compose source build passed in isolated project hmd-plate-20261105094933-31487. It used a generated database/JWT credential set, unused 127.0.0.1 ports, unique network/image/project, and project-scoped volumes. PlateOcr was enabled only through a temporary Compose override. The synthetic-plate.png fixture returned AB-123-CD with Tesseract confidence 0.912 through the authenticated multipart API; /api/events page 1 contained the created event. The historical entry does not record removal and exact-tag absence verification for the image; treat this recipe's image cleanup as unverified and repeat it before relying on that portion of acceptance.
  3. The invalid JPEG signature returned HTTP 400. PostgreSQL inspection confirmed the plate observation and history event were persisted with no Person/Vehicle link and no event snapshot. The random OCR temp path was absent after processing.
  4. down --volumes --remove-orphans cleanup verified containers=0 volumes=0 networks=0. The historical record for this bootstrap does not name a locally built image tag or document an exact image absence check; treat image cleanup as unverified and repeat it before relying on that part of the acceptance. The first admin bootstrap also called the existing HaveIBeenPwned breach checker with a generated synthetic password; that code uses k-anonymity, so the Compose exercise was not fully offline. No real password, camera, image, or release secret was used.
  5. Human confirmation acceptance passed in source-built disposable project hmd-plate-link-1793880442-bff1ca: the synthetic OCR crop returned AB-123-CD at confidence 0.912; a vehicle with another plate was rejected with HTTP 422; PostgreSQL showed both links null before confirmation; explicit confirmation returned 200 and both license_plates.VehicleId and camera_events.VehicleId were populated; anonymous confirmation returned 401. Cleanup verified zero containers, volumes and networks and removed/verified absence of the exact heimdall:hmd-plate-link-1793880442-bff1ca-central image tag. Two earlier recipe attempts had harness-only readiness/SQL identifier mistakes; each exact project and tag was cleaned and absence checked.
  6. Keep assigning the locally built Central image a unique project tag and remove/verify that exact tag on every recipe completion, including failure paths. Retain shared .NET/ASP.NET base images and never use broad image pruning.
  7. These acceptances cover one synthetic crop and the API persistence/confirmation path only. They do not establish OCR accuracy in real scenes, video plate detection, face recognition, browser-driven upload behavior, camera hardware behavior, or the suitability of the retention period under an external privacy review.
  8. Plate-event retention is covered by CleanupLicensePlatesJobTests (SQLite: expired plate event removed, recent plate and unrelated events retained; captured snapshot objects removed first; storage deletion failure retains the event) and PlateEventRetentionPostgresTests (PostgreSQL EF translation/deletion). The disposable Compose project hmd-plate-retention-pg-1793885533-16210 ran the PostgreSQL test from the mounted changed source with locked restore, generated credentials, and project-scoped database/NuGet volumes; result 1/1. Teardown removed and verified zero project containers/volumes/networks. The recipe builds no Heimdall image; shared PostgreSQL/SDK base images are retained. This validates the local retention mechanics, not the external privacy policy or any production retention requirement.