Skip to content

Latest commit

 

History

History
652 lines (526 loc) · 44.1 KB

examples.md

File metadata and controls

652 lines (526 loc) · 44.1 KB

Examples

Run these examples from the repository root. They cover workspace creation, ingest, annotation, release verification, and export across the SDK, REST API, CLI, and MCP.

Example What it demonstrates
sdk_end_to_end.py Create a workspace, label images, and verify a release through the Python SDK.
ingest_end_to_end.py Ingest overlapping image directories, inspect deduplication, and approve a partitioned batch.
http_end_to_end.py Run the workflow against a local HTTP server with a bearer token.
cli_end_to_end.sh Create a release from a shell and check CLI output and exit codes.
mcp_end_to_end.py Start visionset mcp and run the workflow over stdio.
thirty_minute_flow.py Time the workflow from photographs to a YOLO export and load the output with a trainer.
task_workflows.py Take each of nine labeling tasks from generated media to an export that a tool other than VisionSet reads. See every task, end to end.
uv run python examples/sdk_end_to_end.py
uv run python examples/ingest_end_to_end.py
uv run python examples/http_end_to_end.py
uv run bash examples/cli_end_to_end.sh
uv run python examples/mcp_end_to_end.py
uv run python examples/thirty_minute_flow.py
uv run python examples/task_workflows.py

None of the seven needs a media binary of any kind any more. A video is decoded in the browser, or by the system FFmpeg when one is installed (a server-side ingest), so no example needs a decoder program, and ingest_end_to_end.py and thirty_minute_flow.py are both stills-only. task_workflows.py posts generated clip frames the way the browser posts the frames it decoded. See ingest.md for where a video import actually lives.

Why M3 has three. The standing rule is one example per milestone. M3's exit criterion is the same flow three ways - REST, CLI, MCP - so for this milestone the count is the deliverable rather than an exception to it. The three run as a matrix in CI, one job each, so a failure names the surface that broke.

The HTTP, CLI and MCP examples assert their outcomes in the CI e2e matrix. The SDK and ingest examples also run as pytest smoke tests. CI runs the thirty-minute flow from the installed wheel, in addition to its source-level smoke test.

The SDK, ingest, HTTP, CLI and MCP examples also run against the installed wheel, from a temporary directory outside the repository, in the CI wheel job and on every Python version wheel-python-versions covers (tests/packaging/test_installed_conformance.py). The Python examples run under python -I, so neither examples/ nor the working directory is on the import path, and the venv's bin/ comes first on PATH, so visionset and python3 are the wheel's. None of the five needs anything from the source tree. To reproduce one:

