Sign in Get started

Auto-annotate

Draft labels with SAM3 point, box and text prompts, or run SAM3 or a trained model over a whole dataset as a priced batch job.

View as Markdown
On this page

For an image outside a dataset, use SAM3, which also explains each prompt.

You want to Use
Label the object you click point
Label what a rough box holds box
Label every match of a phrase in one image text
Label named images with known classes batch
Label a whole dataset or folder dataset
Label every object like one you drew similar
Price a run first quote, quote_similar

A prompt’s result is returned, not saved; save it with annotations.save. batch, dataset and similar save drafts; review them before you export and train.

point

Get the polygon of the object at a point. The first prompt on an image takes a second or two (a minute or two if SAM3 is starting); further prompts on it are faster.

Source: AutoAnnotate.point

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
x int required Point’s x, in pixels
y int required Point’s y, in pixels
name str "object" Class name
positive_points Sequence[tuple[int, int]] | None None More points on the object
negative_points Sequence[tuple[int, int]] | None None Points to exclude
score_threshold float 0.75 Minimum SAM3 score, 0 to 1
result = client.auto_annotate.point(
    dataset="road-signs",
    image="img-1.jpg",
    x=320,
    y=240,
    name="car",
    positive_points=[(310, 250)],
    negative_points=[(100, 100)],
)
pictograph auto-annotate point road-signs img-1.jpg --x 320 --y 240 --name car
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/sam3/point" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "image": "img-1.jpg", "x": 320, "y": 240, "name": "car", "positive_points": [[310, 250]], "negative_points": [[100, 100]]}'

Returns PromptResult

PromptResult · 4 fields
class PromptResult(BaseModel):
    """Outcome of a single SAM3 prompt (point / box / text)."""
    status: Literal['success', 'no_detection', 'below_threshold']
    annotations: list[Annotation] = []
    # Confidence score for the primary detection (point/box only).
    score: float | None = None
    # GPU inference time, in seconds.
    inference_time: float | None = None

On success, annotations[0] is a PolygonAnnotation.

box

Label what a box holds.

Source: AutoAnnotate.box

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
box dict[str, float] required Box around the object, in pixels (x, y, w, h)
name str required Class name
confidence_threshold float 0.5 Minimum confidence, 0 to 1
return_polygon bool True Also return the polygon, not just the box
negative_boxes Sequence[dict[str, float]] | None None Boxes to exclude
result = client.auto_annotate.box(
    dataset="road-signs",
    image="img-1.jpg",
    box={"x": 100, "y": 200, "w": 200, "h": 150},
    name="car",
    return_polygon=True,
    negative_boxes=[{"x": 50, "y": 50, "w": 30, "h": 30}],
)
pictograph auto-annotate box road-signs img-1.jpg --box 100,200,200,150 --name car
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/sam3/box" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "image": "img-1.jpg", "box": {"x": 100, "y": 200, "w": 200, "h": 150}, "name": "car", "return_polygon": true, "negative_boxes": [{"x": 50, "y": 50, "w": 30, "h": 30}]}'

Returns PromptResult

PromptResult · 4 fields
class PromptResult(BaseModel):
    """Outcome of a single SAM3 prompt (point / box / text)."""
    status: Literal['success', 'no_detection', 'below_threshold']
    annotations: list[Annotation] = []
    # Confidence score for the primary detection (point/box only).
    score: float | None = None
    # GPU inference time, in seconds.
    inference_time: float | None = None

text

Label every match of a phrase in one image, most confident first.

Source: AutoAnnotate.text

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image path (addressing)
text_prompt str required Short noun phrase, e.g. stop sign
output_type str "polygon" polygon or bbox
confidence_threshold float 0.3 Minimum confidence, 0 to 1
max_detections int 50 Most matches to return (1 to 100)
result = client.auto_annotate.text(
    dataset="road-signs",
    image="img-1.jpg",
    text_prompt="red cars",
    output_type="polygon",
    max_detections=50,
)
pictograph auto-annotate text road-signs img-1.jpg --prompt "red cars"
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/sam3/text" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "image": "img-1.jpg", "text_prompt": "red cars", "output_type": "polygon", "max_detections": 50}'

Returns PromptResult

