Skip to content

Add model-in-the-loop workflow: vp eval, autolabel, queue, YOLO-seg, semantic masks - #9

Merged
CaioWing merged 1 commit into
mainfrom
feat/model-in-the-loop
Jul 11, 2026
Merged

CaioWing merged 1 commit into
mainfrom
feat/model-in-the-loop

Conversation

@CaioWing

Copy link
Copy Markdown
Owner

What

Implements the model-in-the-loop slice of the roadmap (Phase B + Benchmarking + parts of "Later"), plus a few consistency fixes.

New commands

  • vp eval — score model predictions against a split set (test by default), turning a locked split + snapshot into a reproducible benchmark. Box tasks get per-class AP@50, mAP@50, mAP@50-95 (COCO-style 101-point interpolation) and precision/recall at a confidence threshold; classification gets accuracy, per-class P/R/F1 and a confusion matrix. --json for machine-readable output; warns when the split is unlocked.
  • vp autolabel — persist confident predictions as annotations, recorded with source.type = "model" so model labels stay distinguishable and auditable. Only unlabeled assets are touched unless --replace; --min-confidence filters objects.
  • vp queue — active-learning queue: unlabeled images first (ranked by model uncertainty when predictions are given); --include-labeled audits existing labels for ground-truth/prediction disagreement (possible missing or stale labels).

Shared infrastructure

  • visionpack/predictions.py — one loader for all three commands. Accepts vp-native JSON, COCO results/instances JSON, and YOLO txt directories (exactly what Ultralytics predict writes with save_txt/save_conf over a vp export layout). Images resolve by asset id or original filename; unmatched references and unknown classes are surfaced, never silently dropped.

Format coverage

  • YOLO-seg — imports polygon label lines (class x1 y1 x2 y2 ...) as instance-segmentation geometry; vp export --format yolo writes YOLO-seg labels for segmentation projects (or with --seg); plain boxes degrade to four-corner polygons so mixed datasets stay trainable.
  • vp export --format masks — semantic-segmentation export: 8-bit class-index PNG per image (0 = background), split-aware, with a classes.txt documenting the pixel-value mapping.

Fixes

  • vp --version now reads the installed package metadata (was hardcoded 0.1.0 while pyproject says 0.0.1).
  • Deduplicated the triplicated "Release process" section in the README.
  • Refreshed ARCHITECTURE.md (module map, roadmap checkboxes, stale test count), docs/usage.md, and CHANGELOG.

Known limitations (documented in docs/usage.md)

  • Segmentation eval uses each polygon's enclosing box; mask IoU is a follow-up.
  • YOLO-pose import/export still pending.

Testing

  • 18 new tests (test_eval.py, test_model_loop.py, test_segmentation_formats.py); full suite: 118 passing, ruff clean.
  • Verified end-to-end with the real CLI: import → split lock → vp eval (mAP 1.0 on echoed GT; precision drops correctly with an injected false positive) → vp queue → vp autolabel → YOLO-seg and masks exports.

🤖 Generated with Claude Code

…semantic masks

- predictions.py: shared loader for model predictions (vp JSON, COCO
  results/instances JSON, YOLO txt dirs incl. Ultralytics save_txt/save_conf),
  resolving images to assets by asset id or original filename; unmatched
  references and unknown classes are reported, never dropped.
- vp eval: score predictions against a split set (test by default) — per-class
  AP@50, mAP@50, mAP@50-95, precision/recall for box tasks; accuracy, per-class
  P/R/F1 and a confusion matrix for classification. --json output.
- vp autolabel: persist confident predictions as annotations with
  source.type="model"; only unlabeled assets unless --replace; --min-confidence.
- vp queue: active-learning ranking — unlabeled first (by model uncertainty when
  predictions are given); --include-labeled audits GT/prediction disagreement.
- YOLO-seg: import polygon label lines; export polygon labels for segmentation
  projects (or --seg / --no-seg).
- vp export --format masks: semantic-segmentation export as 8-bit class-index
  PNGs (0 = background), split-aware, with a classes.txt mapping.
- Fixes: vp --version now reads package metadata (was hardcoded and out of sync
  with pyproject), deduplicated README "Release process" section, refreshed
  ARCHITECTURE/README/docs and CHANGELOG.

18 new tests (118 total).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CaioWing
CaioWing merged commit 656aa9c into main Jul 11, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant