Skip to main content
Annotations are metadata labels that describe and categorize images or objects within images. They structure visual datasets and enable search, analysis, and AI training workflows.
Annotations must be uploaded when creating a dataset and cannot be added later.

Why Use Annotations

Annotations improve data organization and model accuracy by providing structured labels for images and objects. They enable:
  • Efficient data retrieval through filtering and search.
  • Enhanced search capabilities within large datasets.
  • Object detection and classification tasks.
  • Improved model accuracy with high-quality labeled data.

Common Annotation Types

Visual Layer supports two primary annotation types:
  • Image Annotations: Assign class labels to entire images and categorize datasets by content.
  • Object Annotations: Label individual objects within images using bounding boxes and improve model accuracy.

Supported Formats

Visual Layer accepts annotation files in the following formats: File Formats:
  • Parquet and CSV for structured image and object annotations
  • JSON for COCO-format annotations
  • YOLO format with conversion
  • Segmentation masks with conversion
  • Custom folder-based structures with conversion
File Naming Requirements: Your annotation file must be named exactly as one of the following:
  • annotations.json
  • image_annotations.csv
  • object_annotations.csv
  • image_annotations.parquet
  • object_annotations.parquet
Visual Layer cannot process files that do not match these exact names.

Preparing Annotation Files

This section explains how to structure your annotation files for Visual Layer import.

Image Annotations

For full-image class labels, create a file named image_annotations.csv or image_annotations.parquet. Each row represents an image and its corresponding label. Format:
filenamelabel
IDX_DF_SIG21341_PlasmasNeg.pngIDX_DF
IDX_DF_ALM00324_PlasmasPos.pngIDX_DF
folder/IDX_RC_ALM04559_PlasmasNeg.pngIDX_RC
Requirements:
  • The filename column must contain relative paths
  • The label column assigns a class to the entire image
  • Multiple labels can be stored as a list: ['t-shirt', 'SKU12345']
  • You may include a caption column for textual metadata
Example with Multiple Labels:
filenamelabel
cool-tshirt.png[“t-shirt”, “SKU12345”]
cool-pants.jpg[“pants”, “SKU231312”]

Object Annotations

For object-level annotations, create a file named object_annotations.csv or object_annotations.parquet. Each row represents a detected object with bounding box coordinates and class label. Format:
filenamecol_xrow_ywidthheightlabel
Kitti/raw/training/image_2/006149.png0240135133Car
Kitti/raw/training/image_2/006149.png6081695943Car
Requirements:
  • col_x and row_y define the top-left corner of the bounding box
  • width and height must be greater than zero
  • Each row corresponds to a single object within an image

JSON Annotations

Visual Layer supports COCO-format JSON annotations. Ensure the file is named annotations.json. Example Format:
Requirements:
  • Bounding boxes follow the format [col_x, row_y, width, height]
  • col_x and row_y define the top-left corner
  • width and height must be greater than zero
  • Remove all comments before uploading

Understanding Bounding Box Formats

Different annotation tools and datasets use different bounding box coordinate systems. This section compares common formats and shows you how to convert them to Visual Layer’s format.

Visual Layer Format

Visual Layer uses CSV format with the following structure:
Column NameDescription
filenameThe name of the image file containing the object
col_xThe x-coordinate (horizontal position) of the top-left corner
row_yThe y-coordinate (vertical position) of the top-left corner
widthThe width of the bounding box, extending from col_x
heightThe height of the bounding box, extending from row_y
labelThe class or category of the detected object
Example:

Common Format Comparison

FormatRepresentationNormalized?File Type
Visual Layer[col_x, row_y, width, height]No.csv
COCO[x_min, y_min, width, height]No.json
VOC(x_min, y_min, x_max, y_max)No.xml
YOLO[x_center, y_center, width, height]Yes.txt
TFRecord(y_min, x_min, y_max, x_max)Yes.tfrecord
LabelMe[[x_min, y_min], [x_max, y_max]]No.json
Each format is optimized for different use cases. COCO and VOC are widely used in academic datasets, YOLO for real-time detection, TFRecord for TensorFlow-based training, and LabelMe for manual annotations.

Converting from Other Formats

If your annotations use a different format, you can convert them to Visual Layer’s format using the scripts and guides below.

Converting YOLO Annotations

YOLO format stores annotations as normalized center coordinates. Each text file corresponds to an image and contains lines in the format:
Example:
Conversion Process: The script converts normalized coordinates to absolute pixel values and calculates top-left coordinates:
Python Conversion Script:

Converting Segmentation Masks

Segmentation masks use polygon coordinates to define object boundaries. You can convert these to bounding boxes by finding the minimum and maximum x,y values. Example Segmentation Mask Format:
Conversion Logic:
Python Conversion Script:

Creating Annotations from Folder Structure

If your images are organized in folders where each subfolder name represents the class label, you can generate annotation files automatically. Folder Structure:
Python Script:
Example Output:

Importing Annotations into Visual Layer

Once your annotation file is properly formatted, you can import it during dataset creation. Steps:
  1. Upload your annotation file during dataset creation.
  2. Files can be uploaded from your local machine or S3 bucket.
  3. Ensure your file follows the required format and has the correct name.
The annotation file must be uploaded at the same time as your images. Visual Layer will process the annotations and make them available for filtering, search, and analysis.

Reusing Caption Data

Caption generation is one of the most time-consuming operations in Visual Layer’s dataset pipeline. When creating multiple datasets with the same images, you can extract and reuse caption data from previous pipeline runs.

Benefits

Reusing caption data allows you to:
  • Skip caption generation on subsequent dataset creations.
  • Maintain consistent captions across multiple datasets.
  • Reduce processing time significantly.
This approach is ideal when you need to create multiple datasets or dataset versions using the same images but with different configurations.

How Caption Data Is Stored

After running a dataset pipeline, Visual Layer stores processed data in:
This parquet file contains all the caption data you need to reuse.

Extraction Process

The extraction script processes Visual Layer’s internal parquet files to create a clean annotation file:
  1. Extracts relevant columns: filename and caption
  2. Removes system paths like /hostfs, /mnt, etc.
  3. Creates relative paths by converting absolute paths to relative filenames
  4. Outputs clean parquet file named image_annotations.parquet
Script Location:

View Complete Script Code

The complete Python script is available in the Useful Scripts guide. Click here to view and copy the code.

Workflow

Step 1: Create Initial Dataset Create your first dataset with captioning enabled. After the pipeline completes, locate the parquet file:
Step 2: Run the Extraction Script Process the parquet file to extract captions:
Step 3: Copy to New Dataset Directory Place the extracted parquet file in your new dataset directory alongside the images:
The parquet file must be named exactly image_annotations.parquet for Visual Layer to recognize it.
Step 4: Create New Dataset Create your new dataset. Visual Layer will detect the existing image_annotations.parquet file and use the provided captions, completing much faster.

Understanding Relative Paths

Filenames in the parquet file must be relative to the dataset directory location. Visual Layer looks for images relative to where the image_annotations.parquet file is located. Correct - Relative Paths:
With Subdirectory:

Troubleshooting

Images Not Found: If Visual Layer cannot find your images, verify:
  1. Parquet file is in the same directory as images
  2. Filenames match exactly (case-sensitive)
  3. Paths in parquet are relative, not absolute
Captions Not Being Used: If Visual Layer is still generating captions:
  1. Verify filename is exactly image_annotations.parquet
  2. Ensure file is in the correct location relative to images
  3. Check that parquet file has both filename and caption columns

Next Steps

Now that you understand how to import annotations, you can create and explore datasets with rich metadata.

Create a Dataset

Create your first dataset with annotations

Explore Datasets

Use annotations to filter and analyze your data

Export Datasets

Export annotated datasets for downstream use