[ lesson2 ] fit_generator() got an unexpected keyword argument 'steps'

Environment

Anaconda
Python 2.x
Keras 2.x
Theano
Ram 16GB

To resolve the memory error, as I am running the program on a 16GB RAM, I used the below code instead

model.fit_generator(batches, samples_per_epoch=batches.n, nb_epoch=5,
                    validation_data=val_batches, nb_val_samples=val_batches.n)

This was suggested in post

Post correction getting an error at the model.fit_generator line

steps_per_epo = batches.n / batch_size
print (steps_per_epo)
model.fit_generator(batches, steps_per_epoch=steps_per_epo, nb_epoch=5,
                    validation_data=val_batches, val_samples=val_batches.n)

Error -

fit_generator() got an unexpected keyword argument ‘steps’

The keras used in part 1 is 1.1.1 not 2.x

I have modified the fit_generator but still I am facing issues. Any pointers ?
Using keras 2.x.

steps_per_epo = batches.n / batch_size
print (steps_per_epo)
model.fit_generator(batches, steps_per_epoch=steps_per_epo, epochs=5,
                    validation_data=val_batches, validation_steps=val_batches.n)

Error

ValueError: Error when checking target: expected dense_3 to have shape (None, 1000) but got array with shape (1L, 2L)

Stuck at this step. Need help!

Check your last layer in the model .In lesson 2 it is dogs or cats , so the last layer should have 2 outputs ,not 1000.

1 Like

I corrected the last layer output to 2.

can I ask you a follow-up question… can fit_generator be used in cases like the planet competition? read multi-label from csv, and how to do that?
thank you