Add lossless DIVE KWCOCO classification support - #1851
Draft
PaulHax wants to merge 6 commits into
Draft
Conversation
This was referenced Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add lossless DIVE KWCOCO classification support
Standard KWCOCO fields can store one primary category and one aligned probability vector. They
cannot preserve all DIVE confidence-pair details by themselves.
This PR defines one DIVE KWCOCO profile for Web and Desktop. A DIVE export can preserve hierarchy
edges, pair order, explicit zero values, sparse membership, and track IDs.
Import
probvalue by its category-array position.0through1.0.001.dive_confidence_pairsextension when the file contains one.probwhen the extension is invalid.supercategoryas a direct parent link.unknown.For multicamera import, DIVE stores the first valid hierarchy on the parent dataset. Later cameras
must agree with it. Camera datasets do not keep derived hierarchy copies.
Export
supercategory.probarray on each annotation.category_idandscorecompatibility fields.dive_confidence_pairsdata.info.dive_extensions.Manual tests
Test data: download and extract
classification.zip. Paths
below are relative to
dive-classification-test-data/.Web KWCOCO round trip
dive-classification-test-data/classification/single-camera-linked-types/.Verify: The hierarchy, track IDs, pair order, and confidence values survive the Web round trip.
Desktop KWCOCO round trip
dive-classification-test-data/classification/single-camera-linked-types/.Verify: The hierarchy, track IDs, pair order, and confidence values survive the Desktop round trip.
Cross-platform KWCOCO exchange
Verify: Both applications show the same hierarchy, track IDs, pair order, and confidence vectors.
Exact confidence-pair extension
dive-classification-test-data/media/image-sequence/.kwcoco/exact-confidence-pairs-round-trip/exact-confidence-pairs.kwcoco.json, inspecttrack 17 and the hierarchy, then export and reimport it; repeat on Desktop.
Verify: Both applications preserve sparse pair membership, stored order, and the explicit zero.
Empty confidence-pair extension
dive-classification-test-data/media/image-sequence/.kwcoco/empty-confidence-pairs-extension/empty-confidence-pairs.kwcoco.json, inspect thewarning and track 7, then repeat on Desktop.
Verify: Each application reports one warning and gives track 7 the fallback vector
shark: 0.8,fish: 0.2.Stack
This is PR 8 of 9. Previous: make lifecycle operations classification-safe.
Next: define raw and resolved boundaries.
This PR is stacked on
hierarchical-classification-pr4-lifecycle.Overall: 23 files, +2,020/-137. Commits:
5f2aab8fthrough2593d0ec.