我尝试更改cifar10示例以实现3d CNN。 但是除了卷积和汇集之外,似乎还有其他一些我应该改变的事情。 当我只更改了卷积层,池层和输入时,我得到以下错误。有什么建议我应该做什么,或者有什么例子吗? 感谢。
File "/mnt/disk1/Fu/Function/Tensorflow/Test/cifar10.py", line 152, in distorted_inputs
batch_size=FLAGS.batch_size)
File "/mnt/disk1/Fu/Function/Tensorflow/Test/cifar10_input.py", line 125, in distorted_inputs
shuffle = False)
File "/mnt/disk1/Fu/Function/Tensorflow/Test/cifar10_input.py", line 88, in _generate_image_and_label_batch
tf.image_summary('images', images)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/logging_ops.py", line 151, in image_summary
tag=tag, tensor=tensor, max_images=max_images, name=scope)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_logging_ops.py", line 161, in _image_summary
name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 749, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2380, in create_op
original_op=self._default_original_op, op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1298, in __init__
self._traceback = _extract_stack()
InvalidArgumentError (see above for traceback): Tensor must be 4-D with last dim 1, 3, or 4, not [20,32,32,32,1]
[[Node: ImageSummary = ImageSummary[T=DT_FLOAT, bad_color=Tensor<type: uint8 shape: [4] values: 255 0 0...>, max_images=3, _device="/job:localhost/replica:0/task:0/cpu:0"](ImageSummary/tag, batch)]]
[[Node: local4/weight_loss/_104 = _Send[T=DT_FLOAT, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/cpu:0", send_device="/job:localhost/replica:0/task:0/gpu:0", send_device_incarnation=1, tensor_name="edge_48_local4/weight_loss", _device="/job:localhost/replica:0/task:0/gpu:0"](local4/weight_loss)]]
答案 0 :(得分:1)
您还需要更改图像摘要以支持3D图像(或者,更轻松地将其从图表中删除)。