AttributeError in lesson1

When I run the jupyter notebook locally on my Mac using keras 2.0, an AttributeError happened as shown below:

vgg = Vgg16()

batches = vgg.get_batches(path+‘train’, batch_size=batch_size)
val_batches = vgg.get_batches(path+‘valid’, batch_size=batch_size*2)
vgg.finetune(batches)
vgg.fit(batches, val_batches, nb_epoch=1)

AttributeError Traceback (most recent call last)
in ()
4 batches = vgg.get_batches(path+‘train’, batch_size=batch_size)
5 val_batches = vgg.get_batches(path+‘valid’, batch_size=batch_size*2)
----> 6 vgg.finetune(batches)
7 vgg.fit(batches, val_batches, nb_epoch=1)

172                           See definition for get_batches().
173         """

–> 174 self.ft(batches.nb_class)
175
176 classes = list(iter(batches.class_indices)) # get a list of all the class labels
AttributeError: ‘DirectoryIterator’ object has no attribute ‘nb_class’

I tried to change the ‘nb_class’ in vgg16.py, but still not working.
Could anyone help me out with this?
Many thanks!

Due to the changes in Keras 2.0 from previous one, this error occurred. In order to comply with Keras 2.0, do as the following thread says i.e.

nb_class to num_class
nb_sample to samples

Hope this helps !

It worked for me, thanks!