PoseCNN: ImportError while Running the demo

when Running the demo:

./experiments/scripts/demo.sh --gpu 0

I got the following error:

ImportError: /home/zgl/PoseCNN/tools/…/lib/synthesize/synthesizer.so: undefined symbol: ZN11SynthesizerC1ENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5

anyone has gotten the same error and solved it?

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I got the error below when running the demo.

...
 File "./tools/demo.py", line 13, in <module>
    from fcn.test import test_net_images
  File "/PoseCNN/tools/../lib/fcn/test.py", line 29, in <module>
    from normals import gpu_normals
ImportError: cannot import name gpu_normals

Where can I install normals?

BTW, This is my Dockerfile.

FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04

RUN apt-get update
RUN apt-get install python-pip python-dev python-pip python-dev git curl libglib2.0-0 libsm6 libxext6 libgtk2.0-dev -y
RUN pip install tensorflow-gpu opencv-python easydict scipy transforms3d

RUN git clone https://github.com/yuxng/PoseCNN.git

WORKDIR PoseCNN/lib

RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/libcuda.so.1
RUN LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs/:$LD_LIBRARY_PATH sh make.sh

# download VGG-16.npy
RUN curl -c /tmp/cookie.txt -s -L "https://drive.google.com/uc?export=download&id=1UdmOKrr9t4IetMubX-y-Pcn7AVaWJ2bL" |grep confirm |  sed -e\
 "s/^.*confirm=\(.*\)&amp;id=.*$/\1/" | xargs -I{} curl -b /tmp/cookie.txt  -L -o vgg16.npy "https://drive.google.com/uc?confirm={}&export=d\
ownload&id=1UdmOKrr9t4IetMubX-y-Pcn7AVaWJ2bL"
RUN mv vgg16.npy /PoseCNN/data/imagenet_models/

# dwonload model
RUN curl -c /tmp/cookie.txt -s -L "https://drive.google.com/uc?export=download&id=1UNJ56Za6--bHGgD3lbteZtXLC2E-liWz" |grep confirm |  sed -e\
 "s/^.*confirm=\(.*\)&amp;id=.*$/\1/" | xargs -I{} curl -b /tmp/cookie.txt  -L -o demo_models.zip "https://drive.google.com/uc?confirm={}&ex\
port=download&id=1UNJ56Za6--bHGgD3lbteZtXLC2E-liWz"
RUN mv demo_models.zip /PoseCNN/data/demo_models

WORKDIR /PoseCNN
RUN ./experiments/scripts/demo.sh 0

Check this to find gcc version used - https://www.tensorflow.org/versions/master/install/install_sources

I installed tensorflow using conda, so probably it used gcc-4.8

Now, my gcc -version was 5.4, which means my tensorflow is compiled using gcc-4.8 and I am compiling the lib code using gcc-5.4 which is causing the error, atleast in my case.

To fix this, install gcc-4.8, you should have /usr/bin/gcc-4.8 and /usr/bin/g+±4.8 after that. This error will still happen, because when our ll /usr/bin/gcc is still pointed to gcc-5.4.

Now, change the softlink to :-

sudo ln -sf /usr/bin/gcc-4.8/usr/bin/gcc`` sudo ln -sf /usr/bin/g++-4.8 /usr/bin/g++

Now, check gcc --version and g++ --version and if they are at 4.8 do:

cd PoseCNN/lib ./make.sh && git clean -f && python setup.py build_ext --inplace && cd .. && ./experiments/scripts/demo.sh 0

NOTE: git clean -f removes any untracked file so dont run it and just delete below given files manually. Or run git clean -n to check what will git clean -f delete without deleting anything. It should be following files only:

rm lib/nms/gpu_nms.cpp rm lib/normals/gpu_normals.cpp

File “/home/zgl/PoseCNN/tools/…/lib/utils/nms_wrapper.py”, line 12, in from nms.gpu_nms import gpu_nms ImportError: No module named gpu_nms

sudo pip install cython or conda install cython then, from $ROOT/lib: python setup.py build_ext --inplace

In the current version, you might have to comment out the Extension(synthesizer…) in the setup.py file, as that one files to compile (synthesize/synthesizer.cpp:588:27: fatal error: synthesizer.hpp: No such file or directory), but apart from that, this fixes the gpu_nms issue.