Closed SmartMachineBay closed 6 years ago
The problem is in this statement (duh) in Augment.mirror():
return tf.cond(uniform_random < 0.5, lambda: tf.tuple([image, boxes]), lambda: doMirror(image, boxes))
I think wrapping the false_fn (the last arg in the tf.cond) with a tf.tuple should do the trick.
return tf.cond(uniform_random < 0.5, lambda: tf.tuple([image, boxes]), lambda: tf.tuple(doMirror(image, boxes)))
This same error also appears in RFCN-tensorflow.Utils.MultiGather.gatherTopK():
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)]))
but this change clears the error:
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)]))
Fixed, tested with version 1.4.1, it works.
Thanks for the support :).
Dataset/coco2014 loading annotations into memory... Done (t=12.48s) creating index... index created! Loaded 82783 COCO images Dataset/coco2014 loading annotations into memory... Done (t=8.34s) creating index... index created! Loaded 40504 COCO images Traceback (most recent call last): File "./main.py", line 89, in
images, boxes, classes = Augment.augment(dataset.get())
File "/home/hp03/liyahui/runed_ok_RFCN-tensorflow/Dataset/Augment.py", line 59, in augment
image, boxes = mirror(image, boxes)
File "/home/hp03/liyahui/runed_ok_RFCN-tensorflow/Dataset/Augment.py", line 52, in mirror
return tf.cond(uniform_random < 0.5, lambda: tf.tuple([image, boxes]), lambda: doMirror(image, boxes))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 296, in new_func
return func(args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 1843, in cond
"Incompatible return types of true_fn and false_fn: {}".format(e))
TypeError: Incompatible return types of true_fn and false_fn: The two structures don't have the same sequence type. First structure has type <type 'list'>, while second structure has type <type 'tuple'>.
please tell me what should i do? thanks!