Skip to content

Dev/fix track order

Jon Crall requested to merge dev/fix_track_order into dev/0.5.7

@matthew.bernstein This is a fix for the annotation order issue.

This changes the CocoDataset.index.trackid_to_aids from Dict[int, set] to Dict[int | None, SortedSet | set], where most entries are a SortedSet using the new _lut_annot_frame_index helper as the sorting key. The one exception is when the trackid is None, in which case the annotations wont always have a frame index, so we can't rely on the sorting logic.

I wish the key didn't have to use multiple levels of lookups, but I don't think there is a way around it.

I also had to modify the remove annotation logic to ensure I'm removing the annotations from the track index before I remove them from the main ann index, otherwise the sorted set tries to use anns to lookup a value, but it is missing so it fails.

Edited by Jon Crall

Merge request reports