ultralytics / hub

Ultralytics HUB tutorials and support
https://hub.ultralytics.com
GNU Affero General Public License v3.0
131 stars 11 forks source link

instances.keypoints: index is out of bounds #717

Closed so681ste closed 2 months ago

so681ste commented 3 months ago

Search before asking

Question

I am trying to train a YOLOv8x-POSE pretrained model with additional foot keypoints using Ultralytics Hub and the recommended google colab code to train. Unfortunately, I keep getting the following error during the training process:

File "/usr/local/lib/python3.10/dist-packages/ultralytics/data/augment.py", line 722, in call instances.keypoints = np.ascontiguousarray(instances.keypoints[:, self.flip_idx, :]) IndexError: index 18 is out of bounds for axis 1 with size 6

my yaml file includes the 17 standard coco keypoints for the body + 6 foot keypoints. It looks like this:

kpt_shape: [23, 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, 18, 17, 20, 19, 22, 21]

and all my created txt files for my labels are organized according to the following scheme

'class-index' 'x' 'y' 'width' 'height' 'px1' 'py1' 'p1-visibility' 'px2' 'py2' 'p2-visibility' ... 'px23' 'py23' 'p23-visibility' 'class-index' 'x' 'y' 'width' 'height' 'px1' 'py1' 'p1-visibility' 'px2' 'py2' 'p2-visibility' ... 'px23' 'py23' 'p23-visibility'

Additional

No response

github-actions[bot] commented 3 months ago

πŸ‘‹ Hello @so681ste, thank you for raising an issue about Ultralytics HUB πŸš€! Please visit our HUB Docs to learn more:

If this is a πŸ› Bug Report, please provide screenshots and steps to reproduce your problem to help us get started working on a fix.

If this is a ❓ Question, please provide as much information as possible, including dataset, model, environment details etc. so that we might provide the most helpful response.

We try to respond to all issues as promptly as possible. Thank you for your patience!

pderrenger commented 3 months ago

@so681ste hi there,

Thank you for reaching out and providing detailed information about your issue. It looks like you're encountering an IndexError during the training process with your custom keypoints setup.

To help you effectively, could you please ensure the following:

  1. Minimum Reproducible Example: Please provide a minimal code snippet that reproduces the error. This will help us diagnose the issue more accurately. You can refer to our guide on creating a minimum reproducible example here: Minimum Reproducible Example.

  2. Package Versions: Ensure that you are using the latest versions of torch, ultralytics, and hub-sdk. You can upgrade your packages using the following commands:

    pip install --upgrade torch ultralytics hub-sdk

From the error message, it seems like there might be an issue with the flip_idx array in your YAML file. The flip_idx array should match the number of keypoints you have defined. Since you have 23 keypoints, the flip_idx array should also have 23 elements.

Here’s a quick check:

If the issue persists after these checks, please share the minimal reproducible code example, and we’ll be happy to assist you further.

Thank you for your cooperation, and we look forward to resolving this issue together!

github-actions[bot] commented 2 months ago

πŸ‘‹ Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO πŸš€ and Vision AI ⭐