bash scripts/build_dist.sh
uv venv /tmp/vs && uv pip install --python /tmp/vs dist/*.whl
cd /tmp && PATH=/tmp/vs/bin:$PATH python -I "$OLDPWD/examples/http_end_to_end.py" /tmp/http-e2e

Cross-surface parity. The examples show that each surface works; they do not show that the four agree. tests/surfaces/test_cross_surface_parity.py runs one table of operations - schema versions, batch creation, annotation writes, release publishing, export and its consent check, ingest, dataset import and its consent check, job cancellation - with the same input on a fresh workspace per surface (the SDK, REST, the CLI with --json, and MCP). Ids, timestamps and paths are scrubbed, and the results, the refusal codes and details, and the exported file set with each file's content hash must be equal. Operations a surface does not offer - batch creation and annotation writes on the CLI, job cancellation on the CLI and MCP, dataset import on REST - are named rows in the same file, each with its reason and the sentence in the docs that states it, asserted against the real command tree and tool list, so adding one fails a test until the row moves into the table on purpose.

They overlap by design and none subsumes another. The SDK example walks the whole cycle and treats ingest as one stage of thirteen; the ingest example stops at an approved batch and spends its length on where assets come from - two sources over one file, dedup, progress and the per-file report. The three surface examples walk the whole cycle again, and what they prove is not the cycle but the surface. The thirty-minute flow walks it once more and ends outside the product, at a trainer loading what came out.

What the three surfaces do not share

Driving one cycle three ways is what makes the differences legible, and they are all deliberate:

  • Ingest is asynchronous over HTTP and synchronous over MCP. The API answers 202 with a job row and hands the work to a background worker, so a client polls; the MCP tool returns when the work is done. A stdio server has no worker to hand anything to, so a job an agent had to poll would block for exactly as long as doing the work. Same capability, two honest shapes - and the remedy for an interrupted MCP run is to call ingest again, which is free.
  • Only HTTP uploads bytes. Registration over the API is upload-only, because an HTTP client has bytes and not a path on the server's filesystem; the CLI and MCP both hand over a path, because both run beside the workspace. The server's content-addressed staging area exists for exactly that gap and has no other caller.
  • Only MCP has to scale its coordinates. get_asset_image sends a preview capped at 256 pixels on its long edge while annotation geometry is always in the asset's own pixels, so an agent measures in one frame and writes in another. No other surface shows an image at all.
  • The CLI's cycle walk writes no labels. job mark records progress only, so a release from a walk that only marks honestly reports annotation_count: 0; visionset annotation writes the labels from a JSON payload.

The SDK example

The cycle

Stage What happens Owned by
Workspace WorkspaceService.init creates visionset.db and blobs/ workspaces.md
Subscribe event_bus.subscribe(DomainEvent, ...) - the catch-all, matched by type events.md
Project ProjectService.create - the 1:1 dataset is created in the same transaction projects.md
Schema SchemaService.create_version - version 1 of the labeling contract schemas.md
Source six generated PNGs written to incoming/, registered as an image directory sources.md
Assets IngestService.ingest - hashed, stored once, and put in a draft batch ingest.md
Batch approve(BySize(size=3)) → 2 jobs, schema pinned batches.md
Work JobService.start / next_pending / mark, one asset deliberately skipped jobs.md
Labels AnnotationService.add - a box, a polygon and a whole-frame tag per asset annotations.md
Trunk DatasetService.promote - five assets, not six datasets.md
Release ReleaseService.publish, then verify, manifest and assignment releases.md

Three things it is built to demonstrate

A skipped asset settles its job but never reaches the trunk. One of the six frames is marked skipped instead of being labeled. That is enough for JobService.complete - skipped is in SETTLED_PROGRESS, the set named for does-not-block-completion - but it is absent from PROMOTABLE_PROGRESS, so the trunk ends up with five assets. Two sets, two questions, and the example makes the difference visible rather than describing it.

Publishing twice from an unchanged trunk produces the identical document. The example publishes v1.0, changes nothing, and publishes v1.1; the two releases carry the same manifest_hash and therefore share one blob. That is a consequence of the manifest being a pure function of content - no timestamp, no tag, no release id inside it - rather than something the service arranges.

The manifest hash still differs between two runs, and that is correct. A manifest names asset and annotation ids, which are fresh UUIDs every time; a manifest hash is a snapshot identity, not a universal content identity. What does hold across runs is the split: assign_split keys on content_hash, and the frames are generated deterministically from their index, so the same pictures land in the same folds on every machine. The smoke test asserts exactly that - comparing folds by content hash, never by id.

Every step goes through the service that owns it

That sentence used to carry an exception. Creating an Asset had no door, so the example wrote the row by hand - through the same public port a service uses, commented as the one place it reached below one, and flagged in three files as something #20 would delete. It did:

incoming = _write_frames(dest / "incoming", FRAME_COUNT)
source = sources.register_images(project.id, incoming)
ingested = ingest.ingest(source.id, batch_name="batch-001")

The frames go to disk, the folder is registered as an origin, and ingest hashes them, stores the bytes once and puts them in a draft batch - which is what a real caller does with a real folder of photographs. BatchService.create disappeared from the example along with it: the ingest is what makes the batch now.

The frames are still generated by the example's own six-line PNG encoder rather than by Pillow, which is a dependency these days. Their bytes are fixed, and that is the point: an asset's identity is the SHA-256 of its content and the split keys on content hash, so the same pictures land in the same folds on every machine. (The ingest example does reach for Pillow - it is not carrying a determinism argument about folds.)

Why three classes for "two classes"

A LabelClass accepts a set of geometries, so one class could carry all three shapes - and these are three classes anyway, because they mean three different things rather than three shapes of one thing. stop-sign, lane-marking and weather is what an ontology looks like; a single class accepting a box and an outline is what one object looks like from two distances. Exactly one attribute is required (occlusion on stop-sign), which is what makes MissingRequiredAttribute a live rule in the example rather than a paragraph.

No committed media, ever

The frames are built by a short PNG encoder using only zlib and struct: a signature, an IHDR chunk, zlib-compressed filter-0 scanlines in IDAT, and IEND. It was written when M1 had no image library to lean on, and it stays for the reason in the section above rather than out of nostalgia. v1 of this product shipped 929 MB of images into git history, which is why **/workspace-data/ is ignored and why an example that needs pictures makes its own.


The ingest example

