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
annotations.jsonimage_annotations.csvobject_annotations.csvimage_annotations.parquetobject_annotations.parquet
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 namedimage_annotations.csv or image_annotations.parquet. Each row represents an image and its corresponding label.
Format:
| 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
filenamecolumn must contain relative paths - The
labelcolumn assigns a class to the entire image - Multiple labels can be stored as a list:
['t-shirt', 'SKU12345'] - You may include a
captioncolumn for textual metadata
| filename | label |
|---|---|
| cool-tshirt.png | [“t-shirt”, “SKU12345”] |
| cool-pants.jpg | [“pants”, “SKU231312”] |
Object Annotations
For object-level annotations, create a file namedobject_annotations.csv or object_annotations.parquet. Each row represents a detected object with bounding box coordinates and class label.
Format:
| 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_xandrow_ydefine the top-left corner of the bounding boxwidthandheightmust 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 namedannotations.json.
Example Format:
- Bounding boxes follow the format
[col_x, row_y, width, height] col_xandrow_ydefine the top-left cornerwidthandheightmust 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 Name | Description |
|---|---|
filename | The name of the image file containing the object |
col_x | The x-coordinate (horizontal position) of the top-left corner |
row_y | The y-coordinate (vertical position) of the top-left corner |
width | The width of the bounding box, extending from col_x |
height | The height of the bounding box, extending from row_y |
label | The class or category of the detected object |
Common Format Comparison
| Format | Representation | Normalized? | 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 |
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: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: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:Importing Annotations into Visual Layer
Once your annotation file is properly formatted, you can import it during dataset creation. Steps:- Upload your annotation file during dataset creation.
- Files can be uploaded from your local machine or S3 bucket.
- Ensure your file follows the required format and has the correct name.
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:Extraction Process
The extraction script processes Visual Layer’s internal parquet files to create a clean annotation file:- Extracts relevant columns:
filenameandcaption - Removes system paths like
/hostfs,/mnt, etc. - Creates relative paths by converting absolute paths to relative filenames
- Outputs clean parquet file named
image_annotations.parquet
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: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 theimage_annotations.parquet file is located.
Correct - Relative Paths:
Troubleshooting
Images Not Found: If Visual Layer cannot find your images, verify:- Parquet file is in the same directory as images
- Filenames match exactly (case-sensitive)
- Paths in parquet are relative, not absolute
- Verify filename is exactly
image_annotations.parquet - Ensure file is in the correct location relative to images
- Check that parquet file has both
filenameandcaptioncolumns
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