PromptResult · 4 fields
class PromptResult(BaseModel):
    """Outcome of a single SAM3 prompt (point / box / text)."""
    status: Literal['success', 'no_detection', 'below_threshold']
    annotations: list[Annotation] = []
    # Confidence score for the primary detection (point/box only).
    score: float | None = None
    # GPU inference time, in seconds.
    inference_time: float | None = None

batch

Label the images you name in one job. SAM3 needs at least one class; a trained model (model="Road Sign Detector") brings its own.

Source: AutoAnnotate.batch

Arg Type Default Notes
dataset str required Dataset name or id
images Sequence[str] required Image paths (val/x.jpg), 1 to 5,000; a bare filename matches every image with that name
classes Sequence[BatchClass | dict[str, Any]] required One {name, output_type} per class
confidence_threshold float 0.5 Minimum confidence, 0 to 1
model str | None None Trained model name or id; None uses SAM3
top_k int 1 Tags per image (classifiers only)
sahi bool False Also run SAM3 over overlapping tiles to find small objects (SAHI); costs more per tile; SAM3 only
sahi_slice_size int 640 SAHI tile size in pixels (256 to 1024); smaller finds smaller objects but costs more
wait bool True Wait until the job finishes
poll_interval float 5.0 Seconds between checks
timeout float 1800.0 Max seconds to wait
from pictograph import BatchClass

job = client.auto_annotate.batch(
    dataset="road-signs",
    images=["img-1.jpg", "img-2.jpg", "img-3.jpg"],
    classes=[
        BatchClass(name="car", output_type="polygon"),
        BatchClass(name="person", output_type="bbox"),
    ],
    confidence_threshold=0.5,
    wait=True,
)
print(job.status, job.processed_images, job.total_annotations_added)
pictograph auto-annotate batch road-signs \
  --images img-1.jpg,img-2.jpg,img-3.jpg \
  --classes car:polygon,person:bbox
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/batch" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "images": ["img-1.jpg", "img-2.jpg"], "classes": [{"name": "car", "output_type": "polygon"}, {"name": "person", "output_type": "bbox"}], "confidence_threshold": 0.5}'

Returns BatchJob

BatchJob · 10 fields
class BatchJob(BaseModel):
    """Snapshot of an auto-annotate batch job's progress."""
    job_id: str
    status: Literal['pending', 'running', 'completed', 'failed', 'cancelled']
    # 0-100. 100 only at terminal state.
    progress: int = 0
    total_images: int = 0
    processed_images: int = 0
    total_annotations_added: int = 0
    failed_images: int = 0
    error_message: str | None = None
    # Only on the response that started the job: the deposit taken, in micro-USD.
    estimated_credits: int | None = None
    completed_at: datetime | None = None

SAHI sliced inference

For large images with small objects (drone shots, wide industrial scenes), turn on SAHI. Each image is cut into overlapping tiles, each tile runs at near full resolution beside one pass over the whole image, and the pieces are merged back into whole objects.

job = client.auto_annotate.batch(
    dataset="road-signs",
    images=["site-4k.jpg"],
    classes=[BatchClass(name="person", output_type="polygon")],
    sahi=True,
    sahi_slice_size=640,
)
pictograph auto-annotate batch road-signs \
  --images site-4k.jpg --classes person:polygon --sahi --sahi-slice-size 640
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/batch" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "images": ["site-4k.jpg"], "classes": [{"name": "person", "output_type": "polygon"}], "sahi_enabled": true, "sahi_slice_size": 640}'

dataset

Draft labels for a whole dataset or one of its folders. A job takes up to 5,000 images; run it again for the rest (images_capped).

Source: AutoAnnotate.dataset