Where sdk_end_to_end.py treats ingest as one stage, ingest_end_to_end.py is about nothing else. It ingests a folder of fifty photographs with one file that is not an image, re-ingests the same folder to show that creates nothing, ingests a second folder that overlaps the first by content, and stops at an approved batch cut into two jobs. Nothing is annotated and nothing is released. Video is not exercised: decoding one needs the browser or an installed FFmpeg, which an example does not assume - see ingest.md.

What it does

Stage What happens Owned by
Project ProjectService.create + SchemaService.create_version - one class, because approval needs a version to pin projects.md, schemas.md
Source register_images over a folder of 50 synthetic photographs plus a notes.txt sources.md
Assets IngestService.ingest → 50 assets in a draft batch; notes.txt is one reported IngestFailure ingest.md
Progress IngestService.get(job_id) → processed=50, total=50 ingest.md
Batch approve(BySize(size=25)) → 2 jobs of 25, schema pinned batches.md
Re-run the same source again → created=0, deduplicated=50, same asset ids ingest.md
Second folder 2 photographs byte-identical to the first folder's, 8 new → a different source, created=8 sources.md
Previews every asset carries a thumbnail_hash media.md

Three things it is built to demonstrate

A directory states its total before the first file. IngestJob.processed climbs to 50 against total=50, both written to the row as the run goes, which is what makes them pollable from another process rather than a return value dressed up as progress. The stray file is reported, not skipped: notes.txt produces one IngestFailure - name, kind, reason, where the reason never repeats the name so a surface can group by kind instead of reading prose - and the run still ends completed, because guessing which files an operator meant to offer is a policy the kernel would be inventing.

Two different sources can hold the same asset, and identity does not care which one got there first. The second folder is a distinct Source - a different directory is a different origin - but two of its photographs are byte-identical to ones the first folder already ingested, and content addressing collapses them on sight: created=8 for ten files offered, not ten. Their recorded origin stays the first folder's, because origin is provenance and provenance is never rewritten once an asset exists.

Re-ingesting a source is a no-op that still succeeds. Running ingest again over the exact same source creates nothing (created=0, deduplicated=50) and returns the same asset ids in a new draft batch, because a batch is an ephemeral unit of work and two may legitimately name the same assets. That is the whole remedy for an interrupted run: content addressing means a redo costs re-hashing and nothing else.

The stills are Pillow's work - a real dependency since #16 - written with write_stills, a small deterministic pixel generator that lets the second folder reuse a couple of indices from the first and get byte-identical overlap without copying a file.


The HTTP example

What it does

Stage What happens
Setup WorkspaceService.init then TokenService.create - the last SDK lines in the file
Serve visionset server --host 127.0.0.1 --port <free> --workspace <root> as a subprocess, polled at /health until it answers
Project POST /projects, POST /projects/{p}/schema/versions
Upload POST /projects/{p}/sources/images - four PNGs as multipart/form-data, built by hand
Ingest POST /sources/{s}/ingest-jobs → 202 + Location, then GET /ingest-jobs/{id} until it settles
Batch approve with {"kind": "by_size", "size": 2} → start → GET /batches/{b}/jobs
Annotate per job: start, GET /jobs/{j}/next?n=10, POST …/annotations, read them back, PUT …/progress, complete
Trunk complete → promote → GET /datasets/{d}/stats
Release POST /datasets/{d}/releases, GET …/manifest, GET …/verify
Export GET /formats → POST /releases/{r}/export?format=coco → a zip on disk
Recipe POST /projects/{p}/preprocessing-recipes, then POST /releases/{r}/export?target=yolo11&recipe=yolo-640 - refused 409 LOSSY_EXPORT_NOT_CONSENTED until allow_lossy=true - and the archive is opened for preprocessing.recipe_hash in visionset-export-report.json and a labels/train/<hash>-aug1.txt beside its image
Pixels GET /projects/{p}/assets/{a}/content, hashed against the asset's content_hash
Refusal the same request with no Authorization header → 401 UNAUTHORIZED

Four things it is built to demonstrate

The contract is reachable from anything that speaks HTTP. The walk uses urllib.request and nothing else - not httpx, not requests, not curl. That is two arguments at once: httpx is a development dependency, so an example using it could not run from an installed wheel; and a contract only a smart client can drive is not really a contract. The multipart body is twenty-odd lines in the file, written out rather than delegated, and it is the price of the claim.

The server actually starts. tests/cli/test_server.py patches uvicorn.run and asserts the arguments, which is right for a unit test and says nothing about whether the process comes up. This example binds an ephemeral port, spawns the shipped command against it, and waits for /health - the one unauthenticated route, and therefore the readiness probe. If the process dies at startup the example reports its exit code rather than timing out and reading like a slow machine.

