Skip to content
DevLab

Baseline

A reference capture per person that calibrates every protocol. Engine recommends it, warns when it is missing, and never blocks without it.

On this page
  1. What it is
  2. Before any protocol
  3. Check it
  4. Capture it
  5. With the SDK
  6. Limits

A baseline is a short reference capture of one person. Engine keeps one per user, shared by every protocol, and uses it to calibrate that person’s indicators. Without it, only population calibration applies.

Capture the baseline before the first protocol capture, and again when it expires. Engine does not block a capture without a baseline: every enrolment response carries a baselineWarning instead.

JSON
{
"baselineWarning": {
"missing": true,
"expired": false,
"invalid": false,
"message": "No baseline found for this user."
}
}
baselineWarning Meaning What to do
null A valid, current baseline exists Nothing
missing: true The user has no baseline Capture one
invalid: true The last capture was not good enough Capture a new one
expired: true It is older than expiryDays Capture a new one

After a valid baseline, the same enrolment answers:

JSON
{ "baselineWarning": null }
Shell
curl -s "$ENGINE/users/$EXT/baseline" -H "Authorization: Bearer $TOKEN"
JSON
{ "isValid": true, "status": "valid", "expiryDays": 7 }

isValid is true only when the baseline is current and valid. Read expiryDays from the response: it is a setting of the environment, not a constant. A user without a baseline answers:

JSON
{ "status": 404, "body": { "code": 404, "message": "No baseline found for this user." } }
Response State What to do
404 No baseline Engine measures anyway, with population calibration, and warns
200 · isValid: true Valid Days left: lastUpdatedAt + expiryDays − now
200 · isValid: false · status: "invalid" Insufficient quality Capture a new one
200 · isValid: false · status: "valid" Expired Capture a new one

In Engine’s current implementation (pending confirmation by Engine), the baseline discounts the person’s resting expression from Joy, Sadness, Surprise, Anger, Disgust, Fear and Neutral (and from what depends on them, such as Frustration) and does not change Valence or Arousal. See it, and capture one, in the playground.

POST /users/{externalId}/baseline takes frames in the same format as POST /process-kpn-emo, without step, protocolMechanicId or triggerAnalysis. Split the capture into batches numbered from 1 and mark the last one Final. The baseline is computed when the Final arrives and no batch is missing; the last 202 tells you so:

JSON
{
"status": "accepted",
"framesWithoutFeaturesMeta": 0,
"packetsReceived": 10,
"packetsExpected": 10,
"missingOrders": []
}

A baseline is never interpreted and has no results of its own. You do not enrol people in the Baseline protocol: the capture creates what it needs. The sample capture of the quickstart also works as a baseline, without its step.

JavaScript
const info = await client.getBaselineInfo(userId) // null: none yet
// also recaptures when it is invalid or expired (isValid: false)
if (!info || !info.isValid) await client.captureBaseline({ userId, source: { type: 'webcam' } })

Engine computes it in the background: read it again until it is there (On-device (real time)).

  • Engine applies the baseline whenever one exists, whatever its status, including invalid. A new capture that comes out invalid does not replace a valid baseline; if there is none, it becomes the stored baseline and is applied.
  • The baseline must come from the same person you measure; in the playground, that means the same person and the same source (camera or synthetic sample).
  • Do not run two baseline captures of the same person at once.
  • The results of a capture do not say whether a personal baseline was applied.