I am currently trying to implement this tutorial code into my own convnet.py but I get an error. Tutorial
This is the full error:
Traceback (most recent call last):
File "convnet.py", line 6, in <module>
model.add(Conv2D(32, (3, 3), input_shape=(3, 150, 150)))
TypeError: __init__() missing 1 required positional argument: 'nb_col'
Here are the first 10 lines on which the program goes wrong:
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=(3, 150, 150)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
The code is located in the file convnet.py and I run the file like this:
python convnet.py
You are probably using an old version of Keras that had the following signature:
Conv2D(self, nb_filter, nb_row, nb_col, ...)
With this old version, you would define the conv layer as:
model.add(Conv2D(32, 3, 3, input_shape=(3, 150, 150)))
You can check the version you are using with:
import keras
print(keras.__version__)
I suggest that you update your Keras.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With