在处理TensorFlow项目时,我遇到了一个问题,我不知道如何解决它 . 我有
ValueError:Shape必须是等级3,但对于'adjust_hue / Slice'(op:'Slice'),输入形状为[384,12,12,3],[3],[3] .
根据[https://github.com/tensorflow/tensorflow/issues/8926]
某些tf.image函数仅接受单个图像作为输入 .
但是一些图像操作(例如tf.image.random_brightness(),tf.image.random_contrast())允许批量 .
解决方案是使用lambda来处理批处理:
hue = lambda x: tf.image.random_hue(x, 0.5) inputs = tf.map_fn(hue, inputs)
1 回答
根据[https://github.com/tensorflow/tensorflow/issues/8926]
某些tf.image函数仅接受单个图像作为输入 .
但是一些图像操作(例如tf.image.random_brightness(),tf.image.random_contrast())允许批量 .
解决方案是使用lambda来处理批处理: