Annotation Queries

Annotation Query Examples

“Show me all images with ground truth annotations”

annotations.count > 0

“Show me all images with at least 4 traffic lights and exactly one truck”

annotations."traffic light" >= 4 AND annotations.truck = 1

“Show me all images that have yellow traffic lights (where color: yellow was specified as annotation-level metadata)”:

annotations."traffic light".color = "yellow"

“Show me all annotations that have a value "yellow" for the metadata field "color" annotation-level metadata)”:

annotations.metadata.color = "yellow"

annotations."traffic light".color = "yellow"

“Show me all images with segmentation annotations”

annotations.segmentation.count > 0

“Show me all images with at least 5 trucks or buses”

annotations.truck + annotations.bus >= 5

“Show me all images with an even number of stop signs”

annotations."stop sign" % 2 = 0

“Show me all images with the categorical label dress for the taxonomy clothing_type”

annotations.clothing_type = dress

“Show me all images without the categorical label trousers for the taxonomy clothing_type”

annotations.clothing_type != trousers

"Show me all images that have bounding box annotations smaller than 6 pixels wide and 4 pixels high"

annotations.dimensions.x < 6 AND annotations.dimensions.y < 4

"Show me all images that have bounding box annotations in the right bottom quadrant of the image"

annotations.dimensions.x > 500 AND annotations.dimensions.y > 500

Annotation Query Details

annotations.Prefix for all annotation-based queries
annotations.countThe total number of annotations in the dataset item
annotations.position.[x/y/z]Filter based on annotation geometry position. Currently only supporting BoxAnnotation and CuboidAnnotation types. For a BoxAnnotation, only position queries for x and y are supported where x is the number pixels from the left border of the image and the left edge of the box and y is the number of pixels from the top border of the image to the top edge of the box. For a CuboidAnnotation, x,y,z represent the coordinates of the center of the cuboid in pixels.
annotations.dimension.[x/y/z]Filter based on annotation geometry dimension. Currently only supporting BoxAnnotation and CuboidAnnotation types. For a BoxAnnotation, x and y represent the width (x) and height (y) of the box. For a CuboidAnnotation, the dimensions correspond to length (x), width (y), and height (z) of the cuboid.
annotations.[class_name]The number of [class name] annotations in the dataset item, of any geometric type
annotations.[class_name].[metadata_field_name]The value of the [metadata_field_name] annotation-level metadata attribute. Only annotations with label=[class_name] will be considered.
annotations.metadata.[metadata_field_name]The value of the [metadata_field_name] annotation-level metadata attribute
annotations.[annotation_type].Prefix to filter based on annotation types. Useful to filter based on counts for a particular type of annotation, or if you have different annotation types (e.g., bounding boxes and instance segmentations) with identical class names, and you need to specify one of them in particular. [annotation_type] can be one of: box, polygon, segmentation, category
annotations.[annotation_type].countThe number of annotations of type [annotation_type] in the dataset item
annotations.[annotation_type].[class_name]The number of [class name] annotations of type [annotation_type] in the dataset item
annotations.[taxonomy_name]The [class_name] of the category annotation with taxonomy name [taxonomy_name] for the dataset item