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

instances.keypoints: index is out of bounds #717

Open
1 task done
so681ste opened this issue Jun 10, 2024 · 2 comments
Open
1 task done

instances.keypoints: index is out of bounds #717

so681ste opened this issue Jun 10, 2024 · 2 comments
Labels
question A HUB question that does not involve a bug

Comments

@so681ste
Copy link

so681ste commented Jun 10, 2024

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

@so681ste so681ste added the question A HUB question that does not involve a bug label Jun 10, 2024
Copy link

👋 Hello @so681ste, thank you for raising an issue about Ultralytics HUB 🚀! Please visit our HUB Docs to learn more:

  • Quickstart. Start training and deploying YOLO models with HUB in seconds.
  • Datasets: Preparing and Uploading. Learn how to prepare and upload your datasets to HUB in YOLO format.
  • Projects: Creating and Managing. Group your models into projects for improved organization.
  • Models: Training and Exporting. Train YOLOv5 and YOLOv8 models on your custom datasets and export them to various formats for deployment.
  • Integrations. Explore different integration options for your trained models, such as TensorFlow, ONNX, OpenVINO, CoreML, and PaddlePaddle.
  • Ultralytics HUB App. Learn about the Ultralytics App for iOS and Android, which allows you to run models directly on your mobile device.
    • iOS. Learn about YOLO CoreML models accelerated on Apple's Neural Engine on iPhones and iPads.
    • Android. Explore TFLite acceleration on mobile devices.
  • Inference API. Understand how to use the Inference API for running your trained models in the cloud to generate predictions.

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
Copy link
Member

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

  • Ensure that the flip_idx array correctly corresponds to the keypoints you have defined.
  • Verify that the indices in flip_idx are within the range of your keypoints (0 to 22 for 23 keypoints).

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A HUB question that does not involve a bug
Projects
None yet
Development

No branches or pull requests

2 participants