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

Using CVAT as an annotation tool, when running ‘export task dataset” in two different formats, COCO 1.0 is missing labels #93

Open
palmcorp opened this issue Jun 10, 2024 · 1 comment

Comments

@palmcorp
Copy link

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.

@pderrenger
Copy link
Member

@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:

  1. 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.

  2. 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.

  3. 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 ...
    
  4. 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! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants