Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 使用Keras和Theano的致密层_Python 2.7_Keras_Theano - Fatal编程技术网

Python 2.7 使用Keras和Theano的致密层

Python 2.7 使用Keras和Theano的致密层,python-2.7,keras,theano,Python 2.7,Keras,Theano,我正在开始一个简单的keras教程。我使用的完整代码位于本网站末尾: https://elitedatascience.com/keras-tutorial-deep-learning-in-python 我得到这个错误: ValueError: ('The specified size contains a dimension with value <= 0', (-768, 128)) 及 我将此json文件用于后端配置: { "image_dim_ordering": "tf",

我正在开始一个简单的keras教程。我使用的完整代码位于本网站末尾:

https://elitedatascience.com/keras-tutorial-deep-learning-in-python
我得到这个错误:

ValueError: ('The specified size contains a dimension with value <= 0', (-768, 128))

我将此json文件用于后端配置:

{
"image_dim_ordering": "tf",
"epsilon": 1e-07, 
"floatx": "float32", 
"backend": "theano"
}
你知道问题出在哪里吗?我使用的是python2.7,MNIST数据库似乎是正确的,因为我能够绘制图像,并且可以毫无问题地看到标签

最好的


Áangel.

尝试将
图像尺寸排序设置为
“tf”
“图像尺寸排序”:“th”
,因为您使用的是Theano作为后端。

非常感谢。我想那是我所做的一个错误。我用这个更改编辑了json文件,但它不起作用。我得到了同样的错误。我认为错误在这一行:“model.add(Dense(128,activation='relu'))”,可能是由于sintaxis。我不得不编辑几行代码来匹配我安装的keras版本,这与官方文档不同。例如,行“model.add(Conv2D(32,3,3,activation='relu'))被更改为带有括号的“model.add(Conv2D(32,(3,3),activation='relu'))”。我认为“稠密”也在发生类似的事情。。。
model.add(Dense(10, activation='softmax'))
{
"image_dim_ordering": "tf",
"epsilon": 1e-07, 
"floatx": "float32", 
"backend": "theano"
}