Guides

Importing Annotations

Importing Annotations

Overview

You can import annotations while creating a Dataset in Visual Layer Profiler. The supported annotation types are:

  • Image annotations: Images with class labels.
  • Object annotations: Objects annotated with bounding boxes and corresponding labels.

Supported Annotation Formats

  1. Parquet / CSV
  2. JSON (COCO format)

Limitations ⚠️

  • Annotations cannot be added after a Dataset has been created.
  • The annotation file must be named as one of the following:
    • annotations.json
    • image_annotations.csv
    • object_annotations.csv
    • image_annotations.parquet
    • object_annotations.parquet

Parquet / CSV Annotations

Image Annotations

For full-image class labels, create an annotation file named image_annotations.parquet or image_annotations.csv. Place this file in the root directory of your uploaded folder, tar, or zip file.

Example Format:

import pandas as pd
df = pd.read_parquet('image_annotations.parquet')
df
filenamelabel
IDX_DF_SIG21341_PlasmasNeg.pngIDX_DF
IDX_DF_ALM00324_PlasmasPos.pngIDX_DF
folder/IDX_RC_ALM04559_PlasmasNeg.pngIDX_RC
  • The filename column must contain relative paths.
  • You may also include a caption column for textual metadata.
  • Multiple labels can be stored as a list, e.g., ['t-shirt', 'SKU12345'].

Example for Multiple Labels:

filenamelabel
cool-tshirt.png["t-shirt", "SKU12345"]
cool-pants.jpg["pants", "SKU231312"]

Object Annotations

For object-level annotations, create an annotation file named object_annotations.parquet or object_annotations.csv. Each row represents a single object, with coordinates defining its bounding box.

Example Format:

import pandas as pd
df = pd.read_parquet('object_annotations.parquet')
df
filenamecol_xrow_ywidthheightlabel
Kitti/raw/training/image_2/006149.png0240135133Car
Kitti/raw/training/image_2/006149.png6081695943Car
  • col_x and row_y are the top-left corner coordinates.
  • width and height must be greater than zero.

JSON Annotations (COCO Format)

To use JSON annotations, ensure:

  • The file is named annotations.json.
  • It is placed in the root directory of your uploaded folder or S3 bucket.
  • The file is present at the time of Dataset creation (annotations cannot be added later).

Example JSON Format:

{
    "images": [
        { "id": 1, "width": 640, "height": 480, "file_name": "image1.jpg" },
        { "id": 2, "width": 800, "height": 600, "file_name": "image2.jpg" }
    ],
    "categories": [
        { "id": 1, "name": "cat" },
        { "id": 2, "name": "dog" },
        { "id": 3, "name": "t-rex" }
    ],
    "annotations": [
        { "id": 1, "image_id": 1, "category_id": 1, "bbox": [100, 100, 200, 200] },
        { "id": 2, "image_id": 2, "category_id": 2, "bbox": [50, 50, 150, 150] },
        { "id": 3, "image_id": 1, "category_id": 3 },
        { "id": 4, "image_id": 2, "category_id": 3 }
    ]
}
  • Bounding boxes (bbox) follow the format [col_x, row_y, width, height].
  • Remove comments before uploading.

By following these guidelines, you can successfully import annotations into Visual Layer Profiler.