[英]python, neural network, dimension and value of input_shape to be used
i need to build a CNN model on a dataset which has 65536 rows (represent 1 image for each), 49 columns (7x7 image) and binary class(50th column). 我需要在具有65536行(每个代表1张图像),49列(7x7图像)和二进制类(第50列)的数据集上构建CNN模型。
I am referencing examples on performing CNN using mnist dataset but i failed to build the train model. 我正在参考有关使用mnist数据集执行CNN的示例,但未能建立火车模型。
When i'm on this line of code: 当我在这行代码上时:
model.add(Conv2D(30 ,(5,5), padding='valid', activation='relu',input_shape=(1,7,7))
i am have this error : 我有这个错误:
ValueError: Negative dimension size caused by subtracting 5 from 1 for 'conv2d_42/convolution' (op: 'Conv2D') with input shapes: [?,1,7,7], [5,5,7,30].
where i try this : 我在这里尝试:
model.add(Conv2D(30 ,(5,5), padding='valid', activation='relu',input_shape=(1(7,7)))
I had this : 我有这个:
TypeError: int() argument must be a string or a number, not 'tuple'
what im asking is what value of input_shape i should be using to build the model 我问的是我应该使用哪个input_shape值来构建模型
As you know, Keras can run on top of either Theano of Tensorflow. 如您所知,Keras可以在Tensorflow的Theano之上运行。 You are using Theano dimension ordering (channels, height, width) but your Keras seems to be using Tensorflow backend, with Tensorflow dimension ordering (height, width, channels). 您正在使用Theano维度排序(通道,高度,宽度),但Keras似乎正在使用Tensorflow后端,并使用Tensorflow维度排序(高度,宽度,通道)。
I would suggest rewriting the code and put channel dimension (=1) last. 我建议重写代码,最后放置通道尺寸(= 1)。 There are also way of changing backend and/or dimension ordering by editing the keras.json. 还有一些通过编辑keras.json来更改后端和/或维度顺序的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.