ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (X, X, X)
解决方法:原因是输入的第一个dimension是bachsize,所以需要将数据reshape为(1,X, X, X)。
本文详细解析了在使用TensorFlow进行深度学习模型训练时,遇到的“ValueError:Error when checking input”错误的原因及解决方案。主要是由于输入数据维度不符合模型预期导致,正确的做法是将数据reshape为(batchsize, X, X, X)的形式。
ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (X, X, X)
解决方法:原因是输入的第一个dimension是bachsize,所以需要将数据reshape为(1,X, X, X)。
1755
6711
1万+
9745
4104