Skip to content

Contracts CodeProject AI

Zlatko Lakisic edited this page Aug 3, 2026 · 1 revision

Contracts — CodeProject.AI

Base: http://<ai-server>:32168
Transport: multipart form POSTs
Status: VERIFIED — face miss returns userid: "unknown" in predictions (2026-08-02)

CPAI vision flow


Object detection

POST /v1/vision/detection
  image           file
  min_confidence  float

Expected shape:

{
  "success": true,
  "predictions": [
    {"label":"person","confidence":0.91,"x_min":120,"y_min":40,"x_max":410,"y_max":700}
  ],
  "inferenceMs": 31,
  "processMs": 44
}

Bridge only cares about predictions[].label == "person" above vision.person_confidence.


Face recognition

POST /v1/vision/face/recognize
  image           file
  min_confidence  float
{
  "success": true,
  "predictions": [
    {"userid":"zlatko","confidence":0.87,"x_min":180,"y_min":60,"x_max":320,"y_max":240}
  ]
}

Miss shape (verified)

A face present but not enrolled returns userid: "unknown" (with a box), not necessarily an empty array. Still handle empty arrays / success: false defensively.


Face registration & list

POST /v1/vision/face/register
  userid   string
  image1   file
  imageN   file

POST /v1/vision/face/list
→ {"success":true,"faces":["zlatko", ...]}

Operator flow: Vision & Face Enrollment.


Error handling contract

Condition Behaviour
Non-2xx or success:false Treat as no detection — never crash the poll loop. Log warn, continue.
Timeout 2000 ms detection, 3000 ms recognize
Three consecutive failures Emit vision.degraded, drop to ambient_fps, subtle kiosk indicator

Vision degraded behaviour


Load protection

Recognize runs when a person is present and identity is unresolved or expired — not per frame. Recognize-per-frame works in a 30-second test and melts the GPU queue in production.

Fixtures live in docs/fixtures/cpai_*.json.


Related pages

Clone this wiki locally