简体   繁体   English

python,神经网络,要使用的input_shape的尺寸和值

[英]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.

相关问题 使用Keras将8x8棋盘游戏的input_shape传递到神经网络 - input_shape of an 8x8 board game to a Neural Network with Keras 如何在keras神经网络中正确设置input_shape? - How to properly set input_shape in a keras neural network? 在Python中使用Keras的神经网络中的input_shape问题 - input_shape issue in Neural networks with Keras in Python 当我们尝试拟合熊猫数据帧中的数据时,如何找到卷积神经网络的 input_shape? - How to find input_shape of Convolutional Neural Network when we are trying to fit the data from pandas dataframe? 如果我尝试拟合来自pandas数据框的数据,如何将input_shape赋予卷积神经网络? - How to give input_shape to Convolutional Neural Network if I am trying to fit the data from pandas dataframe? 如果我试图拟合熊猫数据帧中的数据,如何找到卷积神经网络的 input_shape? - How to find input_shape of Convolutional Neural Network if I am trying to fit the data from pandas dataframe? 神经网络的输入形状 - Input shape of a neural network python 中的神经网络:警告:tensorflow:Model 是用形状(无,7)构建的 - Neural Network in python: WARNING:tensorflow:Model was constructed with shape (None, 7) for input Keras Train神经网络维度值错误:预期具有2个维度,但数组的形状为(32,1,4) - Keras Train Neural Network Dimension Value Error: expected to have 2 dimensions, but got array with shape (32, 1, 4) 神经网络的多维输入 - Multi-dimension input to a neural network
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM