这个问题常见且不小心就会遇到,记录下O(∩_∩)O哈!
frr@frr:~/Documents/code/pointnet/models$ python pointnet_SE.py ('input_image', <tf.Tensor 'ExpandDims:0' shape=(32, 1024, 3, 1) dtype=float32>) Traceback (most recent call last): File "pointnet_SE.py", line 138, in <module> net, end_points = get_model(inputs, True) File "pointnet_SE.py", line 37, in get_model transform = input_transform_net(net, is_training, bn_decay, K=3) File "/home/frr/Documents/code/pointnet/models/transform_nets.py", line 29, in input_transform_net scope='tconv1', bn_decay=bn_decay) File "/home/frr/Documents/code/pointnet/models/../utils/tf_util.py", line 167, in conv2d bn_decay=bn_decay, scope='bn') File "/home/frr/Documents/code/pointnet/models/../utils/tf_util.py", line 536, in batch_norm_for_conv2d return batch_norm_template(inputs, is_training, scope, [0, 1, 2], bn_decay) File "/home/frr/Documents/code/pointnet/models/../utils/tf_util.py", line 482, in batch_norm_template lambda: tf.no_op()) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py", line 289, in new_func return func(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/control_flow_ops.py", line 1802, in cond raise TypeError("pred must not be a Python bool") TypeError: pred must not be a Python bool贴出一段先吓一下小伙伴们,有些小伙伴可能刚接触代码没有很久,碰到error就会非常烦躁,甚至直接就give up了,但是作为祖国花朵的我们怎么能说放弃就放弃呢?其实看着这段报错很吓人,有用的只有最后一行!!
TypeError: pred must not be a Python bool其实就是个类型错误,或者不兼容的问题,
LZ直接定义is_training = True,因为定义的is_training=True不是tf.bool类型,所以导致不兼容,只要定义的时候加上type就行了,举个例子:
is_training=tf.cast(True,tf.bool)调代码就还是得慢慢来,切勿心浮气躁,小伙伴们加油!哈哈,顺便祝下自己生日快乐,Felaim每天要加油,开心O(∩_∩)O~~