UserWarning: Update your `Conv2D`
来源:互联网 发布:spss绘制散点图矩阵 编辑:程序博客网 时间:2024/05/29 04:17
Keras 2.0版本运行demo出错的
由于是神经网络小白,在运行demo的时候不懂keras的版本问题,出现了一下的警告:
C:\ProgramData\Anaconda2\python.exe"F:/Program Files (x86)/JetBrains/PycharmProjects/untitled1/CNN4.py"
Using Theano backend.
F:/Program Files(x86)/JetBrains/PycharmProjects/untitled1/CNN4.py:27: UserWarning: Update your `Conv2D`call to the Keras 2 API: `Conv2D(30, (5, 5), padding="valid",activation="relu", input_shape=(1, 28, 28...)`
model.add(Convolution2D(30, 5, 5, border_mode='valid', input_shape=(1, 28,28), activation='relu'))
F:/Program Files(x86)/JetBrains/PycharmProjects/untitled1/CNN4.py:30: UserWarning: Update your `Conv2D`call to the Keras 2 API: `Conv2D(15, (3, 3), activation="relu")`
model.add(Convolution2D(15, 3, 3, activation='relu'))
C:\ProgramData\Anaconda2\lib\site-packages\keras\models.py:826:UserWarning: The `nb_epoch` argument in `fit` has been renamed `epochs`.
warnings.warn('The `nb_epoch` argument in `fit` '
出现这些警告是由于keras的版本更新的问题,这里是keras2.0的更新文档的链接:
https://github.com/fchollet/keras/wiki/Keras-2.0-release-notes
再说说我出现的警告的解决方式:
1、The nb_epoch argumenthas been renamed epochs everywhere.所以神经网络的训练次数需要用epochs来定义,不再是nb_epoch 。
以前写法:
model.fit(X_train, y_train,validation_data=(X_test, y_test), nb_epoch=69, batch_size=200, verbose=2)
正确写法:
model.fit(X_train, y_train,validation_data=(X_test, y_test), epochs=69, batch_size=200, verbose=2)
2、Convolution* layersare renamed Conv*.所以定义卷积层需要用Conv2D而不再是Convolution2D。
正确写法:注意(5, 5) 是括号括起来,以前不用括起来
from keras.layers.convolutional import Conv2D
model.add(Conv2D(32, (5, 5), padding='valid',input_shape=(1, 28, 28), activation='relu'))
以前错误写法:
from keras.layers.convolutional import Convolution2D
model.add(Convolution2D(32, (5, 5),padding='valid', input_shape=(1, 28, 28), activation='relu'))
再次运行demo的话警告全无!
所以作为初学者还是需要注意keras2.0版本的一些写法上的差别。笔者目前只碰到这样俩个问题,如有其他的关于keras2.0版本上的问题,请参考笔者上面给出的链接,自信查阅。
参考网站:
1、https://github.com/fchollet/keras/wiki/Keras-2.0-release-notes 2017.4.5
- UserWarning: Update your `Conv2D`
- BeautifulSoup4 UserWarning
- BeautifulSoup4 UserWarning
- BeautifulSoup4 UserWarning
- WAYS TO UPDATE YOUR DEVICE
- import MySQLdb UserWarning错误。
- import MySQLdb UserWarning
- The Canonical Way to Update Your System
- Pytorch Conv2d
- Build update.zip from your own android source code
- How to Update Your App for iOS 7
- myeclipse6.5 blue注册 Enter or update your subscription information.
- Run 'pod install' or update your CocoaPods install
- required opengl extension,please update your opengl driver
- How to update Docker image to maintain your containers secure
- How to uninstall/update/ your python in Linux
- tf.nn.conv2d 实例
- tf.nn.conv2d()
- Drawable setBounds()中的rect
- python文件读写
- J-Link JTAG/SWD接口
- 菜鸟装逼指南--linux内核中听过就能记住的概念
- javap浅析-书籍第3章的手写稿样稿
- UserWarning: Update your `Conv2D`
- 配置视图解析器简化视图名称
- 内存泄露和内存溢出
- Java实现简单的医院管理系统源码
- CSS3的线性渐变 和 径向渐变。
- Spring之路-聊聊Bean装配
- Disqus评论框改造工程-Jekyll等静态博客实现Disqus代理访问
- Unity显示时间、电量和网络
- Sublime Text 3的众多帮手!!!!