# Image Annotation

### Structure

For each image, we store the annotations in a separate JSON file named `image_name.image_format.json` with the following file structure:

```json
{
    "description": "food",
    "name": "tomatoes-eggs-dish.jpg",
    "size": {
        "width": 2100,
        "height": 1500
    },
    "tags": [],
    "objects": []
}
```

Fields definitions:

* `name` - string - image name
* `description` - string - (optional) - This field is used to store the text we want to assign to the image. In the labeling interface it corresponds to the 'data' filed.
* `size` - stores image size. Mostly, it is used to get the image size without the actual image reading to speed up some data processing steps.
  * `width` - image width in pixels
  * `height` - image height in pixels
* `tags` - list of strings that will be interpreted as image [tags](/getting-started/supervisely-annotation-format/tags.md)
* `objects` - list of [objects on the image](/getting-started/supervisely-annotation-format/objects.md) which can be of different types (point, rectangle, polygon, line, bitmap, etc.)

## Full image annotation example with objects and tags

![image example](/files/cQV2hmuRadE3KFTnDoA3)

Example:

```json
{
    "description": "",
    "tags": [
        {
            "id": 86458971,
            "tagId": 28283797,
            "name": "like",
            "value": null,
            "labelerLogin": "alexxx",
            "createdAt": "2020-08-26T09:12:51.155Z",
            "updatedAt": "2020-08-26T09:12:51.155Z"
        },
        {
            "id": 86458968,
            "tagId": 28283798,
            "name": "situated",
            "value": "outside",
            "labelerLogin": "alexxx",
            "createdAt": "2020-08-26T09:07:26.408Z",
            "updatedAt": "2020-08-26T09:07:26.408Z"
        }
    ],
    "size": {
        "height": 952,
        "width": 1200
    },
    "objects": [
        {
            "id": 497521359,
            "classId": 1661571,
            "description": "",
            "geometryType": "bitmap",
            "labelerLogin": "alexxx",
            "createdAt": "2020-08-07T11:09:51.054Z",
            "updatedAt": "2020-08-07T11:09:51.054Z",
            "tags": [],
            "classTitle": "person",
            "bitmap": {
                "data": "eJwBgQd++IlQTkcNChoKAAAADUlIRF",
                "origin": [
                    535,
                    66
                ]
            }
        },
        {
            "id": 497521358,
            "classId": 1661574,
            "description": "",
            "geometryType": "rectangle",
            "labelerLogin": "alexxx",
            "createdAt": "2020-08-07T11:09:51.054Z",
            "updatedAt": "2020-08-07T11:09:51.054Z",
            "tags": [],
            "classTitle": "bike",
            "points": {
                "exterior": [
                    [
                        0,
                        236
                    ],
                    [
                        582,
                        872
                    ]
                ],
                "interior": []
            }
        }
    ]
}
```

### How the Label Group Is Described in Project Files

![Label Group](/files/S5sA82FlySmc3tLPdR4h)

1. **Project Meta**

   In the **tags** section of project `meta.json`, you must include a tag named **`@label-group-id`** with the following properties:

   * **`name`**: `"@label-group-id"`
   * **`value_type`**: `"any_string"` (allows flexible naming for groups)
   * **`applicable_type`**: `"objectsOnly"` (ensures the tag is only assigned to labeled objects)

   This tag is essential for defining and managing label groups within the project, allowing grouped labels to be linked and organized effectively.

   ```json
   {        
       "tags": [
           {
               "name": "@label-group-id",
               "value_type": "any_string",
               "color": "#FF0000",
               "id": 222,
               "hotkey": "",
               "applicable_type": "objectsOnly",
               "classes": [],
               "target_type": "all"
           }
       ],
       ... // more elements here
   }
   ```
2. **Image Annotation**

   To add an object to a label group, you must assign the `@label-group-id` tag with the corresponding group name as its value.

   * This ensures that all objects with the same tag value are recognized as part of the same group.
   * Grouped labels will be visually linked and managed together in the annotation interface.

   ```json
   "objects": [
           {
               "classTitle": "Head Light",
               "description": "",
               "tags": [
                   {
                       "name": "@label-group-id",
                       "value": "head-light",
                       "labelerLogin": "supervisely",
                       ... // more elements here
                   }
               ],
               ... // more elements here
           }
       ]
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.supervisely.com/getting-started/supervisely-annotation-format/images.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
