Custom video analytics API

Ask a specific question about a camera image through the Kirkwood API.

What it detects

Try an image question that is not in the standard tag catalog.

Camera setup

Send a plain question in custom_questions and put relevant site information in context. Keep the question about what the image can show.

Send a camera image.

Set KIRKWOOD_API_KEY on your server. Save a frame as frame.jpg.

Python POST /v1/analyze
import base64
import json
import os
import urllib.request

with open("frame.jpg", "rb") as frame:
    image = base64.b64encode(frame.read()).decode()

body = json.loads('''{
  "images": [
    "<BASE64_JPEG>"
  ],
  "context": "Factory floor. Hard hats are required in this work area.",
  "custom_questions": [
    {
      "id": "hard_hat",
      "question": "Is a worker missing a hard hat?"
    }
  ],
  "detections": {
    "return_boxes": true
  }
}''')
body["images"] = [image]
request = urllib.request.Request(
    "https://app.kirkwood.ai/v1/analyze",
    data=json.dumps(body).encode(),
    headers={
        "Authorization": "Bearer " + os.environ["KIRKWOOD_API_KEY"],
        "Content-Type": "application/json",
    },
    method="POST",
)
with urllib.request.urlopen(request, timeout=120) as response:
    print(json.dumps(json.load(response), indent=2))

Read the result

The custom_questions field returns an answer and p_yes under the id you supplied. You can request catalog tags alongside the custom question.

Try it on your footage.

Upload an image and enter your custom question. Run analysis.

Approved account required. Analysis uses credit. Images are retained for annotation and training.

Open the live Playground

API pricing

Billed per image analyzed. Contact us for your rate.

Request pricing

Before you integrate

Custom questions are experimental. Test the wording and camera conditions for each use case; this does not make an arbitrary requested analytic a validated detector.

Do I need to train a new model to try a question?

No retraining is needed to submit a custom question. Its suitability still needs testing on your footage before it is used in an operational workflow.

API guide