about the Keras 2.0 version of the Run demo error problem
Because it is the neural network small white, when running the demo does not understand Keras version problem, appeared a warning:
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 ' to the Keras 2 API: ' Conv2d (5, 5), padding= "valid", activation= "Relu", input_shape= (1, 28, 28 ...) '
Model.add (convolution2d, 5, 5, border_mode= ' valid ', input_shape= (1, m), activation= ' Relu '))
f:/ Program Files (x86)/jetbrains/pycharmprojects/untitled1/cnn4.py:30:userwarning:update your ' conv2d ' call to the Keras 2 API: ' Conv2d (3, 3), activation= "Relu") '
Model.add (convolution2d (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 ')
These warnings are due to an issue with the Keras version update, which is a link to the keras2.0 update document:
Https://github.com/fchollet/keras/wiki/Keras-2.0-release-notes
And then again, the way I came up with the warning solution:
1. The Nb_epoch argument has been renamed Epochs. So the training times of neural networks need to be defined with everywhere, no longer epochs.
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* layers are renamed conv*. So the definition of the convolution layer needs to be conv2d instead of convolution2d.
Model.add (convolution2d (5, 5), padding= ' valid ', input_shape= (1, a), activation= ' Relu '))
Model.add (conv2d (5, 5), padding= ' valid ', input_shape= (1, a), activation= ' Relu '))
The appropriate imported packages are:
From keras.layers.convolutional import conv2d
is no longer:
From keras.layers.convolutional import convolution2d
If you run the demo again, the warnings are all free.
Therefore, as a beginner or need to pay attention to the keras2.0 version of some of the differences in the wording. I currently only encounter such two problems, if there are other questions about the keras2.0 version, please refer to the author above the link, self-confidence to check.
Reference website:
1, Https://github.com/fchollet/keras/wiki/Keras-2.0-release-notes 2017.4.5