Attribute error when using small sample - keras_lesson1


I am getting the following error when i run the code with a smaller sample size.

model.fit_generator(train_generator, train_generator.n // batch_size, epochs=3, workers=4,
validation_data=validation_generator, validation_steps=validation_generator.n // batch_size)

AttributeError: ‘ProgbarLogger’ object has no attribute ‘log_values’

When i use more number of images im not getting any error.

Thank you!!

Hi @Sri,

Try setting batch_size to a smaller number. This error arrises when your batch_size is set to a larger value than your sample set size.

I was also facing the similar issue and noticed that batch_size was set to 64 whereas my sample training and validation set had only 16 and 8 images respectively. So I set batch_size to 4 and it ran successfully.

It may also arise when your sample_set is not correctly split. From what I understood is that the split should ideally be divisible by batch_size. For e.g., batch_size = 3 and sample_set_size is 10. Although I am not completely sure about this point. Maybe someone can correct me on this ?

For more info, you can also refer