supervision/docs
Madhav-C befdb7c661
fix(dataset): make COCO annotation/image ids chainable across splits (#2267)
* fix(dataset): make COCO annotation/image ids chainable across splits (#768)

Exporting train/valid/test splits with DetectionDataset.as_coco
previously restarted image_id and annotation_id at 1 for every split,
producing three JSON files whose ids collided and could not be safely
merged into a single COCO collection.

Adds optional starting_image_id and starting_annotation_id parameters
to save_coco_annotations and DetectionDataset.as_coco (default 1 to
preserve existing behavior) and returns a (next_image_id,
next_annotation_id) tuple so callers can feed the result of one
export straight into the next:

    next_image, next_ann = train.as_coco(annotations_path="train.json")
    next_image, next_ann = valid.as_coco(
        annotations_path="valid.json",
        starting_image_id=next_image,
        starting_annotation_id=next_ann,
    )
    test.as_coco(
        annotations_path="test.json",
        starting_image_id=next_image,
        starting_annotation_id=next_ann,
    )

The images-only branch of as_coco (annotations_path=None) round-trips
the starting ids unchanged so chaining still works there.

Adds 4 regression tests covering defaults, custom starting ids,
end-to-end three-split chaining with global uniqueness assertions,
and the images-only round-trip.

* docs: address review polish on COCO id-chaining
* fix(dataset): align save_coco_annotations approximation_percentage default to 0.0
* docs(dataset): add one-line summary to save_coco_annotations docstring
* docs: add changelog entry for COCO id chaining (PR #2267)
* docs(dataset): document file_name uniqueness limitation in save_coco_annotations
* feat(dataset): validate starting_image_id and starting_annotation_id >= 1
* docs(dataset): add Example section to save_coco_annotations docstring
* docs(dataset): unpack final as_coco return value in chaining example
* test(dataset): add COCO chaining tests and fix test helper for zero detections

---------

Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
Co-authored-by: Claude Code <noreply@anthropic.com>
2026-05-22 21:41:42 +02:00
..
assets add lenny 2023-12-04 17:03:05 +00:00
classification docs(fix): 🐞📝 removal of table of content duplicates core(Detections,Classification) 2024-01-31 15:09:07 +03:00
datasets feat(docs): add GEO infrastructure for AI search visibility (#2224) 2026-04-21 11:40:44 +02:00
detection Restructure annotator docs tabs to avoid Material’s 20-tab limit (#2257) 2026-05-22 19:54:33 +02:00
how_to docs: add sample image download and sv.plot_image() to detect_and_annotate tutorial (#2242) 2026-05-19 14:22:49 +02:00
javascripts docs: fix copy doctests without `>>>` and `...` by button & ctr+c (#2138) 2026-02-04 23:09:16 +09:00
keypoint docs: Wrap all placeholder paths in quotes and code expressions (#2128) 2026-02-03 14:00:40 +01:00
metrics fix(docs): expand llms.txt, add FAQ schema, author attribution to how… (#2231) 2026-04-23 18:33:14 +02:00
notebooks docs: link "Memory-Efficient Instance Segmentation" notebook and update deprecations (#2241) 2026-05-01 00:49:15 +02:00
stylesheets after few tests drop support for `pycon` in docs examples 2025-08-07 07:41:52 +02:00
theme docs: link "Memory-Efficient Instance Segmentation" notebook and update deprecations (#2241) 2026-05-01 00:49:15 +02:00
utils reimplement `crop_image` to skip type casting when Pillow Image given 2025-11-14 17:55:07 +01:00
0d5d9799b1cc4a39825146388c6781eb.txt feat(docs): add GEO infrastructure for AI search visibility (#2224) 2026-04-21 11:40:44 +02:00
CNAME Create CNAME 2023-08-22 13:08:10 +01:00
_headers docs: improve SEO and GEO docs publishing (#2232) 2026-04-24 23:39:22 +02:00
about.md docs: improve SEO and GEO docs publishing (#2232) 2026-04-24 23:39:22 +02:00
assets.md fix(docs): expand llms.txt, add FAQ schema, author attribution to how… (#2231) 2026-04-23 18:33:14 +02:00
changelog.md fix(dataset): make COCO annotation/image ids chainable across splits (#2267) 2026-05-22 21:41:42 +02:00
code_of_conduct.md move CODE_OF_CONDUCT.md and CONTRIBUTING.md for improved accessibility (#2036) 2026-02-03 03:58:28 +01:00
contact.md docs: improve SEO and GEO docs publishing (#2232) 2026-04-24 23:39:22 +02:00
contributing.md move CODE_OF_CONDUCT.md and CONTRIBUTING.md for improved accessibility (#2036) 2026-02-03 03:58:28 +01:00
cookbooks.md fix(docs): expand llms.txt, add FAQ schema, author attribution to how… (#2231) 2026-04-23 18:33:14 +02:00
deprecated.md docs: link "Memory-Efficient Instance Segmentation" notebook and update deprecations (#2241) 2026-05-01 00:49:15 +02:00
faq.md docs: improve SEO and GEO docs publishing (#2232) 2026-04-24 23:39:22 +02:00
index.md docs: update author references and improve metadata (#2233) 2026-04-25 07:15:59 +02:00
license.md docs: contributing.md/code_of_conduct/license added into docs 2024-01-31 22:10:28 +03:00
llms-100k.txt docs: improve SEO and GEO docs publishing (#2232) 2026-04-24 23:39:22 +02:00
llms.full.txt docs: improve SEO and GEO docs publishing (#2232) 2026-04-24 23:39:22 +02:00
llms.txt docs: improve SEO and GEO docs publishing (#2232) 2026-04-24 23:39:22 +02:00
robots.txt docs: improve SEO and GEO docs publishing (#2232) 2026-04-24 23:39:22 +02:00
trackers.md feat(docs): add GEO infrastructure for AI search visibility (#2224) 2026-04-21 11:40:44 +02:00