spmallick / learnopencv

Learn OpenCV : C++ and Python Examples
https://www.learnopencv.com/
20.66k stars 11.52k forks source link

TypeError: plot_skeleton_kpts() missing 2 required positional arguments: 'kpts' and 'steps #907

Closed csnam closed 2 months ago

csnam commented 2 months ago

I tried following "yolov7-pose-vs-mediapipe-in-human-pose-estimation", but the following error occurred. Can anyone help me? Do I need to change part of the source?

TypeError: plot_skeleton_kpts() missing 2 required positional arguments: 'kpts' and 'steps'

(yolov7_pose) PS E:\Project\YOLOProject\yolov7> python .\yolov7-pose.py
Selected Device :  cpu
(192, 256, 3)
E:\Project\YOLOProject\yolov7-pose-estimation\yolov7_pose\lib\site-packages\torch\functional.py:507: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\TensorShape.cpp:3550.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Traceback (most recent call last):
  File ".\yolov7-pose.py", line 103, in <module>
    img, fps_ = pose_video(frame)
  File ".\yolov7-pose.py", line 46, in pose_video
    plot_skeleton_kpts(nimg, output[idx, 7:].T, 3)
TypeError: plot_skeleton_kpts() missing 2 required positional arguments: 'kpts' and 'steps'
brmarkus commented 2 months ago

Looks like the repo is inconsistent... Maybe the author @kXborg seem to have used its own local copy of (an older) Ultralytics?

Can you try to simply replace the method "plot_skeleton_kpts()" from "https://github.com/spmallick/learnopencv/blame/master/YOLOv7-Pose-vs-MediaPipe-in-Human-Pose-Estimation/Experiments/utils/plots.py#L447" from within this repo (under "Experiments" folder) with the one from here, "https://github.com/RizwanMunawar/yolov7-object-tracking/blob/main/utils/plots.py#L447"?

EDIT: When you compare the two implementation (from within this repo "https://github.com/spmallick/learnopencv/blame/master/YOLOv7-Pose-vs-MediaPipe-in-Human-Pose-Estimation/Experiments/utils/plots.py#L447" with the other version from e.g. "https://github.com/RizwanMunawar/yolov7-object-tracking/blob/main/utils/plots.py#L447") then you see the differences are minimal and just adds additional annotations, which you might not need?

csnam commented 2 months ago

You are right. Thanks for your advice. I followed the blog and test it. If you use the original, there will be no error. There was no need to change anything to test a simple video. thank you much

`

Clone the YOLOv7 repository and put yolov7-pose.py in the root directory. Replace yolov7/utils/plots.py with our version of plots.py. `

brmarkus commented 2 months ago

Feel free to close this issue if there are no more questions left.