Multi-Classification NN with Keras error

℡╲_俬逩灬. 提交于 2020-01-06 06:02:25

问题


I am getting an error when trying to do multi-classification with three classes.

Error: TypeError: fit_generator() got multiple values for argument 'steps_per_epoch'

Code Giving Error:

NN.fit_generator(
                        train_set, train_labels,
                        steps_per_epoch=(train_samples/ batch_size),
                        epochs=epochs,
                        validation_data=(validation_set, validation_labels),
                        validation_steps=(validation_samples / batch_size))

Full Code: https://pastebin.com/V1YwJW3X

I would GREATLY appreciate any help with the issue, as I am at a total loss. Thank you!


回答1:


The Keras documentation provides the following definition for fit_generator:

fit_generator(self, generator, steps_per_epoch=None, epochs=1, verbose=1, callbacks=None, validation_data=None, validation_steps=None, class_weight=None, max_queue_size=10, workers=1, use_multiprocessing=False, shuffle=True, initial_epoch=0)

You have provided two positional arguments:

  • train_set - this got assigned to generator
  • train_labels - this got assigned to steps_per_epoch

But then you provide another (now keyword argument) steps_per_epoch, hence the error.



来源:https://stackoverflow.com/questions/50182263/multi-classification-nn-with-keras-error

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