I want to use torchvision c++ on my Jetson Nano (Jetpack 4.5).
I need only torchvision::ops::nms function from torchvision. If you can give source codes of that function or an alternative implementation of that function with torch (c++) please share, and installation will not be required any more.
I have tried MANY ways to install, but haven’t succeed yet.
For example I tried How to set up OpenCV, LibTorch, and Torchvision with Cmake for Mac - this approach, but getting this error while running make
and can’t solve it.
[ 2%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/common_jpeg.cpp.o
[ 5%] Building CXX object CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_image.cpp.o
In file included from /usr/include/c++/7/bits/stl_algobase.h:59:0,
from /usr/include/c++/7/memory:62,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:4,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/aarch64-linux-gnu/c++/7/bits/c++config.h:250:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
/usr/include/aarch64-linux-gnu/c++/7/bits/c++config.h:438:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/bits/stl_algobase.h:59:0,
from /usr/include/c++/7/memory:62,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:4,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/aarch64-linux-gnu/c++/7/bits/c++config.h:563:3: error: operator '&&' has no right operand
&& _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201505L \
^~
In file included from /usr/include/c++/7/bits/stl_algobase.h:66:0,
from /usr/include/c++/7/memory:62,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:4,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/stl_iterator_base_funcs.h:107:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/string:52:0,
from /usr/include/c++/7/stdexcept:39,
from /usr/include/c++/7/array:39,
from /usr/include/c++/7/tuple:39,
from /usr/include/c++/7/bits/unique_ptr.h:37,
from /usr/include/c++/7/memory:80,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:4,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/basic_string.h:56:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/string:53:0,
from /usr/include/c++/7/stdexcept:39,
from /usr/include/c++/7/array:39,
from /usr/include/c++/7/tuple:39,
from /usr/include/c++/7/bits/unique_ptr.h:37,
from /usr/include/c++/7/memory:80,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:4,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/basic_string.tcc:50:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/array:39:0,
from /usr/include/c++/7/tuple:39,
from /usr/include/c++/7/bits/unique_ptr.h:37,
from /usr/include/c++/7/memory:80,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:4,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/stdexcept:46:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
/usr/include/c++/7/stdexcept:127:28: error: operator '||' has no left operand
#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS
^~
/usr/include/c++/7/stdexcept:211:28: error: operator '||' has no left operand
#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS
^~
In file included from /usr/include/c++/7/bits/ios_base.h:41:0,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /home/jets/Desktop/project/torch/include/c10/macros/Macros.h:228,
from /home/jets/Desktop/project/torch/include/c10/core/DeviceType.h:8,
from /home/jets/Desktop/project/torch/include/c10/core/Device.h:3,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:6,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/locale_classes.h:354:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/bits/ios_base.h:46:0,
from /usr/include/c++/7/ios:42,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /home/jets/Desktop/project/torch/include/c10/macros/Macros.h:228,
from /home/jets/Desktop/project/torch/include/c10/core/DeviceType.h:8,
from /home/jets/Desktop/project/torch/include/c10/core/Device.h:3,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:6,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/system_error:91:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/ios:42:0,
from /usr/include/c++/7/istream:38,
from /usr/include/c++/7/sstream:38,
from /home/jets/Desktop/project/torch/include/c10/macros/Macros.h:228,
from /home/jets/Desktop/project/torch/include/c10/core/DeviceType.h:8,
from /home/jets/Desktop/project/torch/include/c10/core/Device.h:3,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:6,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/ios_base.h:230:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
/usr/include/c++/7/bits/ios_base.h:254:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /home/jets/Desktop/project/torch/include/c10/macros/Macros.h:228:0,
from /home/jets/Desktop/project/torch/include/c10/core/DeviceType.h:8,
from /home/jets/Desktop/project/torch/include/c10/core/Device.h:3,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:6,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/sstream:297:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/sstream:826:0,
from /home/jets/Desktop/project/torch/include/c10/macros/Macros.h:228,
from /home/jets/Desktop/project/torch/include/c10/core/DeviceType.h:8,
from /home/jets/Desktop/project/torch/include/c10/core/Device.h:3,
from /home/jets/Desktop/project/torch/include/c10/core/Allocator.h:6,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/sstream.tcc:92:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/locale:41:0,
from /usr/include/c++/7/iomanip:43,
from /home/jets/Desktop/project/torch/include/c10/util/logging_is_not_google_glog.h:8,
from /home/jets/Desktop/project/torch/include/c10/util/Logging.h:28,
from /home/jets/Desktop/project/torch/include/c10/core/TensorImpl.h:19,
from /home/jets/Desktop/project/torch/include/ATen/core/TensorBody.h:14,
from /home/jets/Desktop/project/torch/include/ATen/Tensor.h:3,
from /home/jets/Desktop/project/torch/include/ATen/Context.h:4,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:9,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/locale_facets_nonio.h:719:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
/usr/include/c++/7/bits/locale_facets_nonio.h:1567:33: error: operator '&&' has no right operand
&& _GLIBCXX_USE_CXX11_ABI == 0
^~
/usr/include/c++/7/bits/locale_facets_nonio.h:1590:33: error: operator '&&' has no right operand
&& _GLIBCXX_USE_CXX11_ABI == 0
^~
/usr/include/c++/7/bits/locale_facets_nonio.h:1712:33: error: operator '&&' has no right operand
&& _GLIBCXX_USE_CXX11_ABI == 0
^~
/usr/include/c++/7/bits/locale_facets_nonio.h:1747:33: error: operator '&&' has no right operand
&& _GLIBCXX_USE_CXX11_ABI == 0
^~
In file included from /usr/include/c++/7/bits/locale_facets_nonio.h:2013:0,
from /usr/include/c++/7/locale:41,
from /usr/include/c++/7/iomanip:43,
from /home/jets/Desktop/project/torch/include/c10/util/logging_is_not_google_glog.h:8,
from /home/jets/Desktop/project/torch/include/c10/util/Logging.h:28,
from /home/jets/Desktop/project/torch/include/c10/core/TensorImpl.h:19,
from /home/jets/Desktop/project/torch/include/ATen/core/TensorBody.h:14,
from /home/jets/Desktop/project/torch/include/ATen/Tensor.h:3,
from /home/jets/Desktop/project/torch/include/ATen/Context.h:4,
from /home/jets/Desktop/project/torch/include/ATen/ATen.h:9,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/locale_facets_nonio.tcc:352:33: error: operator '&&' has no right operand
&& _GLIBCXX_USE_CXX11_ABI == 0
^~
/usr/include/c++/7/bits/locale_facets_nonio.tcc:564:33: error: operator '&&' has no right operand
&& _GLIBCXX_USE_CXX11_ABI == 0
^~
In file included from /usr/include/c++/7/list:63:0,
from /home/jets/Desktop/project/torch/include/ATen/core/dispatch/OperatorEntry.h:17,
from /home/jets/Desktop/project/torch/include/ATen/core/dispatch/Dispatcher.h:6,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/runtime/operator.h:6,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/ir/ir.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/api/function_impl.h:4,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/api/method.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/api/object.h:6,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/frontend/tracer.h:9,
from /home/jets/Desktop/project/torch/include/torch/csrc/autograd/generated/variable_factories.h:12,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:7,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/stl_list.h:326:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
/usr/include/c++/7/bits/stl_list.h:349:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
/usr/include/c++/7/bits/stl_list.h:1886:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
/usr/include/c++/7/bits/stl_list.h:1955:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
In file included from /usr/include/c++/7/list:64:0,
from /home/jets/Desktop/project/torch/include/ATen/core/dispatch/OperatorEntry.h:17,
from /home/jets/Desktop/project/torch/include/ATen/core/dispatch/Dispatcher.h:6,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/runtime/operator.h:6,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/ir/ir.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/api/function_impl.h:4,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/api/method.h:7,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/api/object.h:6,
from /home/jets/Desktop/project/torch/include/torch/csrc/jit/frontend/tracer.h:9,
from /home/jets/Desktop/project/torch/include/torch/csrc/autograd/generated/variable_factories.h:12,
from /home/jets/Desktop/project/torch/include/torch/csrc/api/include/torch/types.h:7,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.h:3,
from /home/jets/Desktop/project/vision/torchvision/csrc/io/image/cpu/decode_image.cpp:1:
/usr/include/c++/7/bits/list.tcc:178:27: error: #if with no expression
#if _GLIBCXX_USE_CXX11_ABI
^
CMakeFiles/torchvision.dir/build.make:89: recipe for target 'CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_image.cpp.o' failed
make[2]: *** [CMakeFiles/torchvision.dir/torchvision/csrc/io/image/cpu/decode_image.cpp.o] Error 1
CMakeFiles/Makefile2:82: recipe for target 'CMakeFiles/torchvision.dir/all' failed
make[1]: *** [CMakeFiles/torchvision.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2
Changed the compiler, tried multiple other things but still cant fix this.
Tried to install torchvision for python and link libs in cmake (worked for libtorch installation), but there is no “include” or “libs” directories in torchvision directory.
Tried to install with this instructions, but when I’m running sudo -H pip3 install torchvision-0.11.0a0+fa347eb-cp36-cp36m-linux_aarch64.whl
it says “No module named Cython”, but I have cython installed, then it tries to build numpy from source and again fails (I have numpy installed).
And that’s not all, tried millions of other ways but still stuck (even googled in Chinese).
Please, if you know something that can help, please say.