Update AOIs for an existing video and return calculated metrics.
This endpoint differs from the POST /{media_id}/aois/static endpoint:
POST /{media_id}/aois/staticstarts a background static AOI calculation
on the video. It queues the computation viaVideoStaticAOIPredictionand
returns HTTP 202 with a simple{"detail": ...}message once the job has
been accepted. No AOI metrics are returned in that response.PUT /{media_id}/aoisperforms a synchronous AOI calculation using the
already available video results (video.results["saliency"]).
It calls the externalvideo_aoi_serviceand returns HTTP 200 together
with the full calculation output.
Response:
- On success, returns HTTP 200 with a body matching the
VideoAOIsCalculationResponseschema, containing the calculated AOI
results for the submitted AOIs and frame ranges, along with associated
metadata. - On error, returns an appropriate HTTP status with a
Detailpayload.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
This endpoint differs from the POST /{media_id}/aois/static endpoint:
The POST /{media_id}/aois/static starts a background static AOI calculation on the video. It queues the computation and returns HTTP 202 with a simple {"detail": ...} message once the job has been accepted. No AOI metrics are returned in that response.
The PUT /{media_id}/aois performs a synchronous AOI calculation using the already available video results. It calls the newest video AOI model service and returns an HTTP status of 200, together with the full calculation output. On success, tis endpoint returns a body containing the calculated AOI results for the submitted AOIs and frame ranges, along with associated metadata. On error, it returns an appropriate HTTP status with a Detail payload.
Pre-requisites
You must have an existing video with an associated media_id and the prediction status as done.
Use the media_id to send the PUT request to the endpoint /predict/v2/videos/media_id/aois/static
Expected request payload
For each Area of Interest (AOI), there need to be , at least, 3 points, with both x (horizontal) and y (vertical) coordinates, so that a triangle, rectangle, or polygon can be set as the AOI.
Note: The coordinates for the points must be values within the interval 0 and 1, because it corresponds to the position relative to the with or height of the image, so values like -0.3 or 1.56 will not be valid.
{
"aois": [
{
"points": [
{
"x": 0.7,
"y": 0.2
},
{
"x": 0.7,
"y": 0.5
},
{
"x": 0.9,
"y": 0.5
},
{
"x": 0.9,
"y": 0.2
}
],
"name": "Manual_Video_Brand_AOI",
"start_frame": 10,
"end_frame": 13
}
]
}Example of a successful response
Upon updating the AOIs in your image, the successful response look should look like the snippet below.
{
"frame_data": [
{
"frame": 10,
"aois": [
{
"uuid": "442a1fa8-3022-41e6-9688-700890193c0b",
"name": "Manual_Video_Brand_AOI",
"points": [
{
"x": 0.7,
"y": 0.2
},
{
"x": 0.7,
"y": 0.5
},
{
"x": 0.9,
"y": 0.5
},
{
"x": 0.9,
"y": 0.2
}
],
"attention_percent": 0.21146677434444427
}
],
"total_brand_attention": 0.21146677434444427
},
{
"frame": 11,
"aois": [
{
"uuid": "442a1fa8-3022-41e6-9688-700890193c0b",
"name": "Manual_Video_Brand_AOI",
"points": [
{
"x": 0.7,
"y": 0.2
},
{
"x": 0.7,
"y": 0.5
},
{
"x": 0.9,
"y": 0.5
},
{
"x": 0.9,
"y": 0.2
}
],
"attention_percent": 0.2743196189403534
}
],
"total_brand_attention": 0.2743196189403534
},
{
"frame": 12,
"aois": [
{
"uuid": "442a1fa8-3022-41e6-9688-700890193c0b",
"name": "Manual_Video_Brand_AOI",
"points": [
{
"x": 0.7,
"y": 0.2
},
{
"x": 0.7,
"y": 0.5
},
{
"x": 0.9,
"y": 0.5
},
{
"x": 0.9,
"y": 0.2
}
],
"attention_percent": 0.3613232970237732
}
],
"total_brand_attention": 0.3613232970237732
},
{
"frame": 13,
"aois": [
{
"uuid": "442a1fa8-3022-41e6-9688-700890193c0b",
"name": "Manual_Video_Brand_AOI",
"points": [
{
"x": 0.7,
"y": 0.2
},
{
"x": 0.7,
"y": 0.5
},
{
"x": 0.9,
"y": 0.5
},
{
"x": 0.9,
"y": 0.2
}
],
"attention_percent": 0.4557400941848755
}
],
"total_brand_attention": 0.4557400941848755
}
],
"aoi_metrics": [
{
"uuid": "442a1fa8-3022-41e6-9688-700890193c0b",
"name": "Manual_Video_Brand_AOI",
"availability": 0.16666666666666666,
"availability_start": 0.16666666666666666,
"availability_end": 0.16666666666666666,
"attention": 0.3257124423980713,
"attention_start": 0.3257124423980713,
"attention_end": 0.3257124423980713,
"relative_attention": 0.3257124423980713
}
]
}