Launch-and-poll, which no other example shows. Ingest over HTTP returns before the work does, so the client watches a job row. The example counts its polls and puts the number in its summary, which is a small way of saying out loud that at least one round trip happened after the launch.

The manifest arrives byte for byte. sha256(body) == release["manifest_hash"] is the single best assertion in the walk: the route streams the stored blob, and a build that parsed and re-dumped the document would put its own JSON encoder between a client and the bytes the hash is of. Nothing else in the walk would notice.

What it deliberately does not need

No HTTP client library, no jq, and no file on disk for its inputs - the four PNGs are built in memory and uploaded as bytes, because that is what an HTTP client has. Its one requirement is that visionset is on PATH, which uv run arranges.


The CLI example

What it does

examples/cli_end_to_end.sh is M3's exit criterion - the full cycle without touching Python - written as the thing that criterion describes. It runs visionset init, project create, schema apply, ingest, batch approve/start/complete/promote, a job loop, release publish/verify, format list and export, then recipe create, an export --check preflight and a second export --target yolo11 --recipe yolo-640, and then asserts - on the release's --json, and on the recipe export's report and its three -aug1 train variants. The release holds no labels, so the preflight finds nothing to drop and exits 0, and the export needs no --allow-lossy; the HTTP example is the one that meets the consent question.

Three things it is built to demonstrate

Ids travel on stdout. WS=$(visionset init "$DEST/ws"), BATCH=$(visionset ingest …), and every listing read with tail -n +2 | awk '{print $1}' - which works because a header always prints and the first column is always an id. Nothing here parses prose.

The workspace is stated once. export VISIONSET_WORKSPACE="$WS" after init, and no command after that carries -w. That is the environment-variable branch of the resolution rule, and it is the branch a script should use: the flag is for a one-off, and the upward walk is for a person standing in a project directory.

--json is stable enough to assert on. Step 9 pipes release list --json through python3 and checks the envelope, the tag, the asset count and the split recipe - which is the "--json outputs stable, documented shapes" acceptance criterion, tested rather than promised.

There is a fourth, at the end: a deliberate refusal. Publishing v1.0 twice exits 1 with one sentence on stderr, and the script asserts that it did. A command inside an if condition does not trip set -e, which is what makes demonstrating a failure safe.

What it deliberately does not need

Media of any kind. Its images are six PNGs plus one notes.txt that is deliberately not an image, so the per-file report has something in it. No jq, because the column format is designed to be read with awk. No curl and no server: the CLI calls the SDK in-process, which is the whole point of it being a sibling of the REST API rather than a client of it.

python3 appears twice - once to write PNGs, because a shell cannot, and once to assert on a JSON document. Neither touches the SDK.

The honest note it carries

Every asset in this run is marked annotated and carries no labels. Drawing a box is the app's job; visionset job mark records that somebody did it. So the release reports annotation_count: 0, the manifest says so, and the smoke test asserts it - rather than the script quietly leaving the impression that a terminal can label images.


The MCP example

What it does

Stage What happens
Setup WorkspaceService.init - the only SDK line, and it has to be one: creating a workspace is deliberately not a tool
Connect stdio_client(StdioServerParameters(command="visionset", args=["mcp", "--workspace", root])) → ClientSession → initialize()
Discover list_tools() → the tools this server advertises, then list_projects on an empty workspace
Project create_project, create_schema_version, get_schema
Ingest ingest with a local path - one call, and it returns when the work is done
Batch approve_batch(jobs_of=2) → start_batch
Look per asset: get_asset_image → a base64 image block beside width/height/image_width/image_height/scale
Annotate add_annotations with every edge multiplied by scale, then set_asset_progress for the rest, then complete_job
Trunk complete_batch → promote_batch → dataset_stats
Release publish_release, list_releases, verify_release
Export list_formats → export_release(format="coco", dest=…) - a directory, not an archive; a format addresses no trainer, so this is the plain-format call and the Recipe row below is the same release addressed by target
Recipe create_preprocessing_recipe, list_preprocessing_recipes, then export_release(target="yolo11", recipe="yolo-640", allow_lossy=True, dest=…) - the result's preprocessing names the recipe under its hash and maps the train fold's -aug1 variant to its source, and both files are on disk
Refusal publish_release on the same tag → a result carrying an error envelope, retry_with null

Four things it is built to demonstrate

