带有Keras错误的多分类NN [英] Multi-Classification NN with Keras error
本文介绍了带有Keras错误的多分类NN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试对三个类进行多分类时出现错误.
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'
代码提供错误:
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))
完整代码: https://pastebin.com/V1YwJW3X
对于此问题的任何帮助,我将不胜感激,因为我不知所措.谢谢!
I would GREATLY appreciate any help with the issue, as I am at a total loss. Thank you!
推荐答案
Keras文档为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
-这已分配给generator
-
train_labels
-这已分配给steps_per_epoch
train_set
- this got assigned togenerator
train_labels
- this got assigned tosteps_per_epoch
但是随后您提供了另一个(现在为关键字参数)steps_per_epoch
,因此出现了错误.
But then you provide another (now keyword argument) steps_per_epoch
, hence the error.
这篇关于带有Keras错误的多分类NN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文