AlphaPose
AlphaPose copied to clipboard
support for pytorch 1.5.0
working well on my ubuntu 18 with cuda10.2, cudnn8, torch 1.5 torchvision 0.6
additional steps before running ./inference.sh is
sudo apt-get install gfortran
and change the type of variables in vis.py
@Fang-Haoshu I believe I managed to find the issue and got the setup running. I believe the way the c++ code was checking if it is a cuda tensor is no longer compatible with new versions of pytorch.
What I did to correct the issue is find occurrences of AT_CHECK in the c++ code and changed it to TORCH_CHECK. I had to change the following files: nms_cuda.cpp, roi_align_cuda.cpp, deform_cov_cuda.cpp, and deform_pool_cuda.cpp.
for example in the nms_cuda.cpp file the only change was
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ") to #define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
After making that change the setup ran correctly. Best of luck.
For alpha pose(0.3.0),which based on torch 1.7 or above, does torch version matters?
I tried merging this PR as per the instructions given in the installation instructions. However, I get the following error when I try running the inference script python scripts/demo_inference.py
. I'm using pytorch 1.7.1 with torchvision 0.8.2.
Traceback (most recent call last):
File "scripts/demo_inference.py", line 14, in <module>
from trackers.tracker_api import Tracker
File "/home/me/projects/alphapose/trackers/tracker_api.py", line 21, in <module>
from utils.utils import *
File "/home/me/projects/alphapose/trackers/utils/utils.py", line 16, in <module>
from torchvision.ops import nms
ModuleNotFoundError: No module named 'torchvision.ops'
EDIT: I solved it by reinstalling torchvision conda install torchvision=0.8.2 -c pytorch
.
Thanks!! Worked for me.
@Fang-Haoshu I believe I managed to find the issue and got the setup running. I believe the way the c++ code was checking if it is a cuda tensor is no longer compatible with new versions of pytorch.
What I did to correct the issue is find occurrences of AT_CHECK in the c++ code and changed it to TORCH_CHECK. I had to change the following files: nms_cuda.cpp, roi_align_cuda.cpp, deform_cov_cuda.cpp, and deform_pool_cuda.cpp.
for example in the nms_cuda.cpp file the only change was
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ") to #define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
After making that change the setup ran correctly. Best of luck.
@Fang-Haoshu I believe I managed to find the issue and got the setup running. I believe the way the c++ code was checking if it is a cuda tensor is no longer compatible with new versions of pytorch.
What I did to correct the issue is find occurrences of AT_CHECK in the c++ code and changed it to TORCH_CHECK. I had to change the following files: nms_cuda.cpp, roi_align_cuda.cpp, deform_cov_cuda.cpp, and deform_pool_cuda.cpp.
for example in the nms_cuda.cpp file the only change was
#define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ") to #define CHECK_CUDA(x) TORCH_CHECK(x.type().is_cuda(), #x, " must be a CUDAtensor ")
After making that change the setup ran correctly. Best of luck.
Thanks @angmc, I verified this fix to work for me as well.
For other people facing similar problems, the 4 files for changing AT_CHECK
to TORCH_CHECK
are in the following paths inside the AlphaPose directory:
alphapose/utils/roi_align/src/roi_align_cuda.cpp
alphapose/models/layers/dcn/src/deform_conv_cuda.cpp
alphapose/models/layers/dcn/src/deform_pool_cuda.cpp
detector/nms/src/nms_cuda.cpp
Thanks, this PR has been merged to branch "pytorch<1.11"
Thanks, this PR has been merged to branch "pytorch<1.11" Is it possible then to close this PR?