The transport, which nothing else proved. Every test under tests/mcp/ drives the protocol over a paired in-memory stream inside one process. That proves the tools themselves and says nothing about the pipe. Meanwhile tests/cli/test_mcp_command.py pins visionset mcp thoroughly - and mocks subprocess.run, so before this example no JSON-RPC byte had ever crossed that command. Here the client spawns exactly what an MCP configuration spawns, and the workspace travels the way it really travels: resolved by the CLI, opened once to run any migration, stated in VISIONSET_WORKSPACE, and inherited by the server it starts.

One session for the whole walk. tests/mcp/_flow.py opens a fresh session per call, which is convenient for a test and is not what a client does. Holding one open is safe because the server opens and closes the workspace inside each tool call - so a long-lived session holds no SQLite handle and locks nobody out of visionset server.

The pixels an agent sees are not the frame its coordinates live in. The frames are 640×480 on purpose. The preview is capped at 256 pixels on its long edge, so what arrives is 256×192 and scale is 2.5. Every box the example submits is multiplied by it, and the smoke test asserts scale > 1 - because if a future change made previews full size, the example would still pass while demonstrating nothing. An unscaled box would be individually plausible and uniformly wrong, and nothing downstream could detect it: every number would be in range and every shape well formed.

A refusal is a result, not an error. There are two failure shapes over MCP. A malformed request comes back with isError set and the validator's field path; a domain refusal comes back as an ordinary result whose payload is an error envelope, because the call was well formed and the answer is no. The example ends on the second kind and checks every key - that the code is RELEASE_TAG_TAKEN, as over REST, and that retry_with is null, because a release is immutable and no flag makes a reused tag work. That is the distinction a status code could not carry.

What it deliberately does not need

No development dependency: mcp is a runtime dependency, so its client half ships with the package, and the async bridge is asyncio.run from the standard library rather than the anyio.run the tests use. No server, no port. Its one requirement is visionset on PATH.


The thirty-minute flow

What it does

examples/thirty_minute_flow.py is the sentence the product exists for, written as a program: fifty photographs become fifty boxes, a verified release and a YOLO dataset ultralytics agrees to load. It drives the SDK the way the SDK example does and ends where none of the others do — at a trainer reading the output.

What makes it different from the other five

It is a gate rather than a demonstration. Every stage is named, timed and asserted against a wall-clock ceiling, so a change that makes the cycle slower fails rather than being noticed later by somebody with a stopwatch. The other five assert on outcomes; this one asserts on outcomes and on how long they took.

CI runs it from the installed wheel. The 30-minute flow (wheel, end to end) job builds the distribution, installs it into an empty virtual environment together with ultralytics, and runs this file from a working directory that is not the repository. What it exercises is therefore what pip install visionset gives somebody — entry points and plugin discovery included — rather than what a source checkout happens to resolve. That is the half no source-tree suite can cover, and it is why this example is also the check the beta cannot ship without.

Locally it degrades honestly. Run against the source tree it skips the ultralytics step when the library is absent and says so, rather than passing quietly with the last stage missing. tests/examples/test_thirty_minute_flow.py runs the same file in process on every push, which is the cheap half.

What it needs

No media binary at all. Its fifty photographs are Pillow's work, the same write_stills helper the ingest example uses. ultralytics is optional locally and required in CI. It writes into ./thirty-minute-flow with no argument, or wherever you name.

Every task, end to end

What it does

examples/task_workflows.py takes each required task through one lifecycle, in one workspace, with one project per task:

flowchart LR
    M["generated media<br/>stills, clip frames, PCD scans"] --> I["ingest under<br/>4 capture groups"]
    I --> A["author<br/>(SDK)"]
    A --> R["review: one label<br/>sent back, corrected"]
    R --> P["accept, complete,<br/>promote"]
    P --> C["quality report,<br/>remove one asset,<br/>correction batch"]
    C --> S["publish v1,<br/>grouped split, verify"]
    S --> X["recipe where allowed,<br/>preflight, export"]
    X --> O["independent<br/>consumer"]
Loading

Every stage goes through the service that owns it. The review is the job's own progress table: every asset is submitted (review_pending), one is sent back (annotated), its first label is corrected and resubmitted, and all are accepted. After promotion the quality report must hold no blocking issue, one asset is removed from the trunk, and a correction batch edits a second asset's label. The release is cut by group_by="group_label" at 0.5/0.25/0.25 over four capture groups, so each group lands whole in one fold. Export consent is given only for what the preflight reported (allow_lossy=report.consent_required).

