首页 文章

ValueError:Shape必须是等级3,但对于输入形状为'adjust_hue/Slice'(op:'Slice')的等级为4:[384,12,12,3],[3],[3]

提问于
浏览
0

在处理TensorFlow项目时,我遇到了一个问题,我不知道如何解决它 . 我有

enter image description here

ValueError:Shape必须是等级3,但对于'adjust_hue / Slice'(op:'Slice'),输入形状为[384,12,12,3],[3],[3] .

1 回答

  • 0

    根据[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)
    

相关问题