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

Update labelstudio2coco.py , 1. image_name changed 2. can't get category_id #2930

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gs80140
Copy link

@gs80140 gs80140 commented Jan 18, 2024

…ory_id

拿图片名的时候 , 数据结构变成这样了 "data": {
"img": "images/20231116154137_1-1.jpg"
}

另外导入 如下配置的时候

初始化只 取了关键点 labels = root.findall('.//KeyPointLabels/Label')

但是 category_name 是取所有的,
for key in [
'rectanglelabels', 'polygonlabels', 'labels',
'keypointlabels'
]:
if key == label['type'] and len(label['value'][key]) > 0:
category_name = label['value'][key][0]
break
所以导致如下语句报错, 如下语句应该移到关键点的处理逻辑
category_id = self.category_name_to_id[category_name]

I have read the CLA Document and I sign the CLA

Motivation

Modification

BC-breaking (Optional)

Use cases (Optional)

Checklist

Before PR:

  • I have read and followed the workflow indicated in the CONTRIBUTING.md to create this PR.
  • Pre-commit or linting tools indicated in CONTRIBUTING.md are used to fix the potential lint issues.
  • Bug fixes are covered by unit tests, the case that causes the bug should be added in the unit tests.
  • New functionalities are covered by complete unit tests. If not, please add more unit tests to ensure correctness.
  • The documentation has been modified accordingly, including docstring or example tutorials.

After PR:

  • CLA has been signed and all committers have signed the CLA in this PR.

…ory_id

拿图片名的时候 , 数据结构变成这样了 "data": {
            "img": "images/20231116154137_1-1.jpg"
        }

另外导入 如下配置的时候

<View>
  <KeyPointLabels name="kp-1" toName="img-1">
    <Label value="head" background="#FFA39E"/>
    <Label value="left" background="#D4380D"/>
    <Label value="right" background="#FFC069"/>
    <Label value="bottom" background="#AD8B00"/>
    <Label value="leftbottom" background="#FFA39E"/>
    <Label value="rightbottom" background="#D4380D"/>
    <Label value="tail1" background="#FFC069"/>
    <Label value="tail2" background="#AD8B00"/>
    <Label value="tail3" background="#D3F261"/>
  </KeyPointLabels>
  <PolygonLabels name="polygonlabel" toName="img-1">
      <Label value="radish" background="#0DA39E"/>
  </PolygonLabels>
  <RectangleLabels name="label" toName="img-1">
      <Label value="radish" background="#DDA0EE"/>
  </RectangleLabels>
  <Image name="img-1" value="$img"/>
</View>

初始化只 取了关键点  labels = root.findall('.//KeyPointLabels/Label')

但是 category_name 是取所有的, 
 for key in [
                        'rectanglelabels', 'polygonlabels', 'labels',
                        'keypointlabels'
                ]:
                    if key == label['type'] and len(label['value'][key]) > 0:
                        category_name = label['value'][key][0]
                        break
所以导致如下语句报错, 如下语句应该移到关键点的处理逻辑
category_id = self.category_name_to_id[category_name]
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Tau-J
Copy link
Collaborator

Tau-J commented Jan 18, 2024

hi @gs80140 , thank you for your contribution! The lint failed, I suggest follwoing this doc to use pre-commit to fix it.

@gs80140
Copy link
Author

gs80140 commented Apr 2, 2024

I have read the CLA Document and I sign the CLA

1 similar comment
@gs80140
Copy link
Author

gs80140 commented Apr 2, 2024

I have read the CLA Document and I sign the CLA

@gs80140 gs80140 closed this Apr 2, 2024
@gs80140 gs80140 reopened this Apr 2, 2024
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.

None yet

4 participants