Skip to content

Add category_id_start parameter to support starting category IDs from 1 #29

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

Merged
merged 3 commits into from
Apr 20, 2024

Conversation

xCatalitY
Copy link

This PR introduces a new parameter category_id_start to allow users to specify the starting value for category IDs when converting labelme annotations to COCO format. By default, the category IDs start from 0, but users can now set category_id_start to 1 or any other desired starting value.

Changes:

  • Added category_id_start parameter to get_coco_from_labelme_folder function in labelme2coco.py
  • Updated convert function in __init__.py to accept category_id_start parameter and pass it to get_coco_from_labelme_folder
  • Modified app function in cli.py to include category_id_start parameter
  • Updated README.md to document the usage of category_id_start parameter in both basic and advanced usage sections

Additionally, this PR fixes an issue where the file paths were incorrectly formatted in the "file_name" attribute when data is structured in subdirectories. Previously, if an image was located in a subfolder, e.g., subfolder_1/image.jpeg, the "file_name" attribute would only contain image.jpeg instead of the complete path. This has been fixed to include the full path in the "file_name" attribute.
This resolves #17

If data is structured in subdirectories, the pathes are missing in the "file_name" attribute. Instead of subfolder_1/image.jpeg the filename contains only image.jpeg.

New:
Add category_id_start parameter to support starting category IDs from 1
@xCatalitY
Copy link
Author

Did your requested changes

@xCatalitY xCatalitY requested a review from fcakyon April 20, 2024 09:34
@fcakyon
Copy link
Owner

fcakyon commented Apr 20, 2024

@xCatalitY Thanks a lot for your contribution!

@fcakyon fcakyon merged commit fe1cbc6 into fcakyon:master Apr 20, 2024
12 checks passed
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.

2 participants