zherlock030 / YOLOv5_Torchscript

C++ code for running a yolov5s model.
28 stars 5 forks source link

There is a bug in the compilation it #5

Open molyswu opened 4 years ago

molyswu commented 4 years ago

Tried to compilation YOLOv5_Torchscript: libtorch-cu101 cd YOLOv5_Torchscript mkdir -p build &&build cmake .. -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found CUDA: /usr (found version "9.1") -- Caffe2: CUDA detected: 9.1 -- Caffe2: CUDA nvcc is: /usr/bin/nvcc -- Caffe2: CUDA toolkit directory: /usr CMake Error at /home/ai1/libtorch/share/cmake/Caffe2/public/cuda.cmake:42 (message): PyTorch requires CUDA 10.1 and above. Call Stack (most recent call first): ~/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include) ~/libtorch/share/cmake/Torch/TorchConfig.cmake:40 (find_package) CMakeLists.txt:17 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/ai1/YOLOv5_Torchscript/build/CMakeFiles/CMakeOutput.log". See also "/home/ai1/YOLOv5_Torchscript/build/CMakeFiles/CMakeError.log".

Thanks !

zherlock030 commented 4 years ago

Like what said in the error, cmake found cuda9.1 but u use cuda10.1. I think u need to fix ur code in cmakelist and set path for cuda.

molyswu commented 4 years ago

Hi,zherlock030 Set path for cuda in your cmakelist
set(CUDA_DIR "/usr/local/cuda-10.1/target/") find_package(CUDA QUIET)

Tried to compilation a build ,some issues . Could you build a yolov5-torchscript with gpu cuda libtorch . Thanks you!

zherlock030 commented 4 years ago

hi @molyswu Sorry I do not have the environment to build that. I think maybe u could refer to https://github.com/yasenh/libtorch-yolov5.

molyswu commented 4 years ago

Hi@zherlock030 compiled the build is OK, tried to run ./libtorch-yolov5
./libtorch-yolov5 ../weights/yolov5s_last.pt ~/Documents/data/valid/2014.jpg -gpu Error loading the model!

zherlock030 commented 3 years ago

Hi@zherlock030 compiled the build is OK, tried to run ./libtorch-yolov5 ./libtorch-yolov5 ../weights/yolov5s_last.pt ~/Documents/data/valid/2014.jpg -gpu Error loading the model!

Could you provide more detailed information? What error when loading the model?