Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reindexing category id when exporting to coco json format #15

Closed
danacity opened this issue Jan 12, 2022 · 3 comments
Closed

reindexing category id when exporting to coco json format #15

danacity opened this issue Jan 12, 2022 · 3 comments

Comments

@danacity
Copy link
Contributor

Instead of changing the category Ids, it might be a nice feature to add a "background" category at category_id = 0, that is how other libraries do it.

@alexheat
Copy link
Contributor

Hi @Daniel-R-Armstrong thank you for the idea and sorry for the late reply. The re-indexing was provided by another contributor and the reason for it is some frameworks (like detectron) start at 1 and yolo starts at 0, and the ids must be sequential.

Would be open to adding the background class too if you think it would be helpful. How would it work? Do you have example from other libraries?

@danacity
Copy link
Contributor Author

@alexheat my thought is that you just use the category ids that are feed into pylable, you add a background class at index 0 if it was not provided. if the output requires you to start at one you could either add 1 to each index or drop the background class. I suppose you would have to run a test to see if they are sequential and reindex if needed. I guess my problem with the current way is that I feed in correct id and it gets reindexed when I try to save in the same format I would expect them to have the same Ids. I am just thinking and typing, but how do you feel about saving a dictionary of the classes and their respective Id, when the data gets passed to pylable if their is values that are not in the dictionary you can just add them to the dictionary as the classes are added to the labeling tool. IceVision has a concept of a class map https://airctic.com/dev/parser/. I will have to look at some of the other data tools to see what they do.

@danacity
Copy link
Contributor Author

I will have to give it more thought but you might be able to apply or use the dictionary as the pandas cat.codes.

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

No branches or pull requests

2 participants