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

[Fix] Fix bugs in the output annotation file when --class-id-txt is set. #430

Merged
merged 5 commits into from
Jan 6, 2023
Merged

[Fix] Fix bugs in the output annotation file when --class-id-txt is set. #430

merged 5 commits into from
Jan 6, 2023

Conversation

VoyagerXvoyagerx
Copy link
Contributor

Motivation

Usage:
$ python labelme2coco.py
--img-dir /path/to/images
--labels-dir /path/to/labels
--out /path/to/coco_instances.json
[--class-id-txt /path/to/class_with_id.txt]

When user set --class-id-txt, the category information is not contained in the output json annotation file. Also the data type of the value for "category_id" in the coco json field is str, which should be int.

Modification

  1. Add class_ids and class_names to the categories list in the coco json field.
  2. Change the dtype of class_id when unpdating the dict all_classes_id.

Checklist

  1. Pre-commit or other linting tools are used to fix potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a potential influence on downstream projects, this PR should be tested with downstream projects, like MMDetection or MMClassification.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@CLAassistant
Copy link

CLAassistant commented Jan 4, 2023

CLA assistant check
All committers have signed the CLA.

@hhaAndroid hhaAndroid changed the base branch from main to dev January 4, 2023 11:57
@hhaAndroid hhaAndroid requested a review from PeterH0323 January 4, 2023 11:58
@hhaAndroid
Copy link
Collaborator

@VoyagerXvoyagerx Thank you for your contribution. please fix the conflicts.

Copy link
Collaborator

@PeterH0323 PeterH0323 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hhaAndroid hhaAndroid merged commit 2290713 into open-mmlab:dev Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants