Skip to content

Leave the given COCO dict unchanged when remapping category ids - #1514

Open
mh-masum6875 wants to merge 1 commit into
obss:mainfrom
mh-masum6875:fix/remap-keeps-input-dict
Open

mh-masum6875 wants to merge 1 commit into
obss:mainfrom
mh-masum6875:fix/remap-keeps-input-dict

Conversation

@mh-masum6875

Copy link
Copy Markdown
Contributor

Loading with remapping_dict wrote the new ids back into the dict that was passed in. Loading the same dict again then raised KeyError: 0, or with a mapping such as {1: 2, 2: 1} quietly undid the remap. CocoVid changed its category list the same way.

Remaps copies of the category and annotation entries instead.

New test fails on main (KeyError: 0) and passes here. Over 1000 random datasets the first load gives identical Coco objects before and after; the caller's dict was changed in 651 of them before and in none after.

Loading with remapping_dict wrote the new ids back into the dict that
was passed in. Loading the same dict again then raised KeyError, or
with a mapping such as {1: 2, 2: 1} quietly undid the remap. CocoVid
changed its category list the same way.

Remap copies of the category and annotation entries instead.

This branch has not been deployed

No deployments
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.

1 participant