I'm using Keras 2.0.8 with Python 3 kernel in Jupyter Notebook. My backend is TensorFlow 1.3 and I'm developing on Mac.
Whenever I'm using fit_generator() I'm getting following warning:
/Users/username/anaconda/envs/tensorflow/lib/python3.6/site-packages/ipykernel/main.py:5: UserWarning: The semantics of the Keras 2 argument
steps_per_epoch
is not the same as the Keras 1 argumentsamples_per_epoch
.steps_per_epoch
is the number of batches to draw from the generator at each epoch. Basically steps_per_epoch = samples_per_epoch/batch_size. Similarlynb_val_samples
->validation_steps
andval_samples
->steps
arguments have changed. Update your method calls accordingly. /Users/username/anaconda/envs/tensorflow/lib/python3.6/site-packages/ipykernel/main.py:5: UserWarning: Update yourfit_generator
call to the Keras 2 API:fit_generator(<keras.pre..., steps_per_epoch=60000, validation_data=<keras.pre..., epochs=1, validation_steps=10000)
Below is the code for my model (simple MNIST linear classifier but I'm getting this warning for every model I use):
model = Sequential([
Lambda(normalize_input, input_shape=(1, 28, 28)),
Flatten(),
Dense(10, activation='softmax')
])
model.compile(Adam(),
loss='categorical_crossentropy',
metrics=['accuracy'])
And this is my fit_generator() call:
model.fit_generator(batches,
steps_per_epoch=steps_per_epoch,
nb_epoch=1,
validation_data=test_batches,
nb_val_samples=test_batches.n)
I understand what this warning is telling me. This is not a problem in my case. How can I get rid of it?
This warning occurs if there's any Keras 1.0 keyword in your function call. Update your function call by replacing nb_epoch
with epochs
, and nb_val_samples
with validation_steps
.
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