-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add capability to convert keypoints from COCO to YOLOv5 format #117
Conversation
Thank you @chrisrapson I will check it out. |
@chrisrapson , how is this different than the Segmentation support described here #65 If this is something different than the segmentation support. Could you possibly provide a sample dataset so I can test it out? |
It's definitely similar, but not quite the same. The COCO dataset is the canonical example. They explain the format for keypoints here: Here's another dataset that has keypoint labels in the VOC format It looks like it would be challenging to include both segmentation and keypoint data in a YOLO-formatted file, because in a YOLO-formatted file data is interpreted based on its position within a list. Segmentations are an arbitrarily long list of pairs of floats. Keypoints are a list of triplets of floats. The number of keypoints should be the same for all images in a dataset, but won't be the same across datasets. It wouldn't be possible to know when the list of segmentations ended, and the list of keypoints began (or vice versa). I think it would be simplest to restrict users to convert only one of either keypoints or segmentations to YOLO. I can't think of a use case where somebody would train a network that needs both segmentation and keypoint data. That is, add a flag |
Thank you. I had never used key points before but I am getting it. Could you help me with a few more things:
|
The keypoints task and the segmentation challenges use the same images. The annotations are saved in One possible place to download them is from huggingface: https://huggingface.co/datasets/merve/coco/tree/main/annotations Good idea about the doc string. I'll add that and a boolean |
See the two extra commits. The first adds a docstring and a boolean flag. For the second I added the capability to export keypoints to COCO. |
=================================== FAILURES =================================== coco_dataset = <pylabel.dataset.Dataset object at 0x7f5c2191fc10>
tests/test_main.py:174: self = <pylabel.exporter.Export object at 0x7f5c2191f310>, output_path = None
E TypeError: object of type 'numpy.float64' has no len() pylabel/exporter.py:821: TypeError Exporting to COCO file...: 0%| | 0/4888 [00:00<?, ?it/s] ../../../../../opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/jupyter_bbox_widget/bbox.py:50 |
I think this is the relevant error message
|
You can find the instructions to run the tests manually here |
@chrisrapson I have cherry picked your commits for the yolo output and released it in the latest package, v52. Thank you! For to Coco export, the issue is in this part of the code:
Is the issue the |
… without keypoint labels)
I think I've fixed it now. I only tested it on my dataset which had keypoint labels for all images. I misunderstood the logic that a dataset (or image) with no keypoint labels wouldn't have Once I found the test and ran it, it wasn't too hard to implement the if statement properly. I've updated the PR. There's still no automatic test that really verifies the new feature, but that would require adding a new dataset which had keypoint labels. |
Thank you @chrisrapson . I Merged it and published it in the latest release .v53. It would be awesome to have a sample notebook to demo the functionality for others to add to the library at https://github.com/pylabel-project/samples. Is that something you would be able to do do (someday)? |
In case you're interested in converting keypoints as well as bounding boxes.
Following the format from here:
WongKinYiu/yolov7#1267
I did some manual tests on images with: