Sign in Get started

Quick start

Upload images, draft labels with SAM3, review them, then export and train a detection model, from the Python SDK or the pictograph CLI.

View as Markdown
On this page

You need the SDK and CLI installed, an API key in PICTOGRAPH_API_KEY, and a folder of images (./road_signs below).

1. Upload images

The dataset is created if it doesn’t exist.

from pictograph import AnnotateReport, Client, TrainingRun, UploadReport

client = Client()  # reads PICTOGRAPH_API_KEY

uploaded: UploadReport = client.images.upload_from_directory(
    dataset="road-signs",
    source_path="./road_signs",
)
print(uploaded.images_uploaded, "images uploaded")
pictograph images upload-directory road-signs ./road_signs

2. Draft labels with SAM3

Name each class and the shape SAM3 draws for it: bbox, polygon or tag.

drafted: AnnotateReport = client.auto_annotate.dataset(
    dataset="road-signs",
    classes=[("stop_sign", "bbox"), ("yield", "bbox")],
)
print(drafted.annotations_added, "draft annotations")
pictograph auto-annotate dataset road-signs --classes "stop_sign:bbox,yield:bbox"

3. Review the drafts

Fix what SAM3 got wrong in the app, starting with the images whose drafts scored under 0.5:

for image in client.images.list(dataset="road-signs", min_confidence_lt=0.5):
    print(image.filename)
pictograph images list road-signs --min-confidence-lt 0.5

4. Export and train

Training reads an export, a frozen copy of the dataset. Both calls return when they finish.

client.exports.create(
    dataset="road-signs",
    name="road-signs-v1",
    format="pictograph",
    include_images=True,
    wait=True,
)
run: TrainingRun = client.training.create(
    dataset="road-signs",
    export="road-signs-v1",
    pipeline_type="yolox",
    name="road-signs-detector",
)
print(run.status, run.model_id)
pictograph exports create road-signs --name road-signs-v1 -f pictograph --include-images
pictograph train start road-signs road-signs-v1 --pipeline yolox --name road-signs-detector

Drafting and training spend compute credits; the Free plan starts with a one-time $25 credit and paid plans include a monthly allowance (Credits).

Next

Copied to clipboard