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
- Parquet / CSV
- 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
filename | label |
---|---|
IDX_DF_SIG21341_PlasmasNeg.png | IDX_DF |
IDX_DF_ALM00324_PlasmasPos.png | IDX_DF |
folder/IDX_RC_ALM04559_PlasmasNeg.png | IDX_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:
filename | label |
---|---|
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
filename | col_x | row_y | width | height | label |
---|---|---|---|---|---|
Kitti/raw/training/image_2/006149.png | 0 | 240 | 135 | 133 | Car |
Kitti/raw/training/image_2/006149.png | 608 | 169 | 59 | 43 | Car |
col_x
androw_y
are the top-left corner coordinates.width
andheight
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.
Updated 28 days ago