> ## Documentation Index
> Fetch the complete documentation index at: https://api-reference.scale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Annotation Queries

### Annotation Query Examples

#### “Show me all images with ground truth annotations”

```text Query theme={null}
annotations.count > 0
```

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

```text Query theme={null}
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](https://api-reference.scale.com/docs/nucleus/uploading-ground-truth-annotations))”

```text Query theme={null}
annotations."traffic light".color = "yellow"
```

#### “Show me all annotations that have a value "yellow" for the metadata field "color" ([annotation-level metadata](https://api-reference.scale.com/docs/nucleus/uploading-ground-truth-annotations))”

```text Query theme={null}
annotations.metadata.color = "yellow"
```

#### “Show me all images with segmentation annotations”

```text Query theme={null}
annotations.segmentation.count > 0
```

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

```text Query theme={null}
annotations.truck + annotations.bus >= 5
```

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

```text Query theme={null}
annotations."stop sign" % 2 = 0
```

#### “Show me all images with the categorical label dress for the taxonomy clothing\_type”

```text Query theme={null}
annotations.clothing_type = dress
```

#### “Show me all images without the categorical label trousers for the taxonomy clothing\_type”

```text Query theme={null}
annotations.clothing_type != trousers
```

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

```text Query theme={null}
annotations.dimension.x < 6 AND annotations.dimension.y < 4
```

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

```text Query theme={null}
annotations.position.x > 500 AND annotations.position.y > 500
```

### Annotation Query Details

| | |
| :- | :- |
| `annotations.` | Prefix for all annotation-based queries |
| `annotations.count` | The 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](https://api-reference.scale.com/docs/nucleus/uploading-ground-truth-annotations). 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](https://api-reference.scale.com/docs/nucleus/uploading-ground-truth-annotations) |
| `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].count` | The 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 |
