Sign in Get started

Annotation format

The Pictograph JSON annotation schema: bounding boxes, polygons, polylines, keypoints, rotated boxes and multi-joint pose, with every field and a full example.

View as Markdown
On this page

Every annotation is a JSON object with a class name (never class), a type, and the geometry for that type. The SDK, the API and Pictograph JSON exports all use this schema.

Source: models/annotation.py

Types

type Geometry Notes
bbox bounding_box: {x, y, w, h} An axis-aligned box; with an oriented_box, a rotated box
polygon polygon: {paths: [[{x, y}, ...], ...]} One ring per path; a second ring is a hole (even-odd)
polyline polyline: {path: [{x, y}, ...]} An open line
keypoint keypoint: {x, y} One point, with no bounding_box; points sharing an instance_id are one object’s joints

Coordinates are pixels of the image, from its top-left corner. type: "obb" is accepted on input and saved as a bbox.

Fields

Field Required Notes
id Yes Unique in the image; required in REST, generated by the SDK if you leave it out
name Yes The class, one of the dataset’s classes (case-sensitive)
type Yes One of the four types
bounding_box, polygon, polyline or keypoint Yes The geometry its type names
confidence No 0 to 1; 1.0 when absent (drawn by a person), set by SAM3 and models
created_by No Who made it; filled in for you
attributes No A {name: value} map, such as {"occluded": "true"} (in exports)
bounding_box on a polygon or polyline No Its enclosing box, computed for you
oriented_box No bbox only: {cx, cy, w, h, angle} (rotated boxes)
instance_id No keypoint only: the object it belongs to, from 1, per image (pose)

Examples

One of each type, as an image’s annotations are saved:

[
  {"id": "ann-1", "name": "person", "type": "bbox",
   "bounding_box": {"x": 100, "y": 200, "w": 50, "h": 80}},
  {"id": "ann-2", "name": "car", "type": "polygon",
   "polygon": {"paths": [[{"x": 10, "y": 20}, {"x": 110, "y": 20}, {"x": 110, "y": 80}, {"x": 10, "y": 80}]]}},
  {"id": "ann-3", "name": "donut", "type": "polygon",
   "polygon": {"paths": [
     [{"x": 0, "y": 0}, {"x": 100, "y": 0}, {"x": 100, "y": 100}, {"x": 0, "y": 100}],
     [{"x": 30, "y": 30}, {"x": 70, "y": 30}, {"x": 70, "y": 70}, {"x": 30, "y": 70}]]}},
  {"id": "ann-4", "name": "lane_centerline", "type": "polyline",
   "polyline": {"path": [{"x": 0, "y": 100}, {"x": 50, "y": 100}, {"x": 100, "y": 100}]}},
  {"id": "ann-5", "name": "left_eye", "type": "keypoint", "keypoint": {"x": 250, "y": 180}}
]

The third is a square with a square hole.

Export file

Each image’s .json in an export ZIP wraps its annotations with the image’s details:

{
  "image": "street_042.jpg",
  "image_url": "https://api.pictograph.io/api/v1/developer/images/7241531b-3b1b-4de6-a754-5750ef288754",
  "image_uuid": "7241531b-3b1b-4de6-a754-5750ef288754",
  "image_path": "/downtown",
  "image_width": 1920,
  "image_height": 1080,
  "image_tags": ["outdoor", "daytime"],
  "annotation_count": 1,
  "annotation_url": "https://app.pictograph.io/project/9b1c2d3e/annotate/street_042.jpg",
  "dataset": { "name": "Street Scenes", "slug": "street-scenes" },
  "org": { "name": "Acme Vision", "slug": "acme-vision" },
  "split": "train",
  "annotations": [
    { "id": "a1", "name": "car", "type": "bbox",
      "bounding_box": { "x": 100, "y": 200, "w": 180, "h": 90 }, "confidence": 0.97 }
  ]
}
  • image_width and image_height are null for an older image whose size was never recorded.
  • image_tags are the image-level labels (type: "tag" classes).
  • split is train, val, test or null, as assigned when the export was built.

Rotated boxes

A rotated box is a bbox with an oriented_box, its geometry. bounding_box encloses it and is recomputed on every save.

{
  "id": "8f2b...",
  "name": "ship",
  "type": "bbox",
  "bounding_box": {"x": 77.7, "y": 81.3, "w": 44.6, "h": 37.4},
  "oriented_box": {"cx": 100, "cy": 100, "w": 40, "h": 20, "angle": 30}
}
  • Angle: degrees clockwise (y points down), from 0 to under 360; w and h run along the box’s own sides. It matches CVAT’s rotation.
  • Export: yolo_obb, dota and cvat keep the rotation; other formats get the four corners as a polygon. Pictograph trains a rotated box as its upright box; for a rotated-box model, export yolo_obb and train with Ultralytics.
  • Import: dota is detected automatically; choose yolo_obb yourself (its lines look like 4-point YOLO polygons).
  • Editor: draw a box, select it and drag its rotation handle.

Multi-joint pose

A pose is several keypoint annotations, one per joint, sharing an instance_id. Each point’s name is its joint (nose, left_eye); three people with seventeen joints are 51 keypoints with instance_id 1, 2 and 3.

[
  {"id": "a1", "name": "nose",     "type": "keypoint", "keypoint": {"x": 100, "y": 40}, "instance_id": 1},
  {"id": "a2", "name": "left_eye", "type": "keypoint", "keypoint": {"x": 92,  "y": 34}, "instance_id": 1},

  {"id": "b1", "name": "nose",     "type": "keypoint", "keypoint": {"x": 260, "y": 44}, "instance_id": 2},
  {"id": "b2", "name": "left_eye", "type": "keypoint", "keypoint": {"x": 252, "y": 38}, "instance_id": 2}
]

A class’s skeleton is set once, on the class: its joint names in order and the edges between them, counted from 0. The app has presets for human pose (COCO-17), hand (21), face (5) and vehicle (8).

{"name": "person", "type": "keypoint",
 "skeleton": {"nodes": [{"name": "nose", "x": 0.5, "y": 0.06}, ...],
              "edges": [[0, 1], [1, 2]]}}
  • Order: the class’s joint order is the order COCO’s categories[].keypoints and pretrained pose models use; don’t reorder a template.
  • Visibility: a joint is visible unless its attributes say {"occluded": "true"}; COCO and YOLO-Pose write v = 2 and v = 1 (0 is a joint not placed).
  • Export: coco writes the joints, the skeleton and [x, y, v] per joint; yolo_pose trains directly with Ultralytics (flip_idx from your left_* and right_* names); cvat, darwin and datumaro keep the grouping; other formats export each pose as its box.
  • Train: the rfdetr_keypoint pipeline.
  • Import: V7 and Roboflow poses import grouped, one instance_id per object.
  • Editor: instance_id is set for you: the first nose on an image is 1, the second 2.

Grouping helper: _keypoint.py

Saving

An image’s annotations are saved as one array, and a save replaces them all: send the complete list (annotations.save).

Common mistakes

Wrong Right
"class": "person" "name": "person"
"polygon": [[10, 20, 30, 40]] "polygon": {"paths": [[{"x": 10, "y": 20}, ...]]}
"bbox": [x, y, w, h] "bounding_box": {"x": ..., "y": ..., "w": ..., "h": ...}
A class the dataset doesn’t have Add the class first (datasets.update or pictograph classes add); a save doesn’t add it
A polygon ring with fewer than 3 points At least 3 points per ring
A polyline with fewer than 2 points At least 2 points

Confidence and attributes in exports

A format with no place for a value drops it (-).

Format confidence attributes
pictograph On each annotation On each annotation
coco score An attributes object
datumaro attributes.score attributes
csv A confidence column -
darwin inference.confidence, model-scored annotations only -
cvat - An <attribute> per shape, declared on its <label>
yolo, yolo_obb, yolo_pose, dota, pascal_voc, labelme - -

A person’s annotation exports confidence 1.0. An attributes list, instead of a map, isn’t exported.

SDK models

from pictograph import (
    BBoxAnnotation,
    BoundingBox,
    KeypointAnnotation,
    OrientedBoxGeometry,
    Point,
    PolygonAnnotation,
    PolygonGeometry,
)

bbox = BBoxAnnotation(
    name="person",
    bounding_box=BoundingBox(x=100, y=200, w=50, h=80),
)
ship = BBoxAnnotation(
    name="ship",
    bounding_box=BoundingBox(x=77.7, y=81.3, w=44.6, h=37.4),
    oriented_box=OrientedBoxGeometry(cx=100, cy=100, w=40, h=20, angle=30),
)
polygon = PolygonAnnotation(
    name="car",
    polygon=PolygonGeometry(paths=[[Point(x=10, y=20), Point(x=110, y=20), Point(x=110, y=80)]]),
)
nose = KeypointAnnotation(
    name="nose",
    keypoint=Point(x=100, y=40),
    instance_id=1,
)

If the API rejects an annotation, compare its .model_dump(mode="json", exclude_none=True) with the error message.

Copied to clipboard