uv run python examples/task_workflows.py                     # into examples/workspace-data/task-workflows
uv run python examples/task_workflows.py ./scratch --only obb,tracking
uv run python examples/task_workflows.py ./scratch --only augmentation --train
uv run python examples/task_workflows.py ./scratch --train   # adds the training steps

Without the reader libraries the run takes a few seconds and records each third-party consumer as skipped. VISIONSET_REQUIRE_READERS=1 turns a skip into a failure. tests/examples/test_task_workflows.py runs it in the existing python job: every task reaches a verified release, the curated asset is in no release, no capture group straddles two folds, and the augmentation run's refusal and train-only checks ran.

Each task's path

The example authors every label through the SDK. The other routes column names where a person does the same work. The CLI authors labels with visionset annotation and pre-label.

Task Media Other routes for authoring Pre-processing in the example Exports read Consumer and depth
Classification stills browser tag controls, REST, MCP letterbox and hflip on classification-dir classification-dir, yolo11 target ultralytics: loaded, trained one epoch (classification-dir)
Bounding-box detection stills browser box tool, REST, MCP letterbox and hflip on the yolo11 target coco, yolo11 target pycocotools: loaded; ultralytics: loaded, trained one epoch
Instance segmentation stills polygons: browser, REST, MCP; masks: REST, MCP, SDK, importers letterbox and hflip on the yolo11 target coco, yolo11 target pycocotools: masks decoded; ultralytics: loaded, trained one epoch
Semantic segmentation stills masks: REST, MCP, SDK, importers; polygons from the browser are rasterized on export hflip segmentation-png Example reader (Pillow); torch: a small conv net trained 40 steps, loss falls
Oriented boxes stills browser oriented-box tool, REST, MCP hflip on dota dota, yolo-obb ultralytics DOTA converter: read, matched against the yolo-obb export, trained one epoch on the converted tree
Keypoints and pose stills REST, MCP, SDK, importers, or the browser's keypoints tool brightness_contrast (flips are refused under a pose target) coco, yolo11 target COCOeval: keypoint AP 1.0 against itself; ultralytics: loaded, trained one epoch
2D lanes stills browser polyline tool, REST, MCP hflip on tusimple tusimple, culane, openlane-2d Example readers: every TuSimple sample within 1 px of a drawn lane, flipped variants mirrored; CULane rows parsed
Video tracking four generated clips, frames posted as the browser posts them browser video import and the Tracks popover, REST none: unverified for tracks mot, cvat-video motmetrics: MOTA and IDF1 1.0 against itself, identity swaps cost switches; cvat-video tracks parsed
Point-cloud cuboids generated binary PCD scans with a car-sized cluster browser cuboid tool and 3D view, REST, MCP; kitti and nuscenes importers refused by preflight: a recipe transforms images only kitti pykitti reads calibration and scan when installed; example label parser; the exported box encloses the same points the drawn cuboid does
Augmentation (augmentation) stills: many cars, few signs, some images with nothing browser box tool, REST, MCP; the recipe also from the browser recipe editor or visionset recipe create --preset detection --balance uniform object_safe_crop, then the detection preset, uniform balance, 4 variants at most coco, yolo11 target, each with the recipe; yolo11 without it pycocotools: loaded, labels counted against the report; ultralytics: loaded, trained one epoch; example checks of folds, counts and replay

The augmentation run

augmentation is detection again with a training recipe a person would use: the detection preset read from the catalog with recipe_preset("detection"), an object_safe_crop in front of it (it must come before every step that moves a label), and a uniform balance. The schema is deliberately lopsided: one image in three holds a car and a sign, one holds three cars, and one holds nothing and is submitted as annotated with no labels. The run then shows, in order:

  1. Consent is genuinely required. coco writes every box, so its preflight without the recipe asks for none; with the recipe it reports the labels the crop and the holes drop or cut down. The export without allow_lossy raises LossyExportNotConsented and the destination is never created. The export that follows passes exactly allow_lossy=report.consent_required.
  2. pycocotools reads the coco export of the recipe. Its label count over the three folds equals the release's labels plus every copy the balance planned, less the copies the report says the augmentation cut, and no variant image is in the validation or test file.
  3. Train only. A yolo11 export without the recipe and one with it are compared file by file: every validation and test image and label is byte-identical, and every -aug file is under train.
  4. The preflight is what was written. assess_recipe before the export and the report after it agree on the balance, the files per fold, the variants and the copies cut; the variant label files hold at most the copies planned per class. Sign rises toward the target and car rises with it, because a variant copies every label on its image and the car-and-sign images are the ones balanced.
  5. The report replays. replay_export_report(read_export_report(...), export_environment(drivers)) answers match.
  6. ultralytics loads the balanced export, and with --train trains one CPU epoch on it.

