Skip to main content

DM Schema V1/V2 Converter

A bidirectional converter between DM Schema V1 and V2 formats.

Overview

The DM Schema Converter transforms annotation data between V1 and V2 formats:

  • V1 → V2: Convert legacy V1 data to modern V2 structure
  • V2 → V1: Reverse convert V2 data to V1 format (legacy system compatibility)

Key Features

Separated Output Structure

V1→V2 conversion returns two separate parts:

  • annotation_data: V2 common annotation structure (id, classification, attrs, data)
  • annotation_meta: Preserved V1 top-level structure (meta information)

This separation enables:

  • Use annotation_data alone for V2 common format
  • Combine with annotation_meta for complete V1 restoration

Supported Tools

ToolV1 → V2V2 → V1Media TypeNotes
bounding_boximagerotation preserved
polygonimagepoint IDs auto-generated
polylineimagepoint IDs auto-generated
keypointimagesingle point coordinate
3d_bounding_boxpcdPSR coordinate system
segmentationimage/videoimage: pixel_indices, video: section
3d_segmentationpcdpoint indices
named_entitytextNER tagging
classificationimageno data (empty object)
relationimage/textannotation relationships
promptpromptprompt input
answerpromptanswer output

Quick Start

Installation

pip install synapse-sdk

V1 → V2 Conversion

from synapse_sdk.utils.converters.dm import convert_v1_to_v2

# V1 data
v1_data = {
"annotations": {
"image_1": [
{
"id": "ann_1",
"tool": "bounding_box",
"classification": {"class": "person"}
}
]
},
"annotationsData": {
"image_1": [
{
"id": "ann_1",
"coordinate": {"x": 100, "y": 200, "width": 150, "height": 100}
}
]
}
}

# Convert to V2 (separated result)
result = convert_v1_to_v2(v1_data)

annotation_data = result["annotation_data"] # V2 common structure
annotation_meta = result["annotation_meta"] # V1 top-level structure

V2 → V1 Conversion

from synapse_sdk.utils.converters.dm import convert_v2_to_v1

# Complete conversion (annotation_data + annotation_meta)
v1_restored = convert_v2_to_v1(result)

# Convert with annotation_data only (uses defaults)
v1_basic = convert_v2_to_v1({"annotation_data": annotation_data})

Detailed Guides

Image Tools

Video Tools

PCD (Point Cloud) Tools

Text Tools

Prompt Tools

Developer Documentation

API Reference

convert_v1_to_v2(v1_data)

Converts V1 data to V2 format.

Parameters:

  • v1_data: DM Schema V1 format data

Returns:

  • V2ConversionResult: Dictionary containing annotation_data and annotation_meta

convert_v2_to_v1(v2_data, annotation_meta=None)

Converts V2 data to V1 format.

Parameters:

  • v2_data: DM Schema V2 format data or V2ConversionResult
  • annotation_meta: Optional V1 top-level structure passed separately

Returns:

  • DM Schema V1 format data