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

Yolov8 pose label size issue #886

Open
palmcorp opened this issue Oct 16, 2024 · 5 comments
Open

Yolov8 pose label size issue #886

palmcorp opened this issue Oct 16, 2024 · 5 comments

Comments

@palmcorp
Copy link

Here is a sample label file:
0 0.643712 0.548266 0.0960109 0.057663 0.595707 0.519435 2 0.646533 0.526217 2 0.682304 0.548261 2 0.691717 0.577098 2
5 0.547212 0.54338 0.0545761 0.0753696 0.519924 0.581065 2 0.539413 0.574652 2 0.554228 0.53937 2 0.5745 0.505696 2

The yamal files show:
kpt_shape: [17, 3]
nc = 2

YOLO complains with:
rain: WARNING ⚠️ /content/datasets/echo-pose/images/train/E8F3E-9_M.jpg: ignoring corrupt image/label: labels require 56 columns each

I count 51? Where are the other coming from?

@pderrenger
Copy link
Member

@palmcorp hello! 😊

It looks like you're encountering an issue with the label format for YOLOv8 pose estimation. The warning indicates that each label should have 56 columns, but your labels have fewer.

Here's a breakdown of the expected format:

  1. Keypoint Format: For pose estimation, each keypoint typically requires 3 values: x, y, and visibility.
  2. Total Columns: With kpt_shape: [17, 3], you have 17 keypoints, each needing 3 values, totaling 51 columns for keypoints alone.
  3. Additional Columns: YOLOv8 expects additional columns for class, bounding box (x, y, width, height), and potentially other metadata, which might explain the discrepancy.

To resolve this:

  • Ensure each label line includes the class, bounding box, and all keypoints with their visibility.
  • Double-check your dataset configuration and ensure it aligns with the expected format.

If the issue persists, please verify that you're using the latest version of the Ultralytics packages. Updates often include bug fixes and improvements.

For more detailed guidance, you can refer to the Ultralytics HUB documentation.

Feel free to reach out if you have more questions! 🚀

@palmcorp
Copy link
Author

palmcorp commented Oct 17, 2024 via email

@pderrenger
Copy link
Member

@palmcorp hi Paul,

Thanks for reaching out! Let's clarify the expected format for YOLOv8 pose labels.

Expected Format:

  1. Class: The first value in each line is the class ID.
  2. Bounding Box: Followed by 4 values representing the bounding box (x_center, y_center, width, height).
  3. Keypoints: Each keypoint requires 3 values (x, y, visibility). With kpt_shape: [17, 3], you need 51 values for keypoints.

Example:

For a single object with 17 keypoints, a label line should look like:

class_id x_center y_center width height x1 y1 v1 x2 y2 v2 ... x17 y17 v17

Your Case:

Since you have 4 keypoints per skeleton, ensure each label line includes:

  • Class ID
  • Bounding box
  • 4 keypoints, each with x, y, and visibility (totaling 12 values for keypoints)

Troubleshooting:

  • Double-check that each line in your label files matches the expected format.
  • Ensure you're using the latest versions of Ultralytics and Torch, as updates may resolve underlying issues.

If you have any more questions or need further assistance, feel free to ask. We're here to help! 😊

@palmcorp
Copy link
Author

palmcorp commented Oct 17, 2024 via email

@pderrenger
Copy link
Member

Hello Paul,

Thanks for providing the details! It seems like the issue might be related to the label format. Let's break it down:

Expected Label Format:

For each object, the label should include:

  1. Class ID: 1 column
  2. Bounding Box: 4 columns (x_center, y_center, width, height)
  3. Keypoints: For kpt_shape: [4, 3], you need 12 columns (4 keypoints, each with x, y, visibility)

This totals to 17 columns, but YOLO is asking for 14. Let's ensure the configuration is correct:

Troubleshooting Steps:

  1. Verify Keypoints: Double-check that each keypoint has 3 values (x, y, visibility).
  2. Bounding Box Format: Ensure the bounding box values are correctly formatted.
  3. Check YAML Files: Confirm that both model and data YAML files are correctly set with kpt_shape: [4, 3].

Code Example:

Here's a sample label line for reference:

class_id x_center y_center width height x1 y1 v1 x2 y2 v2 x3 y3 v3 x4 y4 v4

Additional Tips:

  • Ensure your conversion script is correctly mapping the JSON to the expected label format.
  • Verify that you're using the latest versions of Ultralytics and Torch to avoid any version-related issues.

If the problem persists, consider revisiting the conversion process or checking for any discrepancies in the dataset configuration.

Feel free to reach out if you need more help! 😊

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