简体   繁体   English

卷积层和输入数据上的Keras错误

[英]Keras Error on Convolutional Layer and Input Data

I filtered the training and testing data from CIFAR-100, I take for fruit and vegetables superclass only. 我过滤了CIFAR-100的培训和测试数据,仅适用于水果和蔬菜超类。 Now, I've 2,500 training and 500 testing data. 现在,我有2,500个培训和500个测试数据。 But, I got an error said that wrong dimension input for Convolutional layer. 但是,我得到一个错误,说卷积层的尺寸输入错误。

错误

My array data form: 我的数组数据形式: 数组形式

I hope someone can help me for this case, thank you. 希望有人能为我提供帮助,谢谢。

Your input data should have shape (2500, 3, 32, 32), seems you lost two of the dimensions on your preprocessing steps, either fix those or reshape your data as: 您的输入数据应具有形状(2500、3、32、32),似乎您在预处理步骤中丢失了两个维度,请修复这些维度或将数据重塑为:

inputData = inputData.reshape((2500, 3, 32, 32)).

In general the input for a convolutional layer is (numSamples, numChannels, width, height). 通常,卷积层的输入是(numSamples,numChannels,width,height)。 Note that when using the tensorflow backend the number of channels dimension goes at the end. 请注意,当使用tensorflow后端时,通道数维数在末尾。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM