Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning from keras: "Update your Conv2D call to the Keras 2 API"

Tags:

python

keras

I am trying to use keras to create a CNN, but I keep getting this warning which I do not understand how to fix.

Update your Conv2D call to the Keras 2 API: Conv2D(64, (3, 3), activation="relu") after removing the cwd from sys.path.

Can anyone give any ideas about fixing this?

like image 466
Ilia Avatar asked May 25 '17 00:05

Ilia


2 Answers

As it says, it's not an issue. It still works fine although they might change it any day and the code will not work.

In Keras 2 Convolution2D has been replaced by Conv2d along with some changes in the parameters.

Convolution* layers are renamed Conv*.

Conv2D(10, 3, 3) becomes Conv2D(10, (3, 3))

like image 101
BernardoGO Avatar answered Sep 25 '22 01:09

BernardoGO


In keras 2

convolution2D is changed into Conv2d or Conv2D

So use:

from keras.layers import Conv2D instead of **from keras.layers import Convolution2D

classifier.add(Conv2D(32,( 3, 3), input_shape = (64, 64, 3), activation = 'relu')) instead of classifier.add(Conv2D(32,3, 3, input_shape = (64, 64, 3), activation = 'relu'))
like image 26
Suraj Verma Avatar answered Sep 24 '22 01:09

Suraj Verma