Annots are secretly accessed unordered using AnnotGroups
MWE:
dset = kwcoco.CocoDataset.demo()
dset.images().annots[0]._ids
# {1, 2, 3, 4, 5, 6, 7, 8, 9} # bad
dset.annots(image_id=1)._ids
# [1, 2, 3, 4, 5, 6, 7, 8, 9] # good
When accessing an Annots
from an AnnotGroups
, the aids are stored as an unordered set. This means that accessing annotations or properties using eg .lookup
is potentially nondeterministic. I discovered the issue because calling .take
on an Annots
accessed this way raises an error.