Keras imageGenerator Exception: output of generator should be a tuple (x, y, sample_weight) or (x, y). Found: None

我是研究僧i 提交于 2019-12-05 12:16:02

I ran into the same problem while running the code but i was using tensorflow as backend. My problem was that i was running it on an older version of keras.

Upgrade to keras 2.0 by

pip install --upgrade keras

Then update your fit_generator function as follows-

model.fit_generator(generator=train_generator,
                    steps_per_epoch=2048 // 16,
                    epochs=20,
                    validation_data=validation_generator,
                    validation_steps=832//16)

Here, 16 is your batch_size.

You can find the complete updated code by fchollet : Here.

Your generator should be a python generator. You can read more of that here.

Briefly explained, a generator allows you to yield a series of value from the function called without its variables to be cleaned (as it is the case with a return statement for example).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!