smallcorgi / Faster-RCNN_TF

Faster-RCNN in Tensorflow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NameError: name 'roi_pooling_op' is not defined

Tower0823 opened this issue · comments

python3.6 + tensorflow 1.2 + cuda-8.0
How can I modify the make.sh to fit my settings? Need help :(

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./tools/train_net.py", line 112, in
max_iters=args.max_iters)
File "/share/home/hh/towerli/dock_lstm/tools/../lib/fast_rcnn/train.py", line 277, in train_net
sw.train_model(sess, max_iters)
File "/share/home/hh/towerli/dock_lstm/tools/../lib/fast_rcnn/train.py", line 150, in train_model
train_op = tf.train.MomentumOptimizer(lr, momentum).minimize(loss, global_step=global_step)
File "/share/home/hh/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 315, in minimize
grad_loss=grad_loss)
File "/share/home/hh/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/optimizer.py", line 386, in compute_gradients
colocate_gradients_with_ops=colocate_gradients_with_ops)
File "/share/home/hh/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 540, in gradients
grad_scope, op, func_call, lambda: grad_fn(op, *out_grads))
File "/share/home/hh/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 346, in _MaybeCompile
return grad_fn() # Exit early
File "/share/home/hh/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py", line 540, in
grad_scope, op, func_call, lambda: grad_fn(op, *out_grads))
File "/share/home/hh/towerli/dock_lstm/tools/../lib/roi_pooling_layer/roi_pooling_op_grad.py", line 41, in _roi_pool_grad
data_grad = roi_pooling_op.roi_pool_grad(data, rois, argmax, grad, pooled_height, pooled_width, spatial_scale)
NameError: name 'roi_pooling_op' is not defined

This repository is python2.7 compatible. Did you try converting it to python3 before compiling?

That maybe a problem of import which is different between Python2 and 3.
Try to use script 2to3 in python to convert the whole project before debugging if you want to run it with python3.

Here's an example in the begining of lib/roi_pooling_layer/roi_pooling_op_grad.py:
original code:
# import roi_pooling_op
after converting:
from . import roi_pooling_op

Anyway, you can refer to my repository which is converted to python3 and works in TF 1.6