Media - Detections
  • 22 Dec 2023
  • 1 Minute to read
  • Dark
    Light

Media - Detections

  • Dark
    Light

Article summary

Media Detections

Detections are individual assertions made between a media object and subject. The media detections endpoint will return all subject-media assertions for the given media item.

Media Assertions

Assertions between subjects and media items can come from three sources:

  1. Authoritative user input from directly uploading media to a subject (see POST /subjects/{subject_uid}/media). In this case the detection object will have a user ID, but no application or model ID.

  2. User feedback through the context of an application feedback response. In this case the detection object will have both a user ID and application ID.

  3. Model assertion. In this case the detection object will contain a model ID and application ID, but no user ID.

Get Media Detections

EndpointEndpoint

GET /1/media/{media_id}/detections
Host: https://api.cogniac.io
curl -X GET https://api.cogniac.io/1/media/QBCYGH2LACG4IDFQLRXJVIE1BWWH/detections \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
| json_pp

import requests
import json
from pprint import pprint

url_prefix = 'https://api.cogniac.io'
api_version = "1"
media_id = '7GJW8T3VWS4XOU9MEW9IT6BYRGYR'
token = ''  # add your token here
headers = {'Authorization': f'Bearer {token}'} 

url = f'{url_prefix}/{api_version}/media/{media_id}/detections'
response = requests.get(url, headers=headers)

res = requests.get(url, headers=headers)

if res.status_code == 200:
    response_data = json.loads(res.content)
    pprint(response_data)
else:
    print(f"Error: {res.status_code}, {res.text}")

Example ResponseExample Response

{
  "detections": [
    {
      "app_data": null,
      "app_data_type": null,
      "app_id": null,
      "detection_id": "WOFMTULICZ:0",
      "model_id": null,
      "prev_prob": null,
      "probability": 0.999,
      "subject_uid": "cat_123",
      "timestamp": 1481809927.131971,
      "uncal_prob": null,
      "user_id": "user@cogniac.co"
    },
    {
      "app_data": null,
      "app_data_type": null,
      "app_id": "sdSB22k4",
      "detection_id": "WOFMTULICZ:0:0",
      "model_id": "Hpo-h-1ec0-to6oGrTAN9QeV6djep-CN_mtsv0_2000.tgz",
      "prev_prob": null,
      "probability": 0.5,
      "subject_uid": "dog_123",
      "timestamp": 1481809927.390357,
      "uncal_prob": 0.0000000000000248946032516649,
      "user_id": null
    }
  ]
}

Copy


Was this article helpful?

What's Next