ultralytics / JSON2YOLO

Convert JSON annotations into YOLO format.

Home Page:https://docs.ultralytics.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can this project covert the coco_keypoint's format to yolo?

heylary opened this issue · comments

commented

I used one of the scripts and found that for converted keypoint files only xyhw format could be converted and the keypoints were not recognized

Checked the issues to see if anyone's trying to find out as well. Thanks for trying it out the script for me, now I know it doesn't work. I'm personally trying to convert a COCOS Data Format for Key Point Detection for YoloPose.

I cross-checked the Official COCOS Data Format Guidelines with general_json2yolo.py. I can't find anything using 'keypoint' or 'num_keypoints' which are keys inside the annotation object for KeyPoint Detection.

All I could find was ann['category_id'], ann['iscrowd'], and etc., which all belong to the annotation object for Object Detection.

I find that pretty weird since edgeai-yolov5/tree/yolo-pose, cited this repository for data preparation in yolo-pose. Apparently not.

commented

Checked the issues to see if anyone's trying to find out as well. Thanks for trying it out the script for me, now I know it doesn't work. I'm personally trying to convert a COCOS Data Format for Key Point Detection for YoloPose.

I cross-checked the Official COCOS Data Format Guidelines with general_json2yolo.py. I can't find anything using 'keypoint' or 'num_keypoints' which are keys inside the annotation object for KeyPoint Detection.

All I could find was ann['category_id'], ann['iscrowd'], and etc., which all belong to the annotation object for Object Detection.

I find that pretty weird since edgeai-yolov5/tree/yolo-pose, cited this repository for data preparation in yolo-pose. Apparently not.

Thanks for the reply, I also asked the question only after being mentioned by the author of yolo-pose that it could be modified according to this script, apparently the author made the conversion related to the key point format

Thanks for writing the issue.
We check it works using this script global_json2yolo.py.

Looking at the global_json2yolo code, there are some flags.
Converting the COCO bbox format to YOLO bbox format.

use_segments=False,
use_keypoints=False,

Converting the COCO segmentation format to YOLO segmentation format.

use_segments=True,
use_keypoints=False,

Converting the COCO keypoints format to YOLO keypoints format.

use_segments=False,
use_keypoints=True,

To convert the COCO keypoints format to YOLO keypoints format.

if __name__ == '__main__':
    source = 'COCO'

    if source == 'COCO':
        convert_coco_json('../datasets/coco/annotations',  # directory with *.json
                          use_segments=False,
                          use_keypoints=True,
                          cls91to80=False)

This is the folder structure when we run the script.

スクリーンショット 2023-10-25 20 51 05

Please let us know your opinion.

Thank you for your detailed explanation and for referencing the global_json2yolo script. It appears that the global_json2yolo script offers distinct flags for converting COCO format to YOLO format, including options for converting COCO keypoint format to YOLO keypoint format.

It seems like the global_json2yolo script provides a structured way to handle different COCO formats. It's great to see the efforts of the YOLO community in addressing various data format conversions.

If you encounter any additional issues or have further questions, please feel free to ask. Your feedback is incredibly helpful to the YOLO community and the Ultralytics team.