在使用keras在调试densnet时出现上述问题:
x = concatenate([x, cb], axis=-1)
原因是,图像通道数位置的不同造成的,keras基于tensorflow开发的而tensorflow的图像格式是[batchsize,H,W,channels],在执行vi ~/.keras/keras.json时发现:
1 {
2 "floatx": "float32",
3 "epsilon": 1e-07,
4 "backend": "tensorflow",
5 "image_data_format": "channels_first"
6 }
~
~
~
~
~
~
修改image_data_format,将"channels_first改为channel_last,并保存。