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

'Keypoints' object has no attribute 'astype'. See valid attributes below. #19

Open
gggpt opened this issue Oct 22, 2023 · 1 comment
Open

Comments

@gggpt
Copy link

gggpt commented Oct 22, 2023

【C1】YOLOV8预训练模型预测-Python API-图像.ipynb
AttributeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 bboxes_keypoints = results[0].keypoints.cpu().numpy().astype('uint32')

/usr/local/lib/python3.10/dist-packages/ultralytics/utils/init.py in getattr(self, attr)
151 """Custom attribute access error message with helpful information."""
152 name = self.class.name
--> 153 raise AttributeError(f"'{name}' object has no attribute '{attr}'. See valid attributes below.\n{self.doc}")
154
155

AttributeError: 'Keypoints' object has no attribute 'astype'. See valid attributes below.

A class for storing and manipulating detection keypoints.

Attributes:
    xy (torch.Tensor): A collection of keypoints containing x, y coordinates for each detection.
    xyn (torch.Tensor): A normalized version of xy with coordinates in the range [0, 1].
    conf (torch.Tensor): Confidence values associated with keypoints if available, otherwise None.

Methods:
    cpu(): Returns a copy of the keypoints tensor on CPU memory.
    numpy(): Returns a copy of the keypoints tensor as a numpy array.
    cuda(): Returns a copy of the keypoints tensor on GPU memory.
    to(device, dtype): Returns a copy of the keypoints tensor with the specified device and dtype.
@EverlastingYuki
Copy link

keypoints后面加个.data就可以了
bboxes_keypoints = results[0].keypoints.data.cpu().numpy().astype('uint32')

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