Open palmcorp opened 5 months ago
@palmcorp hi there,
Thank you for reaching out and providing details about the issue you're encountering with CVAT and the conversion process. Let's work through this together to get your dataset properly formatted for YOLOv8 Pose.
Firstly, it's crucial to ensure that you're using the latest versions of both torch
and ultralytics
. If you haven't already, please update these packages and try the conversion process again:
pip install --upgrade torch ultralytics
Regarding the issue with missing labels and incorrect formatting, it seems like the conversion from COCO to YOLO format might not be handling keypoints correctly. Here are a few steps and suggestions to help resolve this:
Verify COCO Keypoints Export: Ensure that when you export from CVAT, you are using the COCO Keypoints format, as this includes the necessary keypoint information for pose estimation.
Use Ultralytics Conversion Tool: Instead of using JSON2YOLO
, you might find it more reliable to use the Ultralytics provided conversion tool. This tool is designed to handle COCO format and convert it to the YOLO format required for pose estimation. Here’s how you can use it:
from ultralytics.data.converter import convert_coco
convert_coco(labels_dir="path/to/coco/annotations/", use_keypoints=True)
Make sure to replace "path/to/coco/annotations/"
with the actual path to your COCO annotations directory.
Check Label Format: After conversion, verify that your label files follow the correct YOLO format for pose estimation. Each label file should look something like this:
<class-index> <x> <y> <width> <height> <px1> <py1> <px2> <py2> ... <pxn> <pyn>
For example, a label file might contain:
0 0.5 0.5 0.2 0.4 0.45 0.55 0.55 0.55 0.45 0.45 0.55 0.45 ...
YAML Configuration: Ensure your dataset YAML file is correctly set up. Here’s an example configuration:
path: ../datasets/your-dataset # dataset root dir
train: images/train # train images (relative to 'path')
val: images/val # val images (relative to 'path')
test: # test images (optional)
# Keypoints
kpt_shape: [17, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
flip_idx: [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]
# Classes dictionary
names:
0: person
If you follow these steps and still encounter issues, please provide a minimum reproducible example of your code and dataset structure. This will help us diagnose the problem more effectively. You can find more details on creating a minimum reproducible example here.
Looking forward to your update! 😊
Using CVAT as an annotation tool, when running ‘export task dataset” in two different formats, then converting to yolo using JSON2YOLO we get the following results: CVAT file. Label file in new_dir COCO 1.0. no label files COCO keyponts. class per label : 0
Format for all labels: 0
These labels ae insufficient to run Yolov8 Pose. Any suggestions are welcome.