There is a question when I run the demo.
when I make in the lib,there is an error:/usr/local/lib/python2.7/dist-packages/tensorflow/include/tensorflow/core/platform/default/mutex.h:25:22: fatal error: nsync_cv.h: No such file or directory. could you help me? thank you!
Same issue this morning ...
You can find this file and replace it with the absolute path.
Yes. You have to edit : /usr/local/lib/python2.7/dist-packages/tensorflow/include/tensorflow/core/platform/default/mutex.h (path mentioned in your error message).
By replacing :
#include "nsync_cv.h"
#include "nsync_mu.h"
By :
#include "external/nsync/public/nsync_cv.h"
#include "external/nsync/public/nsync_mu.h"
Now, make command works !
Or you can edit make.sh.
This error is due to the new placement of include files for external libraries in TensorFlow ! (from 1.1).
I prefer to modify make.sh instead of modifying TensorFlow source code :
TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
NSYNC_INC=$TF_INC"/external/nsync/public"
CUDA_PATH=/usr/local/cuda/
CXXFLAGS=''
if [[ "$OSTYPE" =~ ^darwin ]]; then
CXXFLAGS+='-undefined dynamic_lookup'
fi
cd roi_pooling_layer
if [ -d "$CUDA_PATH" ]; then
nvcc -std=c++11 -c -o roi_pooling_op.cu.o roi_pooling_op_gpu.cu.cc \
-I $TF_INC -I $NSYNC_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CXXFLAGS \
-arch=sm_37
g++ -std=c++11 -shared -o roi_pooling.so roi_pooling_op.cc \
roi_pooling_op.cu.o -I $TF_INC -I $NSYNC_INC -D GOOGLE_CUDA=1 -fPIC $CXXFLAGS \
-lcudart -L $CUDA_PATH/lib64
else
g++ -std=c++11 -shared -o roi_pooling.so roi_pooling_op.cc \
-I $TF_INC -I $NSYNC_INC -fPIC $CXXFLAGS
fi
cd ..
I added NSYNC_INC variable, that correspond to the directory where nsync_cv.h is !
It works !
Pull request : https://github.com/smallcorgi/Faster-RCNN_TF/pull/246/commits/218d17a15c2d55e093fd8f41c545744c8b7faebc
In addition, you can encounter some Undefined symbol error, while the compilation was done correctly. Same issue, it's due to new compilation rules since Tensorflow 1.x.y !
Correct make file ( for tensorflow 1.4.0-gpu) :
TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')
NSYNC_INC=$TF_INC"/external/nsync/public"
CUDA_PATH=/usr/local/cuda/
CXXFLAGS='-D_GLIBCXX_USE_CXX11_ABI=0'
if [[ "$OSTYPE" =~ ^darwin ]]; then
CXXFLAGS+='-undefined dynamic_lookup'
fi
cd roi_pooling_layer
if [ -d "$CUDA_PATH" ]; then
nvcc -std=c++11 -c -o roi_pooling_op.cu.o roi_pooling_op_gpu.cu.cc \
-I $TF_INC -I $NSYNC_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC $CXXFLAGS \
-arch=sm_37 -L $TF_LIB -ltensorflow_framework
g++ -std=c++11 -shared -o roi_pooling.so roi_pooling_op.cc \
roi_pooling_op.cu.o -I $TF_INC -I $NSYNC_INC -D GOOGLE_CUDA=1 -fPIC $CXXFLAGS \
-lcudart -L $CUDA_PATH/lib64 -L $TF_LIB -ltensorflow_framework
else
g++ -std=c++11 -shared -o roi_pooling.so roi_pooling_op.cc \
-I $TF_INC -I $NSYNC_INC -fPIC $CXXFLAGS -L $TF_LIB -ltensorflow_framework
fi
cd ..
I changed CXXFLAGS='-D_GLIBCXX_USE_CXX11_ABI=0', and I added a new compilation flag -L $TF_LIB -ltensorflow_framework with TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())') !
Now demo.py and training script can work ! (about 0.226s/iter on a GTX 1070 for training).
I had changed make.sh,but there is another error: roi_pooling_op.cc:21:61: fatal error: third_party/eigen3/unsupported/Eigen/CXX11/Tensor: No such file or directory
and I try some methods: CXXFLAGS+='-undefined dynamic_lookup' to CXXFLAGS='-D_MWAITXINTRIN_H_INCLUDED'
but,it still dose not work.
Which version of TensorFlow are you using ? On linux ? Built from binaries ? or from source code ?
tensorflow1.4.0 on linux
hummm .. it seems curious.
1/ Did you activate your python env where TensorFlow is installed ?? (like source activate tensorflow)
2 / Is there third_party/eigen3/unsupported/Eigen/CXX11/Tensor starting from this path TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())') ??
3/ Can you try to reinstall Tensorflow :
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp35-cp35m-linux_x86_64.whl
(here for CPU and Python 3.5, see on TensorFlow Install page, to find the URL from different version of Python and CPU vs GPU.
I've downgraded tensorflow to 1.3 and I resolve this problem
I have the same problem as @zhoucong666666 ,when I do make in lib, error like this:
~/Faster-RCNN_TF/lib$ make
python setup.py build_ext --inplace
running build_ext
skipping 'utils/bbox.c' Cython extension (up-to-date)
skipping 'utils/nms.c' Cython extension (up-to-date)
skipping 'nms/cpu_nms.c' Cython extension (up-to-date)
skipping 'nms/gpu_nms.cpp' Cython extension (up-to-date)
rm -rf build
bash make.sh
Traceback (most recent call last):
File "
@JGuillaumin ths.
But @JGuillaumin, could you give me some advice as may tensorflow version is 1.6.0.
Got this error when I run demo.py:
Traceback (most recent call last):
File "./tools/demo.py", line 11, in <module>
from networks.factory import get_network
File "/home/roach/code/Git/Faster-RCNN_TF/tools/../lib/networks/__init__.py", line 8, in <module>
from .VGGnet_train import VGGnet_train
File "/home/roach/code/Git/Faster-RCNN_TF/tools/../lib/networks/VGGnet_train.py", line 2, in <module>
from networks.network import Network
File "/home/roach/code/Git/Faster-RCNN_TF/tools/../lib/networks/network.py", line 3, in <module>
import roi_pooling_layer.roi_pooling_op as roi_pool_op
File "/home/roach/code/Git/Faster-RCNN_TF/tools/../lib/roi_pooling_layer/roi_pooling_op.py", line 5, in <module>
_roi_pooling_module = tf.load_op_library(filename)
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/load_library.py", line 58, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename, status)
File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /home/roach/code/Git/Faster-RCNN_TF/tools/../lib/roi_pooling_layer/roi_pooling.so: undefined symbol: _Z22ROIPoolBackwardLaucherPKffiiiiiiiS0_PfPKiRKN5Eigen9GpuDeviceE
Or, I have to downgrade my tensorflw, :-(
Hello,I use the Makefile that you present,and then I can't find -ltensorflow-framework,how can you do it? thx? @JGuillaumin
But @JGuillaumin, could you give me some advice as may tensorflow version is 1.6.0.
Got this error when I run demo.py:
Traceback (most recent call last): File "./tools/demo.py", line 11, in <module> from networks.factory import get_network File "/home/roach/code/Git/Faster-RCNN_TF/tools/../lib/networks/__init__.py", line 8, in <module> from .VGGnet_train import VGGnet_train File "/home/roach/code/Git/Faster-RCNN_TF/tools/../lib/networks/VGGnet_train.py", line 2, in <module> from networks.network import Network File "/home/roach/code/Git/Faster-RCNN_TF/tools/../lib/networks/network.py", line 3, in <module> import roi_pooling_layer.roi_pooling_op as roi_pool_op File "/home/roach/code/Git/Faster-RCNN_TF/tools/../lib/roi_pooling_layer/roi_pooling_op.py", line 5, in <module> _roi_pooling_module = tf.load_op_library(filename) File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/load_library.py", line 58, in load_op_library lib_handle = py_tf.TF_LoadLibrary(library_filename, status) File "/usr/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__ c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.NotFoundError: /home/roach/code/Git/Faster-RCNN_TF/tools/../lib/roi_pooling_layer/roi_pooling.so: undefined symbol: _Z22ROIPoolBackwardLaucherPKffiiiiiiiS0_PfPKiRKN5Eigen9GpuDeviceEOr, I have to downgrade my tensorflw, :-(
Do you solve this problem? I have the same problem. Do you run demo on gpu?