Libtorch_install - Extended-Object-Detection-ROS/wiki_english GitHub Wiki
Libtorch
Libtorch is C++ API of torch machine learning library.
Install
Download and unzip libtorch.
In CMakeLists.txt file of ExtendedObjectDetection project change line 12:
set(torch OFF)
to
set(torch ON)
And specify path to unzipped libtorch in line 43:
set(Torch_DIR "/home/${USER}/Lib/libtorch/share/cmake/Torch/")
Then rebuild project.
Install libtorch with CUDA on Jetson
Firstly, you should download PyTorch for Jetson on below link
https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
Secondly, install the “whl” file following this guide
https://docs.nvidia.com/deeplearning/frameworks/install-pytorch-jetson-platform/index.html
After you finished the above steps. The LibTorch has been installed on your device.
How to Use?
where is LibTorch installed?
Commonly, it installs at ~/.local/lib/python3.6/site-packages/torch/ In this dir, you can see bin, lib, and include dir, It is organized just like other C++ libraries. How to use LibTorch with CMake?
for example, add these two lines to your CMakeLists.txt
// set PyTorch path
set(Torch_DIR /home/nx/.local/lib/python3.6/site-packages/torch/share/cmake/Torch)
// use find_package to use libtorch
find_package(Torch REQUIRED)