Train_Custom_Dataset icon indicating copy to clipboard operation
Train_Custom_Dataset copied to clipboard

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

Open gggpt opened this issue 2 years ago • 1 comments

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

gggpt avatar Oct 22 '23 06:10 gggpt

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

EverlastingYuki avatar Jan 24 '24 08:01 EverlastingYuki