https://github.com/LuongTanDat/AlphaPose-Cpp
转换python convert_torchscript.py --cfg "model-zoo/fast_pose_res50/256x192_res50_lr1e-3_1x.yaml" --pth "model-zoo/fast_pose_res50/fast_res50_256x192.pth"libtorch
下载:https://pytorch.org/
下载后上传至服务器
unzip libtorch-shared-with-deps-latest.zip
export LIB_TORCH=${libtorch path} # 设置libtorch路径
编译
mkdir build && cd build
export LIB_TORCH="/usr/local/libtorch"
cmake -DCMAKE_PREFIX_PATH=$LIB_TORCH ${Project Path}
cmake --build . --config Release
./torch-app
cmake --build . --config Release时出现问题
一、 找不到 -lCUDA_cublas_LIBRARY-NOTFOUND
解决方法:把cmake升级成最新版本,查看cmake版本方式cmake --version
-
下载并上传到服务器,解压
下载网站:https://cmake.org/download/ -
安装gcc等相关的程序包(已经安装过则忽略该步骤)
-
进入到解压后的目录,在最顶层目录,执行./bootstrap
出现问题:CMake Error at Utilities/cmcurl/CMakeLists.txt:562 (message):
Could not find OpenSSL. Install an OpenSSL development package or
configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.
解决方法:sudo apt-get install libssl-dev
成功 -
在顶层目录下,执行make
出现问题:Source/CMakeFiles/CMakeLib.dir/build.make:2147: recipe for target ‘Source/CMakeFiles/CMakeLib.dir/cmQtAutoMocUic.cxx.o’ failed
make[2]: *** [Source/CMakeFiles/CMakeLib.dir/cmQtAutoMocUic.cxx.o] Error 1
CMakeFiles/Makefile2:2096: recipe for target ‘Source/CMakeFiles/CMakeLib.dir/all’ failed
make[1]: *** [Source/CMakeFiles/CMakeLib.dir/all] Error 2
Makefile:165: recipe for target ‘all’ failed
make: *** [all] Error 2
解决方法:执行cmake .. -DBUILD_TESTS=OFF
成功 -
在顶层目录下,执行make install,如果编译错误,使用sudo make install进行安装
出现问题:Source/CMakeFiles/CMakeLib.dir/build.make:2147: recipe for target ‘Source/CMakeFiles/CMakeLib.dir/cmQtAutoMocUic.cxx.o’ failed
make[2]: *** [Source/CMakeFiles/CMakeLib.dir/cmQtAutoMocUic.cxx.o] Error 1
CMakeFiles/Makefile2:2096: recipe for target ‘Source/CMakeFiles/CMakeLib.dir/all’ failed
make[1]: *** [Source/CMakeFiles/CMakeLib.dir/all] Error 2
Makefile:165: recipe for target ‘all’ failed
make: *** [all] Error 2
-
在~/.bashrc最后添加
export CMAKE_ROOT=${CMAKE PATH} export PATH=$PATH:$CMAKE_ROOT/bin: source ~/.bashrc
执行g++ main.cpp -o main
出现问题:AlphaPose.h:2:25: 致命错误:torch/torch.h:没有那个文件或目录
解决方法:



