Linux终端运行fasterrcnn,运行tensorflow版的fasterRCNN遇到的问题总结

最近在学习使用tensorflow,从github上找了很多fcnn的开源代码,最后选择了CharlesShang版本的,因为觉得比较新,项目地址为:https://github.com/CharlesShang/TFFRCNN

该项目需要的配置作者在readme里面写的非常清楚,但是在编译cython和roi_pooling_op中遇到了一些问题,make过不去剩下的也都进行不了。 我的电脑配置是Ubuntu16.04,CUDA8.0,cudnn6,tensorflow的版本是1.4.1,显卡是TITIANX.

从地址处下载代码后,cd到Faster-RCNN_TF/lib,然后就make,就开始报错了.

第一个问题找不到 nsync_cv.h

这个问题的主要原因是因为TF的版本变了,不知nsync_cv.h的位置,

解决方式为加入nsync_cv.h路径,就是在make.sh文件中每个g++中都加入语句

-I $TF_INC"/external/nsync/public"

第二个问题 undefined symbol: _ZTIN10tensorflow8OpKernelE

Then while trying to load the .so file I run into tensorflow.python.framework.errors_impl.

NotFoundError: ./max_align_bytes_op.so: undefined symbol: _ZTIN10tensorflow8OpKernelE

网上说貌似对10系列显卡不支持

解决方式为在 make.sh 文件中加入

TF_LIB=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_lib())')

然后在每个 g++ 中加入  -L $TF_LIB

并且把 g++ 中的 -D_GLIBCXX_USE_CXX11_ABI=1 改为 -D_GLIBCXX_USE_CXX11_ABI=0

最终的make.sh文件如下:(如果有问题可以copy一份尝试一下)

#!/usr/bin/env bash

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())')

echo $TF_INC

echo $TF_LIB

CUDA_PATH=/usr/local/cuda/

cd roi_pooling_layer

nvcc -std=c++11 -c -o roi_pooling_op.cu.o roi_pooling_op_gpu.cu.cc \

-I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52

## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below

#g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o roi_pooling.so roi_pooling_op.cc \

#roi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64

# for gcc5-built tf

g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o roi_pooling.so roi_pooling_op.cc \

roi_pooling_op.cu.o -I $TF_INC -I $TF_INC"/external/nsync/public" -L $TF_LIB -ltensorflow_framework -O2 -fPIC -lcudart -L $CUDA_PATH/lib64

cd ..

# add building psroi_pooling layer

cd psroi_pooling_layer

nvcc -std=c++11 -c -o psroi_pooling_op.cu.o psroi_pooling_op_gpu.cu.cc \

-I $TF_INC -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC -arch=sm_52

g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o psroi_pooling.so psroi_pooling_op.cc \

psroi_pooling_op.cu.o -I $TF_INC -I $TF_INC"/external/nsync/public" -L $TF_LIB -ltensorflow_framework -O2 -fPIC -lcudart -L $CUDA_PATH/lib64

## if you install tf using already-built binary, or gcc version 4.x, uncomment the two lines below

#g++ -std=c++11 -shared -D_GLIBCXX_USE_CXX11_ABI=0 -o psroi_pooling.so psroi_pooling_op.cc \

#psroi_pooling_op.cu.o -I $TF_INC -fPIC -lcudart -L $CUDA_PATH/lib64

cd ..

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值