Using the "is_global": true
flag in the conditions
JSON when defining attributes marks the attribute as global.
For imageannotation
and segmentannotation
tasks, this means the attribute applies to the scene as a whole instead of any particular annotation. Therefore, the label_condition
condition will never apply.
For videoannotation
and videoplaybackannotation
tasks, this means the attribute applies to events
which occur on a frame or during a group of frames. The label_condition
can be used to restrict the attribute to appear on specific event labels.
For imageannotation
tasks, the global attribute image_rotation
will sync with the image rotation in the task.
{
"annotation_attributes": {
"is_night": {
"type": "category",
"description": "Does this scene take place at night?",
"choices": ["Yes", "No"],
"conditions": {
"is_global": true
}
}
}
}
For namedentityrecognition
tasks, global attributes applies to the entire text instead of highlighting and labeling a subset of it. Unlike the other tasks, it instead is defined under "global_attributes"
. namedentityrecognition
tasks support category, text and number "types"
.
{
"labels": [
// ...
],
"relationships": [
// ...
],
"global_attributes": {
"Is capitalized": {
"type": "category",
"description": "Is this the first word in the text capitalized?",
"conditions": {
"is_global": true
},
"choices": [
"yes",
"no"
]
}
}
}
Response Format
For imageannotation
, segmentannotation
, and namedentityrecognition
tasks, global attributes will be returned alongside the annotations
object, under the global_attributes
key.
{
"response": {
"annotations": [
// ...
],
"global_attributes": {
"driving": "Yes",
"night": "No"
}
}
}
For videoannotation
or videoplaybackannotation
tasks, the attribute values are specified in events within the events
file JSON.
{
"events": [
{
"label": "Driving In Lane",
"type": "range",
"start": 1,
"end": 15,
"attributes": {
"lane": "left"
}
}
]
}
Multiple Types of "Global" Attributes
Global Attributes (here) are different from Global Track Attributes for Multiframe Tasks.
Global Attributes specify a global, scene-level attribute, or an attribute of events if using events in
videoannotation
orvideoplaybackannotation
tasks. It is not used to customize the attributes of a single annotation.Global Track Attributes (Multiframe Tasks) specify one attribute of annotations when using multiframe tasks, like
videoannotation
orvideoplaybackannotation
. Once set, all frames of the annotation must have the same, consistent attribute value. Global Track Attributes should only be used to specify annotation attributes ofvideoannotation
,videoplaybackannotation
orlidarannotation
tasks.