Skip to content

feat(data): pluggable label-format adapters (COCO/YOLO/VOC ingestion)#342

Open
stanlrt wants to merge 13 commits into
mainfrom
338-label-format-adapters
Open

feat(data): pluggable label-format adapters (COCO/YOLO/VOC ingestion)#342
stanlrt wants to merge 13 commits into
mainfrom
338-label-format-adapters

Conversation

@stanlrt

@stanlrt stanlrt commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds pluggable label-format adapters so users can point data.labels.format
at standard annotation files and RAITAP converts them to its native label shape
before alignment. No more hand-reformatting COCO/YOLO/VOC labels. Closes #338.

  • New LabelFormat enum (native/coco/yolo/voc) + LabelsConfig.format
    field. native is the default and a no-op (zero behaviour change).
  • Lightweight adapter registry + @label_format decorator +
    resolve_label_format_adapter, mirroring task_families/registry.py.
  • Adapters: COCO (detection + classification), YOLO (detection),
    Pascal-VOC (detection). COCO/YOLO category ids pass through unchanged
    (preserve the model's label space); VOC class names map via
    model.class_names order, else the standard 20-class VOC order.
  • Dispatch wired into DetectionFamily.load_labels and
    load_classification_labels; both reuse the existing id-alignment logic via
    an extracted _align_detection_records helper.
  • Built via the spec-driven subagent workflow: per-task implement + spec/quality
    review, plus a final whole-branch review (verdict: ready to merge).

Notes / follow-up

  • Detection adapters match sample_id by exact image-file name (flat image dir);
    classification still honours labels.id_strategy. Documented in
    docs/modules/data/configuration.md. A follow-up to unify detection with
    id_strategy (+ e2e YOLO/VOC dispatch tests) is recommended.

Checklist

  • CI — Required checks are green
  • Breaking changes — Not a breaking change: data.labels.format defaults
    to native, which preserves prior behaviour exactly. Title has no !.
  • Contributor guide — I've read Pull requests and commit messages
    before requesting review.

Optional

Comment thread src/raitap/data/label_formats.py
Comment thread src/raitap/data/label_formats.py
Comment thread src/raitap/data/tests/test_label_formats.py Fixed
Comment thread src/raitap/data/tests/test_label_formats.py Fixed
Comment thread src/raitap/data/_label_format_adapters.py
Comment thread src/raitap/data/tests/test_label_formats.py
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.

Implement pluggable label-format adapters (COCO / YOLO / VOC ingestion)

1 participant