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

coco_to_labelImg模块只存在bbox时,会出现丢失问题 #13

Closed
SWHL opened this issue May 9, 2024 · 1 comment
Closed

coco_to_labelImg模块只存在bbox时,会出现丢失问题 #13

SWHL opened this issue May 9, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@SWHL
Copy link
Member

SWHL commented May 9, 2024

问题描述

当前代码假定COCO数据集中必然存在segmentation字段,才会正常转换。

seg_info = one_anno.get("segmentation")
if seg_info:
bbox = self.get_bbox(seg_info)
xywh = self.xyxy_to_xywh(bbox, img_width, img_height)
category_id = int(one_anno.get("category_id")) - 1
xywh_str = " ".join([str(v) for v in xywh])
label_str = f"{category_id} {xywh_str}"
# 写入标注的txt文件
txt_full_path = save_dir / f"{Path(img_name).stem}.txt"
self.write_txt(txt_full_path, label_str, mode="a")

如果仅仅存在bbox字段,但是没有segmentation字段,则程序会为空!

所用版本

label_convert==0.1.2

@SWHL SWHL added the bug Something isn't working label May 9, 2024
@SWHL SWHL self-assigned this May 9, 2024
@SWHL
Copy link
Member Author

SWHL commented May 9, 2024

已经在label_convert>=0.1.3中修复

@SWHL SWHL closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant