Jump to the manifest
annotations-improve-features.namespace.yaml: apply it with one API call, then read the walkthrough below to change it.At a glance
How the pieces connect
Buckets hold what you upload, collections turn it into searchable documents, and retrievers answer queries over the collections.Deploy it
1
Get the manifest
2
Validate it
Validate runs every check apply runs and creates nothing. Fix each entry in
errors, then run it again.3
Apply it
Apply creates every resource in one call. The response lists each resource with its outcome in
wait_for_seed=true also waits until the sample objects are processed, so the first query below has documents to return.resources. Apply refuses a resource that already exists and rolls the whole apply back, so to apply the file again over this namespace add ?mode=create_missing, which creates only what is missing.Run the first query
Look up the namespace id by name, then rundetection-review. Check status and warnings along with documents: a run that times out still answers 200, with status degraded.
Add your own data
Each object you add to a bucket is processed by every collection that reads it. This adds one object tocamera-frames. NAMESPACE_ID is the id from the namespace lookup above.
PENDING until processing finishes, then COMPLETED or FAILED. Buckets and objects covers object states, retries and duplicates.
Retrievers
detection-review
The review queue: the crops that look most like a class you name, each with its frame, tile and camera.
Stages: feature_search
Searches: frame-crops
class-lookup
The taxonomy’s matcher: the verified example closest to a crop’s vector, if it scores at least min_score.
Stages: feature_search
Searches: verified-set
Collections
Each collection runs one extractor over a bucket, or over another collection’s documents.frame-crops
frame-crops
image_extractor@v1 over bucket camera-frames: each frame indexed whole (tile 0) and as 6 crops (tiles 1 to 6). Labeled by object-labeler; feeds detection-review and crop-groups.Reads bucket
camera-frames with image_extractor v1.Inputs: image ← imageCopied onto each document: camera_idverified-set
verified-set
image_extractor@v1 over bucket verified-objects. The examples object-labeler matches each crop against.Reads bucket
verified-objects with image_extractor v1.Inputs: image ← imageCopied onto each document: object_classAlso created
Taxonomiesobject-labeler: Copies object_class from the closest verified example onto each crop.
crop-groups: Groups the crops by appearance, to find object classes the verified set does not cover yet.
The manifest
Every resource above comes from this file. Change it and apply it again with?mode=upsert to update what exists. Manifests documents each field.
annotations-improve-features.namespace.yaml
Hand it to an agent
Paste this prompt into Claude Code, Cursor or another coding agent. To give the agent this whole page instead, use Copy page in the menu at the top of the page, or point it at the page’s Markdown athttps://mixpeek.com/docs/templates/annotations-improve-features.md.
Prompt
How it works
A detector proposes regions, people confirm or correct them, and the corrections become training data for a better detector. Here a grid of crops stands in for the detector until you deploy your own.frame-cropsrunsimage_extractorover each image incamera-frameswith a 3 by 2tile_grid. Each frame becomes 7 documents sharing aframe_key(<object_id>:0):tile_index0 is the whole frame, and 1 to 6 are the crops, row by row, each a candidate detection with its own SigLIP vector.detection-reviewis the review queue. You name a class in words, and it returns the 20 closest crops. Apre_filtersentrytile_indexgte1, backed by a payload index, keeps whole frames out.verified-setembedsverified-objects, where each image shows one object and carries its class inobject_class.- The
object-labelertaxonomy runs onframe-cropsas each crop is processed.class-lookupfinds the closest verified example scoring at least 0.30, and the taxonomy copies itsobject_classonto the crop. crop-groupsis a k-means cluster over the crop vectors, with 4 groups. You run it to look for classes the verified set is missing.
tile_index into a normalized [x0, y0, x1, y1] box. A frame processed before the verified set was indexed comes out unlabeled; Grow the verified set labels it again.
Review detections
1
Open the review queue
Run
detection-review for one class. Keep retriever_id and execution_id, so each annotation records the run it judges.cURL
object_class, when present, is the taxonomy’s guess.2
Record a verdict
Stats count labels by exact string, so keep to one vocabulary. This guide uses four:Fix a wrong verdict with
Annotate the first result.
target.region is the crop’s box and target.rank its queue position; the export reads the class and frame from payload. For missed, also set target.expected to true.cURL
PATCH /v1/annotations/{annotation_id}; earlier versions stay at .../versions.3
Record the rest of the queue in one call
POST /v1/annotations/bulk takes up to 1,000 creates, and results reports each outcome, so retry only the failures. This marks results 2 and 3 of the run above:cURL
Measure
GET /v1/annotations/stats counts annotations by label for one collection_id. The scripts below read it from COLLECTION_ID, exported here.
cURL
confirmed is the queue’s precision for the classes you reviewed; many corrected point at confused classes (read their payload.true_class). Stats are cumulative. To compare periods or retrievers, POST /v1/annotations/list filters by collection_id, label, retriever_id and actor_id, and as_of returns the set as it stood at an instant.
Export and fine-tune
Everyconfirmed and corrected annotation is a labeled box. This script writes them in the YOLO layout: images/, labels/ and a data.yaml listing the classes.
export_yolo.py
Run the export
finetune.py
Put the corrections back
Grow the verified set
Eachconfirmed or corrected crop is a verified example of its true_class. This script (it needs Pillow) cuts each crop out of its frame and adds it to verified-objects.
promote_verified.py
object-labeler to frame-crops again with reapply_all: true, and poll the returned task until COMPLETED:
cURL
min_score: 0.30 on class-lookup to label fewer crops with fewer mistakes. Bootstrap a labeled dataset covers this matching loop.
Deploy the fine-tuned detector
A trained detector runs as a custom extractor, which needs a dedicated deployment; the custom extractor quickstart walks through it. Once deployed:- Create a collection over
camera-framesthat runs it. A collection’s extractor cannot change, so the detector gets its own collection besideframe-crops. - Point a copy of
detection-reviewat it. If it writes aconfidenceper detection, apre_filtersentryconfidencelt0.7(with a payload index) sends reviewers the least certain detections. - Annotate its results the same way, with
target.regionfrom the detector’s own box. - Ship each retrained model as a new extractor version. The version is part of the feature URI, so two versions run side by side while you compare their review stats.
Automate the loop
Get a request on every verdict
A webhook calls your server on each annotation event, so it can count corrections toward the next retrain or runpromote_verified.py without polling. Webhooks belong to the organization, so the call takes no X-Namespace header.
cURL
collection.documents.written fires when a new detector version finishes processing frames. Add a signing_secret to configs and each delivery carries an X-Mixpeek-Signature header your server can verify.
Find classes nobody has labeled
Acrop-groups group whose members carry no object_class is a class missing from verified-objects. Run the cluster, then read its groups:
cURL
n_clusters in crop-groups as the frames grow:
crop-groups vector_config
verified-objects with an object_class and apply the taxonomy again. Clusters covers the other methods.
Change it
Each change edits the manifest. Apply it again with?mode=upsert.
- A finer grid.
tile_gridtakes 1 to 4 columns and rows. A 4 x 3 grid makes 13 documents per frame, about twice the cost. Update the bbox math to the new grid, and apply to a new namespace, since the grid decides which documents exist. - Review one camera. Add a second
pre_filtersentry oncamera_id, with akeywordpayload index oncamera_id, for a queue per camera. - Rank frames, not crops. Add a
group_bystage onframe_keywithmax_per_group: 1after the search, to review each frame once by its best crop.