Arg Type Default Notes
dataset str required Dataset name or id
classes Sequence[BatchClass | tuple[str, str] | dict[str, str]] required BatchClass models, (name, output_type) tuples or dicts; optional with model (a classifier’s classes land as tags)
mode AnnotateMode "batch" batch runs one job; text sends a text prompt per image, one at a time (SAM3 only)
directory str | None None Only this directory, e.g. /val (not subdirectories); None reads the whole dataset
model str | None None Trained model name or id to use instead of SAM3; batch mode only
confidence_threshold float 0.5 Minimum confidence, 0 to 1
overwrite bool False Also draft images that have annotations: batch mode adds beside them (dropping exact duplicates), text mode replaces them
max_images int | None None Draft at most this many images
sahi bool False SAHI for small objects (SAM3, batch mode)
sahi_slice_size int 640 SAHI tile size in pixels (256 to 1024)
wait bool True Wait for the job (batch mode); False returns at once with job_id set, and rerunning on the same images before it finishes drafts them twice
poll_interval float 5.0 Seconds between checks (batch mode)
timeout float 1800.0 Max seconds to wait (batch mode)
report = client.auto_annotate.dataset(
    dataset="road-signs",
    classes=[("car", "polygon"), ("person", "bbox")],
    directory="/val",
)
print(report.images_processed, report.annotations_added, len(report.failures))
# Draft the folder /val; the report goes to stdout.
pictograph auto-annotate dataset road-signs \
  --classes "car:polygon,person:bbox" \
  --directory /val --json
# No single REST call: list the dataset's images, then send them to /auto-annotate/batch.
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/batch" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "images": ["img-1.jpg", "img-2.jpg"], "classes": [{"name": "stop sign", "output_type": "bbox"}]}'

Returns AnnotateReport

AnnotateReport · 9 fields
class AnnotateReport(BaseModel):
    """Outcome of an AutoAnnotate.dataset call."""
    dataset_name: str
    images_attempted: int = 0
    images_processed: int = 0
    images_skipped: int = 0
    images_capped: int = 0
    annotations_added: int = 0
    failures: list[AnnotationFailure] = []
    job_id: str | None = None
    job_status: str | None = None

    @property
    def success(self) -> bool: ...

similar

Label every object that looks like your examples, polygons drawn on one image (the app’s Annotate similar). SAM3 finds similar objects in the rest of the image’s directory or dataset and saves them. One job covers up to 2,000 images.

Source: AutoAnnotate.similar

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image the examples are drawn on (addressing)
annotations Sequence[str] () Example polygon ids (from annotations.get)
reference_class str | None None Use every polygon of this class on the image as an example, instead of annotations
scope SimilarScope "directory" Search the image’s directory or the whole dataset
target_class str | None None Class to save matches as (default: the examples’ shared class)
output_type SimilarOutputType "polygon" polygon (needs a polygon class), bbox or obb (a rotated box; both need a box class)
confidence float | None None Detection confidence, 0.2 to 0.8; raise it if unrelated objects match, lower it to catch more
wait bool True Wait until the job finishes
poll_interval float 5.0 Seconds between checks
timeout float 1800.0 Max seconds to wait
job = client.auto_annotate.similar(
    dataset="road-signs",
    image="val/frame_001.jpg",
    reference_class="stop sign",
    scope="dataset",
)
print(job.status, job.total_images, job.total_annotations_added)
pictograph auto-annotate similar road-signs val/frame_001.jpg \
  --class "stop sign" --scope dataset
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/similar" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "image": "val/frame_001.jpg", "reference_class": "stop sign", "scope": "dataset"}'

Returns BatchJob

BatchJob · 10 fields
class BatchJob(BaseModel):
    """Snapshot of an auto-annotate batch job's progress."""
    job_id: str
    status: Literal['pending', 'running', 'completed', 'failed', 'cancelled']
    # 0-100. 100 only at terminal state.
    progress: int = 0
    total_images: int = 0
    processed_images: int = 0
    total_annotations_added: int = 0
    failed_images: int = 0
    error_message: str | None = None
    # Only on the response that started the job: the deposit taken, in micro-USD.
    estimated_credits: int | None = None
    completed_at: datetime | None = None

quote

What a batch would cost, without running it: exactly what batch charges.

Source: AutoAnnotate.quote

Arg Type Default Notes
dataset str | None None Dataset name or id; required to price existing images
images Sequence[str] () Existing images to price, as in batch; their stored sizes set SAHI tile counts
projected Sequence[ProjectedImages | dict[str, Any]] () Images not uploaded yet, such as a video’s frames
classes Sequence[BatchClass | dict[str, Any]] () Classes to label; each adds a pass, so it changes the price
model str | None None Trained model name or id; None uses SAM3
sahi bool False Price SAHI tiles too (SAM3 only)
sahi_slice_size int 640 SAHI tile size in pixels (256 to 1024)
from pictograph import BatchClass

uploaded = client.video.upload(file_path="drive.mp4")
meta = client.video.probe(video=uploaded.video)
frames = int(meta.duration_seconds * 5)   # sampling at 5 fps
quote = client.auto_annotate.quote(
    projected=[{"count": frames, "width": meta.width, "height": meta.height}],
    classes=[BatchClass(name="car", output_type="bbox")],
)
print(quote.estimated_credits / 1e6, "USD", quote.sufficient)
pictograph auto-annotate quote --frames 900 --width 1920 --height 1080 --classes car:bbox
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/batch/quote" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"projected": [{"count": 900, "width": 1920, "height": 1080}], "classes": [{"name": "car", "output_type": "bbox"}]}'

Returns BatchQuote

BatchQuote · 8 fields
class BatchQuote(BaseModel):
    """What a batch job would cost: the deposit `batch()` would take."""
    total_images: int
    # The cost, in micro-USD.
    estimated_credits: int
    # Total SAHI tile passes priced.
    sahi_tiles: int = 0
    # T4 containers the job runs on.
    containers: int = 0
    # Your remaining balance (µUSD).
    remaining_credits: int = 0
    # Whether the balance covers the estimate.
    sufficient: bool = True
    # Image ceiling for a single job.
    max_images: int = 5000
    # True when this configuration is past the ceiling and must be split.
    exceeds_max_images: bool = False

quote_similar

What similar would run and cost, without running it: the same checks, its estimate and your balance. Free, and any role can call it.

Source: AutoAnnotate.quote_similar

Arg Type Default Notes
dataset str required Dataset name or id
image str required Image the examples are drawn on (addressing)
annotations Sequence[str] () As in similar
reference_class str | None None As in similar
scope SimilarScope "directory" As in similar
target_class str | None None As in similar
output_type SimilarOutputType "polygon" As in similar
confidence float | None None As in similar
quote = client.auto_annotate.quote_similar(
    dataset="road-signs",
    image="val/frame_001.jpg",
    reference_class="stop sign",
)
print(quote.total_images, quote.estimated_credits / 1e6, "USD", quote.sufficient)
pictograph auto-annotate similar road-signs val/frame_001.jpg \
  --class "stop sign" --quote
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/similar/quote" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY" -H "Content-Type: application/json" \
  -d '{"dataset": "road-signs", "image": "val/frame_001.jpg", "reference_class": "stop sign"}'

Returns SimilarQuote

SimilarQuote · 13 fields
class SimilarQuote(BaseModel):
    """What an "Annotate similar" job would run and cost: the checks AutoAnnotate.similar makes (the examples, the target class, whether SAM3 can read the example image, the images in scope) and its estimate."""
    # Images the job would label (at most `max_images`).
    total_images: int
    # Other images in the scope, before the cap.
    total_in_scope: int = 0
    # True when the scope holds more than `max_images`.
    capped: bool = False
    # Image ceiling for a single job.
    max_images: int = 2000
    # The estimate, in micro-USD; the job starts only if the balance covers it.
    estimated_credits: int
    # T4 containers the job would run on.
    containers: int = 0
    # Your remaining balance (µUSD).
    remaining_credits: int = 0
    # Whether the balance covers the estimate.
    sufficient: bool = True
    # Example polygons the job would learn from.
    examples: int = 0
    # The class each match is labelled as.
    target_class: str = ''
    # polygon, bbox or obb.
    output_type: str = 'polygon'
    # directory or dataset.
    scope: str = 'directory'
    # The example image's folder.
    directory: str = '/'

get_batch

A batch job’s current state.

Source: AutoAnnotate.get_batch

Arg Type Default Notes
job str required Job id
job = client.auto_annotate.get_batch(job="1a6e4f28-9b30-4c57-8d21-6f3b0a5e7c94")
print(job.status, job.progress, job.total_annotations_added)
pictograph auto-annotate get 1a6e4f28-9b30-4c57-8d21-6f3b0a5e7c94
curl -s "https://api.pictograph.io/api/v1/developer/auto-annotate/batch/$JOB_ID" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns BatchJob

