Computer Vision/Keras Framework ISSUE
keras version
JackYoon
2021. 5. 3. 21:14
반응형
[Tensorflow 2.x Reshape Error]
ValueError: The channel dimension of the inputs should be defined. Found 'None'
<tensorflow 1.x / keras 2.2.4>
x = keras.layers.GlobalAveragePooling2D() (x)
x = keras.layers.Reshape((1, 1, -1)) (x)
함수형으로 keras Backbone Model을 생성하고 있었습니다. 하지만 tensorflow 2.x로 넘어가서 tf.keras를 사용하면 해당 오류가 발생합니다.
따라서 Reshape -1에 해당 하는 부분에 대한 Shape을 지정해서 넣었더니 오류가 해결되었습니다.
<tensorflow 2.x>
x = keras.layers.GlobalAveragePooling2D() (x)
x = keras.layers.Reshape((1, 1, x.shape[1]))(x)
반응형