A recorded run (--only augmentation --train, VISIONSET_REQUIRE_READERS=1, CPython 3.13 on Linux x86_64, ultralytics 8.4.220, pycocotools 2.0.11): 11 released assets and 20 labels; the coco preflight with the recipe reports 1 label dropped and 7 cut down; the balance takes sign from 2 to 8 training labels (target 8) and car from 8 to 14 with 6 variants over the two car-and-sign training images; 11 variant labels are written (6 car, 5 sign, 1 cut); pycocotools counts 31 labels (21 train, 5 val, 5 test); 6 plans replay as match; the epoch ends with finite losses. pycocotools and ultralytics are the third-party readers; the fold, count and replay checks are the example's own and run without them.

A real video file is decoded in the browser by WebCodecs, or by an installed FFmpeg; see ingest. The example posts the frames a client already materialized to the video-import session, with no decoder involved. A labeled nuScenes or KITTI dataset is imported through the CLI or MCP with visionset import; import gives the layouts, and real-data checks are opt-in (see where the data comes from).

Running the readers

The readers come from the yolo, coco and mot dependency groups at the locked versions. Put them in a separate environment: the ultralytics wheel ships a top-level tests package that shadows this repository's.

uv export --locked --group yolo --group coco --group mot --no-hashes --no-emit-project > /tmp/readers.txt
uv venv /tmp/readers && uv pip install --python /tmp/readers -r /tmp/readers.txt
uv pip install --python /tmp/readers --no-deps .
bash scripts/cooldown.sh uv pip install --python /tmp/readers pykitti   # optional
cd /tmp && VISIONSET_REQUIRE_READERS=1 YOLO_OFFLINE=true PATH=/tmp/readers/bin:$PATH \
  python -I "$OLDPWD/examples/task_workflows.py" /tmp/task-workflows --train

pykitti is in no dependency group. It is installed through the cool-down wrapper, and without it the example reads the calibration and the scan itself.

Recorded run

Run on 2026-12-01 on Linux x86_64 with CPython 3.12, on the branch that adds the example, with ultralytics 8.4.220, torch 2.15.0, pycocotools 2.0.11, motmetrics 1.4.0, numpy 2.5.3 and pykitti 0.3.1, --train and VISIONSET_REQUIRE_READERS=1. Every consumer in the table above ran, none was skipped, and every training step finished with finite losses. One epoch on a dozen generated pictures learns nothing; the numbers say that the layout survives each library's loader, loss and validator, not that a model is any good.

What it adds to the evidence

Task Already shown before this example Added
Classification, detection, instance segmentation, pose format-smoke loads and trains each export; cycle.spec.ts and curation.spec.ts walk the browser cycle and curation The full lifecycle in one script, with review, correction, curation, a grouped split and a recipe before the reader
Oriented boxes ultralytics trains on yolo-obb; dota had fixtures and round trips only ultralytics' own DOTA reader, convert_dota_to_yolo_obb, reads the dota export into the release's rectangles, also in format-smoke (test_ultralytics_roundtrip.py); the example trains on the converted tree
Semantic segmentation A test-local PNG decoder A training step over the masks; still no third-party layout reader
2D lanes Test-local readers of all five layouts The lifecycle only; no third-party lane tool
Video tracking motmetrics loaded the export motmetrics scores it, also in format-smoke (test_mot_motmetrics.py)
Point-cloud cuboids A test-local parser checks hand-computed values A geometric check: the exported box, moved through the exported calibration, encloses the same scan points as the drawn cuboid; pykitti reads the calibration and scan
Augmentation Kernel tests of each step, the balance plan and the replay; the browser recipe editor One preset, a balance and a label-reading crop through real exports: refused without consent, held-out folds byte-identical to a plain export, preflight counts equal to the files written, read by pycocotools and trained on by ultralytics