BatchJob · 10 fields
class BatchJob(BaseModel):
    """Snapshot of an auto-annotate batch job's progress."""
    job_id: str
    status: Literal['pending', 'running', 'completed', 'failed', 'cancelled']
    # 0-100. 100 only at terminal state.
    progress: int = 0
    total_images: int = 0
    processed_images: int = 0
    total_annotations_added: int = 0
    failed_images: int = 0
    error_message: str | None = None
    # Only on the response that started the job: the deposit taken, in micro-USD.
    estimated_credits: int | None = None
    completed_at: datetime | None = None

wait_for_batch

Wait for a batch job to finish.

Source: AutoAnnotate.wait_for_batch

Arg Type Default Notes
job str required Job id
poll_interval float 5.0 Seconds between checks
timeout float 1800.0 Max seconds to wait
job = client.auto_annotate.wait_for_batch(
    job="1a6e4f28-9b30-4c57-8d21-6f3b0a5e7c94",
    timeout=1800.0,
)
print(job.status, job.total_annotations_added, "annotations across", job.total_images, "images")
pictograph auto-annotate get 1a6e4f28-9b30-4c57-8d21-6f3b0a5e7c94
# No wait endpoint - `wait_for_batch` polls this one until `status` is terminal:
curl -s "https://api.pictograph.io/api/v1/developer/auto-annotate/batch/$JOB_ID" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns BatchJob

BatchJob · 10 fields
class BatchJob(BaseModel):
    """Snapshot of an auto-annotate batch job's progress."""
    job_id: str
    status: Literal['pending', 'running', 'completed', 'failed', 'cancelled']
    # 0-100. 100 only at terminal state.
    progress: int = 0
    total_images: int = 0
    processed_images: int = 0
    total_annotations_added: int = 0
    failed_images: int = 0
    error_message: str | None = None
    # Only on the response that started the job: the deposit taken, in micro-USD.
    estimated_credits: int | None = None
    completed_at: datetime | None = None

cancel_batch

Cancel a pending or running batch job.

Source: AutoAnnotate.cancel_batch

Arg Type Default Notes
job str required Job id
job = client.auto_annotate.cancel_batch(job="1a6e4f28-9b30-4c57-8d21-6f3b0a5e7c94")
print(job.status, job.processed_images, "of", job.total_images, "already done")
pictograph auto-annotate cancel-batch 1a6e4f28-9b30-4c57-8d21-6f3b0a5e7c94
curl -s -X POST "https://api.pictograph.io/api/v1/developer/auto-annotate/batch/$JOB_ID/cancel" \
  -H "X-API-Key: $PICTOGRAPH_API_KEY"

Returns BatchJob

BatchJob · 10 fields
class BatchJob(BaseModel):
    """Snapshot of an auto-annotate batch job's progress."""
    job_id: str
    status: Literal['pending', 'running', 'completed', 'failed', 'cancelled']
    # 0-100. 100 only at terminal state.
    progress: int = 0
    total_images: int = 0
    processed_images: int = 0
    total_annotations_added: int = 0
    failed_images: int = 0
    error_message: str | None = None
    # Only on the response that started the job: the deposit taken, in micro-USD.
    estimated_credits: int | None = None
    completed_at: datetime | None = None

Cost

Auto-annotation is paid from your credits, on every plan:

  • Prompts - about a cent per image, charged the first time a prompt on it completes; further prompts on the same image are free (SAM3).
  • batch and dataset - per image, times its classes, times its SAHI tiles; quote gives the exact price.
  • similar - the GPU time its job used, charged when it completes; a failed or cancelled job is free.

Common errors

Status Exception Cause
400 ValidationError SAM3 with no classes, or SAHI with a trained model
400 ValidationError similar: a non-polygon example, examples of several classes without target_class, a class the dataset lacks, or no other image in scope
402 PaymentRequiredError The run costs more than your balance
404 NotFoundError The dataset, image or model doesn’t exist
422 ValidationError sahi_slice_size outside 256 to 1024
422 ValidationError similar: SAM3 can’t read the example image (image_unreadable); the message says why
- PollTimeoutError The wait passed timeout; the job keeps running
Copied to clipboard