RobertCsordas / RFCN-tensorflow

RFCN implementation in TensorFlow
292 stars 137 forks source link

TypeError while running test.py #12

Closed rw1993 closed 6 years ago

rw1993 commented 7 years ago

I run the command below CUDA_VISIBLE_DEVICES= python test.py -n /data1/export/model -i /data/coco/images/train2014/COCO_train2014_000000144590.jpg -o result.jpg

get TypeError TypeError: Incompatible return types of true_fn and false_fn: The two structures don't have the same sequence type. First structure has type <class 'tensorflow.python.ops.gen_nn_ops.TopKV2'>, while second structure has type <type 'list'>.

How solve this problem?

obendidi commented 7 years ago

Hello, I had this problem when I tried to use the code on another machine where I installed the latest tensorflow (1.2.0) ,downgrading to tensorflow 1.0 should probably fix it

attendfov commented 7 years ago

you just go to RFCN-tensorflow/Utils/MultiGather.py at line 30: change src code: values, indices = tf.cond(isMoreThanK, lambda: tf.nn.top_k(t, k=k, sorted=sorted), lambda: tf.tuple([t, tf.zeros((0,1), tf.int32)])) to values, indices = tf.cond(isMoreThanK, lambda: tf.tuple(tf.nn.top_k(t, k=k, sorted=sorted)), lambda: tf.tuple([t, tf.zeros((0,1), tf.int32)]))

RobertCsordas commented 6 years ago

Just made it compatible with newer TF versions. This should not be a problem anymore.