Applications - Replay
The application replay endpoint allows users to resubmit, or "replay", media in the Cogniac System, that is readable by them, through an application for new detections.
The replay endpoint provides the user the ability to choose which subjects' associated media to replay through the application, not limited to the subjects bound to the application, as well as filters based on time and subject-media association probability.
Argument | Example | Description |
---|---|---|
replay_subjects list | ["cat_1a", "bird_9g"] | (required) The list of subject_uids of the subject media to replay. Can be any subject that is readable by the authorized tenant. Several subjects can be replayed at once by passing multiple flags. One of replay_subjects or replay_media (see below) is required. |
replay_media string | "AJW63NCGIH4NTYVRME" | (required) The media ID of a single media item to replay. One of replay_subjects or replay_media is required. |
validation_only bool | True | (optional) Replay from validation set only. |
foci array | [{'box': {'x0': 0, 'y0': 50, 'x1': 100, 'y1': 150}}] | (optional) For replaying individual media, will replay media foci through the application. |
replay_order string | "first" | (optional) One of 'first', 'last', 'random', 'highest_probability', 'lowest_probability'. Determines the order of media to replay. first - replays media from earliest to latest. last - replays media from latest to earliest. random - replays media in a random order. highest_probability - replays media in the descending order of probability. lowest_probability - replays media in the ascending order of probability. Defaults to 'first'. |
probability_lower float | 0.75 | (optional) A lower bound for subject-media association probabilities to replay. Defaults to 0.0. |
probability_upper float | 0.90 | (optional) An upper bound for subject-media association probabilities to replay. Defaults to 1.0. |
time_lower float | 1643650235 | (optional) A lower limit of subject-media update timestamp to replay. |
time_upper float | 1643653191 | (optional) An upper limit of subject-media update timestamp to replay. |
limit int | 135 | (optional) A maximum limit of media items to replay. |
force_feedback boolean | True | (optional) True - force all replayed media detections to be surfaced for user feedback. False - replayed media detections will be surfaced for feedback based on application's current feedback-per-hour rate. Defaults to False. |
replay_filters list | [{"filter": "ocr", "ocr_string": "plane"}] | (optional) A list of replay filters. Currently only ocr filter is supported, {"filter": "ocr", "ocr_string": }. |
Send Replay Request
To replay media through an application, POST a replay request message to the application replay endpoint with appropriate replay flag set.
The POST response contains a list of replaying subjects as well as a map of replay specifications for each subject.
POST /21/applications/{app_ids}/replay
Host: https://api.cogniac.io
Example: Replay Media
curl -X POST https://api.cogniac.io/21/applications/di71rG94/replay \
-H "Content-Type: application/json" \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
-d '{
"replay_subjects": ["cat", "dog"],
"limit": 10,
"replay_order": "random",
"force_feedback": true
}'
import requests
my_headers = {"Authorization":"Bearer abcdefg.hijklmnop.qrstuvwxyz"}
replay_data = {
"replay_subjects": ['cat', 'dog'],
"limit": 10,
"replay_order": 'random',
"force_feedback": True
}
resp = requests.post("https://api.cogniac.io/21/applications/di71rG94/replay",
json=replay_data,
headers=my_headers)
print resp
Note, you can request replay of the same subject or media on multiple apps simultaneously by specifying a comma-separated list of application ids, for example, POST https://api.cogniac.io/21/applications/di71rG94,iOkJhg,uYheTh/replay.
Get Replay Status of a Single Replay
The current replay status of an application can be received via a GET call to the application replay endpoint.
GET /21/applications/{app_id}/replay/{replay_id}
Host: https://api.cogniac.io
Example: Retrieve Replay Status
curl -X GET https://api.cogniac.io/21/applications/di71rG94/replay/owirkj \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz"
import requests
my_headers = {"Authorization":"Bearer abcdefg.hijklmnop.qrstuvwxyz"}
resp = requests.get("https://api.cogniac.io/1/applications/di71rG94/replay/owirkj",
headers=my_headers)
print resp
Get Replay Status of All Active Application Replays
GET /21/applications/{app_id}/replay/active
Host: https://api.cogniac.io
Get Replay Status of last 100 Application Replays
GET /21/applications/{app_id}/replay
Host: https://api.cogniac.io
Stop Application Replay
DELETE /21/applications/{app_id}/replay/{replay_id}
Host: https://api.cogniac.io
Updated about 2 years ago