-
-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
问题描述
当前代码假定COCO数据集中必然存在segmentation字段,才会正常转换。
LabelConvert/label_convert/coco_to_labelImg.py
Lines 73 to 83 in 620d19f
| 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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working