NVIDIA / retinanet-examples

Fast and accurate object detection with end-to-end GPU optimization
BSD 3-Clause "New" or "Revised" License
887 stars 271 forks source link

_C.so: undefined symbol: _ZN2cv8fastFreeEPv #15

Closed thepaulm closed 5 years ago

thepaulm commented 5 years ago

Hi! I cloned, the ran python setup.py develop, and now when I run retinanet I get the following undefined symbol:

retinanet-examples$ retinanet
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(retinanet:1787): Gdk-CRITICAL **: 11:34:45.038: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed

(retinanet:1787): Gdk-CRITICAL **: 11:34:45.039: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
Traceback (most recent call last):
  File "/home/paulm/py3/env/bin/retinanet", line 11, in <module>
    load_entry_point('retinanet', 'console_scripts', 'retinanet')()
  File "/home/paulm/py3/env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/paulm/py3/env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/home/paulm/py3/env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/home/paulm/py3/env/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/paulm/code/retinanet-examples/retinanet/main.py", line 10, in <module>
    from retinanet import infer, train, utils
  File "/home/paulm/code/retinanet-examples/retinanet/infer.py", line 12, in <module>
    from .model import Model
  File "/home/paulm/code/retinanet-examples/retinanet/model.py", line 8, in <module>
    from ._C import Engine
ImportError: /home/paulm/code/retinanet-examples/retinanet/_C.so: undefined symbol: _ZN2cv8fastFreeEPv
free(): invalid pointer
Aborted (core dumped)

Perhaps I have mismatched versions of some dep? Here's what I'm linked against:

retinanet-examples$ ldd retinanet/_C.so 
    linux-vdso.so.1 (0x00007fff52cef000)
    libnvinfer.so.5 => /usr/lib/x86_64-linux-gnu/libnvinfer.so.5 (0x00007f97f23d5000)
    libnvonnxparser.so.0 => /usr/lib/x86_64-linux-gnu/libnvonnxparser.so.0 (0x00007f97f1c21000)
    libcudart.so.10.1 => /usr/local/cuda-10.1/targets/x86_64-linux/lib/libcudart.so.10.1 (0x00007f97f19a5000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f97f161c000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f97f127e000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f97f1066000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f97f0c75000)
    libcudnn.so.7 => /usr/lib/x86_64-linux-gnu/libcudnn.so.7 (0x00007f97de6c5000)
    libcublas.so.10 => /usr/lib/x86_64-linux-gnu/libcublas.so.10 (0x00007f97d9a0b000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f97d9807000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f97d95e8000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f97d93e0000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f97fb227000)
    libcublasLt.so.10 => /usr/lib/x86_64-linux-gnu/libcublasLt.so.10 (0x00007f97d6e80000)

Any ideas or help greatly appreciated.

pkashinkunti commented 5 years ago

Hi thepaulm,

We would highly recommend that you use the NGC pytorch docker images (as described here: https://github.com/NVIDIA/retinanet-examples#installation) to have a consistent set of libraries/versions that are known to work with the repo.

If you have issues installing when using the NGC pytorch docker image, feel free to reopen this issue.

thepaulm commented 5 years ago

Yes, thanks - I did try using the docker container also - there is some layer that requires authentication?

gpu:~$ docker pull nvcr.io/nvidia/pytorch:19.04-py3
19.04-py3: Pulling from nvidia/pytorch
34667c7e4631: Pull complete 
d18d76a881a4: Pull complete 
119c7358fbfc: Pull complete 
2aaf13f3eff0: Pull complete 
202fa0f8874b: Pull complete 
3b700a61ede6: Pull complete 
87e6ca450d3f: Pull complete 
a1e76dce1aec: Pull complete 
9b91fa2f9276: Pull complete 
b5877a9add73: Pull complete 
bab74df105f1: Pull complete 
534bbf505504: Pull complete 
4956bf3bbbb9: Pull complete 
f4371944c97d: Pull complete 
4615a735431d: Pull complete 
5db2639932b5: Pull complete 
629d5c9d75a4: Pull complete 
8071b94b5429: Pull complete 
6eb8eba2ad5a: Pull complete 
e32e86c15b8b: Pull complete 
08db5b51b243: Pull complete 
f71ce95fb406: Pull complete 
3498ed8c5685: Pull complete 
62819d8896c1: Pull complete 
34bc85bf8bef: Pull complete 
dcdd5f85017f: Pull complete 
1e228f756b55: Downloading [=======================================>           ]  403.1MB/513MB
6c274a5c6ed9: Download complete 
b612cb3eb549: Download complete 
09bc2eb1d5a3: Download complete 
3d155d839dec: Download complete 
9f75ceb8178e: Download complete 
ba33e14c75b6: Download complete 
63bcc02f721d: Download complete 
2ea18e2895f5: Download complete 
e8902dd4ab2a: Download complete 
400dcdc94e4e: Download complete 
0297bfb11547: Downloading [=====>                                             ]   38.3MB/357.2MB
fbe8a1f0debc: Download complete 
138f27b0276a: Downloading 
bbb8e519ffd2: Waiting 
cec7301f8e2b: Waiting 
b757202b46b5: Waiting 
2d7d64ca32b6: Waiting 
22eb1ebbe50f: Waiting 
75c6afcffa7f: Waiting 
e50a94f94c1f: Waiting 
f2c418b39ad9: Waiting 
7ff288d55581: Waiting 
e8030d0b21df: Waiting 
unauthorized: authentication required
BowieHsu commented 5 years ago

@thepaulm you need to register on nvidia gpu cloud and Generate the API key, before you pull the container, you have to log in using API key. https://ngc.nvidia.com/setup

Junsong-Wang commented 5 years ago

it is because the opencv library is not well linked. Please extend the library in setup.py as follows: libraries=['nvinfer', 'nvinfer_plugin', 'nvonnxparser', 'opencv_core', 'opencv_highgui', 'opencv_imgproc', 'opencv_imgcodecs'])

piotr-anyvision commented 5 years ago

Added these libraries and still seeing the error:

Traceback (most recent call last): File "/home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/main.py", line 10, in from retinanet import infer, train, utils File "/home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/infer.py", line 13, in from .model import Model File "/home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/model.py", line 9, in from .box import generate_anchors, snap_to_anchors, decode, nms File "/home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/box.py", line 2, in from ._C import decode as decode_cuda ImportError: /home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/_C.so: undefined symbol: _ZN2cv8fastFreeEPv

SnowRipple commented 5 years ago

Anyone managed to fix this error?

Which opencv version I should use?

goktug97 commented 5 years ago

Make a clean build with this changes. For example remove the directory called build and use python setup.py install

SnowRipple commented 5 years ago

Hi @goktug97 ! I removed the build folder, added libraries=['nvinfer', 'nvinfer_plugin', 'nvonnxparser', 'opencv_core', 'opencv_highgui', 'opencv_imgproc', 'opencv_imgcodecs'])

run the python setup.py clean --all install (clean to make sure everything is removed) and got no errors: `running clean removing 'build/temp.linux-x86_64-3.7' (and everything under it) removing 'build/lib.linux-x86_64-3.7' (and everything under it) removing 'build/bdist.linux-x86_64' (and everything under it) 'build/scripts-3.7' does not exist -- can't clean it removing 'build' running install running bdist_egg running egg_info writing retinanet.egg-info/PKG-INFO writing dependency_links to retinanet.egg-info/dependency_links.txt writing entry points to retinanet.egg-info/entry_points.txt writing requirements to retinanet.egg-info/requires.txt writing top-level names to retinanet.egg-info/top_level.txt package init file 'retinanet/init.py' not found (or not a regular file) reading manifest file 'retinanet.egg-info/SOURCES.txt' writing manifest file 'retinanet.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build creating build/lib.linux-x86_64-3.7 creating build/lib.linux-x86_64-3.7/retinanet copying retinanet/model_old.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/main.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/benchmark_yuval.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/infer.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/loss_old.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/loss.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/box.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/train.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/data.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/demo_camera.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/utils.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/visualize.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/evaluate.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/dali.py -> build/lib.linux-x86_64-3.7/retinanet copying retinanet/model.py -> build/lib.linux-x86_64-3.7/retinanet creating build/lib.linux-x86_64-3.7/retinanet/backbones copying retinanet/backbones/resnet_old.py -> build/lib.linux-x86_64-3.7/retinanet/backbones copying retinanet/backbones/resnet.py -> build/lib.linux-x86_64-3.7/retinanet/backbones copying retinanet/backbones/utils.py -> build/lib.linux-x86_64-3.7/retinanet/backbones copying retinanet/backbones/fpn.py -> build/lib.linux-x86_64-3.7/retinanet/backbones copying retinanet/backbones/layers.py -> build/lib.linux-x86_64-3.7/retinanet/backbones copying retinanet/backbones/init.py -> build/lib.linux-x86_64-3.7/retinanet/backbones running build_ext building 'retinanet._C' extension creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/csrc creating build/temp.linux-x86_64-3.7/csrc/cuda gcc -pthread -B /home/snow_ripple/anaconda3/envs/tensor_rt/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/TH -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/include/python3.7m -c csrc/extensions.cpp -o build/temp.linux-x86_64-3.7/csrc/extensions.o -std=c++11 -O2 -Wall -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ gcc -pthread -B /home/snow_ripple/anaconda3/envs/tensor_rt/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/TH -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/include/python3.7m -c csrc/engine.cpp -o build/temp.linux-x86_64-3.7/csrc/engine.o -std=c++11 -O2 -Wall -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ /usr/local/cuda/bin/nvcc -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/TH -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/include/python3.7m -c csrc/cuda/decode.cu -o build/temp.linux-x86_64-3.7/csrc/cuda/decode.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --compiler-options '-fPIC' -std=c++11 --expt-extended-lambda --use_fast_math -Xcompiler -Wall -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_72,code=sm_72 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_75,code=compute_75 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 /usr/local/cuda/bin/nvcc -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/TH -I/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/snow_ripple/anaconda3/envs/tensor_rt/include/python3.7m -c csrc/cuda/nms.cu -o build/temp.linux-x86_64-3.7/csrc/cuda/nms.o -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --compiler-options '-fPIC' -std=c++11 --expt-extended-lambda --use_fast_math -Xcompiler -Wall -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_72,code=sm_72 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_75,code=compute_75 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 g++ -pthread -shared -B /home/snow_ripple/anaconda3/envs/tensor_rt/compiler_compat -L/home/snow_ripple/anaconda3/envs/tensor_rt/lib -Wl,-rpath=/home/snow_ripple/anaconda3/envs/tensor_rt/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/csrc/extensions.o build/temp.linux-x86_64-3.7/csrc/engine.o build/temp.linux-x86_64-3.7/csrc/cuda/decode.o build/temp.linux-x86_64-3.7/csrc/cuda/nms.o -L/usr/local/cuda/lib64 -lnvinfer -lnvinfer_plugin -lnvonnxparser -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -lcudart -o build/lib.linux-x86_64-3.7/retinanet/_C.so creating build/bdist.linux-x86_64 creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/model_old.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/main.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/benchmark_yuval.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/infer.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/loss_old.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/loss.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/_C.so -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/box.py -> build/bdist.linux-x86_64/egg/retinanet creating build/bdist.linux-x86_64/egg/retinanet/backbones copying build/lib.linux-x86_64-3.7/retinanet/backbones/resnet_old.py -> build/bdist.linux-x86_64/egg/retinanet/backbones copying build/lib.linux-x86_64-3.7/retinanet/backbones/resnet.py -> build/bdist.linux-x86_64/egg/retinanet/backbones copying build/lib.linux-x86_64-3.7/retinanet/backbones/utils.py -> build/bdist.linux-x86_64/egg/retinanet/backbones copying build/lib.linux-x86_64-3.7/retinanet/backbones/fpn.py -> build/bdist.linux-x86_64/egg/retinanet/backbones copying build/lib.linux-x86_64-3.7/retinanet/backbones/layers.py -> build/bdist.linux-x86_64/egg/retinanet/backbones copying build/lib.linux-x86_64-3.7/retinanet/backbones/init.py -> build/bdist.linux-x86_64/egg/retinanet/backbones copying build/lib.linux-x86_64-3.7/retinanet/train.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/data.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/demo_camera.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/utils.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/visualize.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/evaluate.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/dali.py -> build/bdist.linux-x86_64/egg/retinanet copying build/lib.linux-x86_64-3.7/retinanet/model.py -> build/bdist.linux-x86_64/egg/retinanet byte-compiling build/bdist.linux-x86_64/egg/retinanet/model_old.py to model_old.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/main.py to main.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/benchmark_yuval.py to benchmark_yuval.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/infer.py to infer.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/loss_old.py to loss_old.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/loss.py to loss.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/box.py to box.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/backbones/resnet_old.py to resnet_old.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/backbones/resnet.py to resnet.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/backbones/utils.py to utils.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/backbones/fpn.py to fpn.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/backbones/layers.py to layers.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/backbones/init.py to init.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/train.py to train.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/data.py to data.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/demo_camera.py to demo_camera.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/utils.py to utils.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/visualize.py to visualize.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/evaluate.py to evaluate.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/dali.py to dali.cpython-37.pyc byte-compiling build/bdist.linux-x86_64/egg/retinanet/model.py to model.cpython-37.pyc creating stub loader for retinanet/_C.so byte-compiling build/bdist.linux-x86_64/egg/retinanet/_C.py to _C.cpython-37.pyc creating build/bdist.linux-x86_64/egg/EGG-INFO copying retinanet.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying retinanet.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying retinanet.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying retinanet.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying retinanet.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying retinanet.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt zip_safe flag not set; analyzing archive contents... retinanet.pycache._C.cpython-37: module references file creating 'dist/retinanet-0.1-py3.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing retinanet-0.1-py3.7-linux-x86_64.egg removing '/home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/retinanet-0.1-py3.7-linux-x86_64.egg' (and everything under it) creating /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/retinanet-0.1-py3.7-linux-x86_64.egg Extracting retinanet-0.1-py3.7-linux-x86_64.egg to /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages retinanet 0.1 is already the active version in easy-install.pth Installing retinanet script to /home/snow_ripple/anaconda3/envs/tensor_rt/bin

Installed /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages/retinanet-0.1-py3.7-linux-x86_64.egg Processing dependencies for retinanet==0.1 Searching for requests==2.22.0 Best match: requests 2.22.0 Adding requests 2.22.0 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for Pillow==6.1.0 Best match: Pillow 6.1.0 Adding Pillow 6.1.0 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for pycocotools==2.0.0 Best match: pycocotools 2.0.0 Adding pycocotools 2.0.0 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for apex==0.1 Best match: apex 0.1 Adding apex 0.1 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for torchvision==0.3.0 Best match: torchvision 0.3.0 Adding torchvision 0.3.0 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for torch==1.1.0 Best match: torch 1.1.0 Adding torch 1.1.0 to easy-install.pth file Installing convert-caffe2-to-onnx script to /home/snow_ripple/anaconda3/envs/tensor_rt/bin Installing convert-onnx-to-caffe2 script to /home/snow_ripple/anaconda3/envs/tensor_rt/bin

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for idna==2.8 Best match: idna 2.8 Adding idna 2.8 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for chardet==3.0.4 Best match: chardet 3.0.4 Adding chardet 3.0.4 to easy-install.pth file Installing chardetect script to /home/snow_ripple/anaconda3/envs/tensor_rt/bin

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for certifi==2019.6.16 Best match: certifi 2019.6.16 Adding certifi 2019.6.16 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for urllib3==1.25.3 Best match: urllib3 1.25.3 Adding urllib3 1.25.3 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for six==1.12.0 Best match: six 1.12.0 Adding six 1.12.0 to easy-install.pth file

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Searching for numpy==1.16.4 Best match: numpy 1.16.4 Adding numpy 1.16.4 to easy-install.pth file Installing f2py script to /home/snow_ripple/anaconda3/envs/tensor_rt/bin Installing f2py3 script to /home/snow_ripple/anaconda3/envs/tensor_rt/bin Installing f2py3.7 script to /home/snow_ripple/anaconda3/envs/tensor_rt/bin

Using /home/snow_ripple/anaconda3/envs/tensor_rt/lib/python3.7/site-packages Finished processing dependencies for retinanet==0.1 ` But I am still seeing this error when ,e.g. exporting to tensoRT:

Traceback (most recent call last): File "/home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/main.py", line 10, in <module> from retinanet import infer, train, utils File "/home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/infer.py", line 15, in <module> from model import Model File "/home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/model.py", line 9, in <module> from box import generate_anchors, snap_to_anchors, decode, nms File "/home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/box.py", line 2, in <module> from _C import decode as decode_cuda ImportError: /home/snow_ripple/workspace/020_retinanet_nvidia/retinanet/_C.so: undefined symbol: _ZN2cv8fastFreeEPv

goktug97 commented 5 years ago

Maybe It can't find them, check with pkg-config whether It can't find them or not

pkg-config --cflags opencv
pkg-config --libs opencv
SnowRipple commented 5 years ago

That's the output I'm getting:

`(tensor_rt) snow_ripple@sapphira:~$ pkg-config --cflags opencv

-I/usr/local/include/opencv -I/usr/local/include

(tensor_rt) snow_ripple@sapphira:~$ pkg-config --libs opencv

-L/usr/local/lib -lopencv_cudabgsegm -lopencv_cudaobjdetect -lopencv_cudastereo -lopencv_dnn -lopencv_ml -lopencv_shape -lopencv_stitching -lopencv_cudafeatures2d -lopencv_superres -lopencv_cudacodec -lopencv_videostab -lopencv_cudaoptflow -lopencv_cudalegacy -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_photo -lopencv_imgcodecs -lopencv_cudawarping -lopencv_cudaimgproc -lopencv_cudafilters -lopencv_video -lopencv_objdetect -lopencv_imgproc -lopencv_flann -lopencv_cudaarithm -lopencv_core -lopencv_cudev`

Are you using conda/some environment too? Which version of opencv do you have?

goktug97 commented 5 years ago

Are you using conda/some environment too?

No environment. System Python 3.6

Which version of opencv do you have?

sudo apt install libopencv-dev python3-opencv

kurff commented 5 years ago

It seems can not link opencv when building _C.so from source file circa By adding: library_dirs= '/usr/local/lib64/'], libraries=['nvinfer', 'nvinfer_plugin', 'nvonnxparser', 'opencv_core', 'opencv_imgproc', 'opencv_highgui'])

That solve my problem, hope it works for you

azuryl commented 4 years ago

1. libraries=['nvinfer', 'nvinfer_plugin', 'nvonnxparser', 'opencv_core', 'opencv_imgproc', 'opencv_highgui'])

pkg-config --cflags opencv-I/usr/include/opencv4/opencv -I/usr/include/opencv4

pkg-config --libs opencv-lopencv_dnn -lopencv_gapi -lopencv_highgui -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_core

  1. install opencv in /usr/local

3 python setup.py clean --all install is success

4 retinanet export -h Traceback (most recent call last): File "/home/anaconda3/envs/py374/bin/retinanet", line 11, in load_entry_point('retinanet==0.1', 'console_scripts', 'retinanet')() File "/home/anaconda3/envs/py374/lib/python3.7/site-packages/pkg_resources/init.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/home/anaconda3/envs/py374/lib/python3.7/site-packages/pkg_resources/init.py", line 2852, in load_entry_point return ep.load() File "/home/anaconda3/envs/py374/lib/python3.7/site-packages/pkg_resources/init.py", line 2443, in load return self.resolve() File "/home/anaconda3/envs/py374/lib/python3.7/site-packages/pkg_resources/init.py", line 2449, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "/home/anaconda3/envs/py374/lib/python3.7/site-packages/retinanet-0.1-py3.7-linux-x86_64.egg/retinanet/main.py", line 10, in from retinanet import infer, train, utils File "/home/anaconda3/envs/py374/lib/python3.7/site-packages/retinanet-0.1-py3.7-linux-x86_64.egg/retinanet/infer.py", line 13, in from .model import Model File "/home/anaconda3/envs/py374/lib/python3.7/site-packages/retinanet-0.1-py3.7-linux-x86_64.egg/retinanet/model.py", line 8, in from ._C import Engine ImportError: /home/anaconda3/envs/py374/lib/python3.7/site-packages/retinanet-0.1-py3.7-linux-x86_64.egg/retinanet/_C.so: undefined symbol: _ZN2cv6imreadERKSsi

azuryl commented 4 years ago

@

Are you using conda/some environment too?

No environment. System Python 3.6

Which version of opencv do you have?

sudo apt install libopencv-dev python3-opencv

how you install pytorch if you not use conda

waxz commented 4 years ago

https://stackoverflow.com/questions/51308292/swig-linker-undefined-symbol-zn2cv8fastfreeepv-cvfastfreevoid You have to pass libraries and library-paths to the build-process by using arguments libraries and library_dirs

ext = Extension(....
                libraries=["opencv_xfeatures2d", "opencv_features2d", 
                           "opencv_highgui", "opencv_core"],
                library_dirs=['/usr/local/lib']
                )