What it does not show

  • Recipe semantics are owned by pre-processing; the example uses one preset, one balance policy and one label-reading crop, and repeats none of the rules.
  • Model-assisted labeling is documented in inference (#1317), and installing the agent plugins in agent plugins (#1255). The example repeats neither.
  • No 3D training: no trainer task exists for cuboids. No third-party reader exists here for segmentation-png or any lane format, and the kitti label row is parsed by the example.
  • TuSimple refuses a lane whose points do not run top to bottom; the other four lane writers accept one drawn either way. The example draws its lanes top to bottom.

Reproduce the independent-consumer evidence

What it is

The support matrix names, for each task, whether a reader that is not VisionSet's own plugin has consumed an export. The format-smoke CI job is where that happens. It is a CI job and a set of test files, not a command: visionset format has only list and matrix.

uv sync --locked --group yolo --group coco --group mot
VISIONSET_REQUIRE_ULTRALYTICS=1 VISIONSET_REQUIRE_PYCOCOTOOLS=1 VISIONSET_REQUIRE_MOTMETRICS=1 \
YOLO_OFFLINE=true MPLBACKEND=Agg \
  uv run pytest tests/formats/test_ultralytics_roundtrip.py tests/formats/test_ultralytics_train_smoke.py \
    tests/formats/test_coco_smoke.py tests/formats/test_mot_motmetrics.py
uv sync

Run only those files. The ultralytics wheel ships a top-level tests package that shadows this repository's, so run uv sync again afterwards. The three VISIONSET_REQUIRE_* variables turn a missing library from a skip into a failure, so a green run means the readers ran.

What each reader checks

Reader Pinned version (uv.lock) What it checks Test file
ultralytics 8.4.220 Loads the YOLO exports; trains one CPU epoch on detect, segment, pose, yolo-obb and classification-dir output and finds the loss finite; converts the dota export with its own DOTA reader and finds the release's rectangles test_ultralytics_roundtrip.py, test_ultralytics_train_smoke.py
pycocotools 2.0.11 Loads the COCO export test_coco_smoke.py
motmetrics 1.4.0 Loads the mot export as MOT15 2D and scores it against its source: MOTA and IDF1 1.0, and two switches when two identities are swapped. The IoU distances are computed in the test, because motmetrics' own iou_matrix calls np.asfarray, which NumPy 2 removed test_mot_motmetrics.py

The pins are the versions the lockfile resolves, and CI syncs with --locked. Other readers named in the matrix (semantic PNG, the five 2D lane formats, cvat, open-images, tfrecord, yolov5-yaml, the kitti export) are test-local readers written from each format's published layout. They are not third-party tools, and a misreading shared with their author is not caught.

Where the data comes from

No third-party dataset is committed. The pictures are generated by tests/fixtures/media.py, and the point-cloud and annotation fixtures are written by the test modules themselves, so CI needs no download and no licence.

Real KITTI and nuScenes checks run only when VISIONSET_POINTCLOUD_SAMPLES names a directory outside the repository, and never in CI. CONTRIBUTING.md states the layout, the licences (KITTI CC BY-NC-SA 3.0, nuScenes Terms of Use, non-commercial) and the rule that these files are never committed. The repository records no hash of its own for them. The nuScenes checks also run on a subset of v1.0-mini's scenes: the scene counts follow the keyframes present, and the mean point-count bound, which was measured on the full 18,538 annotations, is skipped visibly on a subset. The samples used for the recorded runs are:

  • KITTI object detection frames 000000 to 000002 (velodyne, label_2, calib), as redistributed by the kitti_object_vis project. The velodyne files have SHA-256 0e09c85e3f6078ecbdd1e706ee9624519f1bd29417437167a9ed7fbe6f54b4b1, 59a02fdaaab3b7e903713cb618e8f53efcaf71c144436ddfcdf4f28bdbd73d20 and 8bffebb1a97e4c5a13083a84934d68030e6c137f86a4e43d45698ba1f8106c43.
  • The full nuScenes v1.0-mini archive (10 scenes, 404 LIDAR_TOP keyframes, 18,538 annotations), registration-gated at the publisher. The archive v1.0-mini.tgz has SHA-256 e5d9c2b5ced29f9e3d39651e2093d27e892d0571f10962409974b21033a254ee; the JSON tables and LIDAR_TOP files were checksummed after extraction, for example sample_annotation.json at 49703705e98ddea281ca321aae3b7352a8b6495840fe654cf0717c5b7b721080 and sample_data.json at db18a189bd73648013d3e77ce6f5236d7c5997c0bdbf71166ddd8a6cb5c2c288.

What it does not show

  • A generated fallback is not real-world field validation. A tiny synthetic dataset proves that a layout parses and a step runs, not that it holds up on data somebody collected.
  • VisionSet ships no trainer. The one-epoch runs use ultralytics from a model built from its yaml, offline (YOLO_OFFLINE=true), and assert finite losses. No accuracy and no performance is promised.
  • Some formats have no independent reader at all, among them coco-panoptic. The support matrix owns the per-task status and limits.