Input * of layer conv2d_* is incompatible with the layer: expected axis -3 of input shape to have value * but received input with shape [None,*,* ,*]のエラーについて


エラーについて

Input * of layer conv2d_* is incompatible with the layer: expected axis -3 of input shape to have value * but received input with shape [None, *, *, *]

convレイヤーを使う際にNCHWとNHWCの差によって生まれるエラー。
「*」の値はmodelの設定によって変わる。

解決法

https://keras.io/ja/backend/
こちらにあるように.keras直下にあるkeras.jsonをエラーに合うように変更する。

  • NCHWにするならchannels_first
  • NWHCにするならchannels_last

バッチ、チャンネル、高さ、幅の並び順の問題は最初にぶつかる壁な気がします。