Error or keypoint_indx, keypoint in enumerate(result.keypoints.tolist()):
Opened this issue · 2 comments
inference.py test some error
image 1/1 /home/skpark/git/pose-detection-keypoints-estimation-yolov8/data/images/train/antelope_10010.jpg: 448x640 2 quadrupeds, 61.7ms
Speed: 2.4ms preprocess, 61.7ms inference, 1.9ms postprocess per image at shape (1, 3, 448, 640)
Traceback (most recent call last):
File "/pose-detection-keypoints-estimation-yolov8/inference.py", line 15, in
for keypoint_indx, keypoint in enumerate(result.keypoints.tolist()):
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/skpark/.conda/envs/mmlab/lib/python3.11/site-packages/ultralytics/yolo/utils/init.py", line 135, in getattr
raise AttributeError(f"'{name}' object has no attribute '{attr}'. See valid attributes below.\n{self.doc}")
AttributeError: 'Keypoints' object has no attribute 'tolist'. See valid attributes below.
A class for storing and manipulating detection keypoints.
Args:
keypoints (torch.Tensor | np.ndarray): A tensor containing the detection keypoints, with shape (num_dets, num_kpts, 2/3).
orig_shape (tuple): Original image size, in the format (height, width).
Attributes:
keypoints (torch.Tensor | np.ndarray): A tensor containing the detection keypoints, with shape (num_dets, num_kpts, 2/3).
orig_shape (tuple): Original image size, in the format (height, width).
Properties:
xy (list): A list of keypoints (pixels) which includes x, y keypoints of each detection.
xyn (list): A list of keypoints (normalized) which includes x, y keypoints of each detection.
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(): Returns a copy of the keypoints tensor with the specified device and dtype.
Try this instead. It worked for me:
for keypoint_indx, keypoint in enumerate(result.keypoints.data.tolist()[0]):
0: 480x640 1 person, 94.8ms
Speed: 4.5ms preprocess, 94.8ms inference, 722.6ms postprocess per image at shape (1, 3, 480, 640)
i get this but not the results although the code is running doesnt work in videocapture or imread