【问题标题】:I want to add more than one argument in callbacks. How can i solve this error?我想在回调中添加多个参数。我该如何解决这个错误?
【发布时间】:2020-06-19 12:31:33
【问题描述】:

我收到这个错误

" AttributeError: 'list' 对象没有属性 'set_model'"

当我在 model.fit_generator 中添加学习计划回调callbacks_list

<callbacks=[callback,callbacks_list]> 

我该如何解决这个错误??

lrate = LearningRateScheduler(step_decay)
callbacks_list = [lrate]
history=model.fit_generator(generate_arrays_for_training(indexPat, filesPath, end=75), #end=75),
                                validation_data=generate_arrays_for_training(indexPat, filesPath, start=75),#start=75),
                                steps_per_epoch=int((len(filesPath)-int(len(filesPath)/100*25))),#*25), 
                                validation_steps=int((len(filesPath)-int(len(filesPath)/100*75))),#*75),
                                verbose=2,
                                epochs=300, max_queue_size=2, shuffle=True, callbacks=[callback,callbacks_list])


【问题讨论】:

    标签: python deep-learning callback model-fitting learning-rate


    【解决方案1】:

    您将其中一个回调放在不必要的列表中,这会产生错误。只需这样做:

    callbacks=[callback, lrate]
    

    【讨论】:

      猜你喜欢
      • 2016-07-21
      • 2016-09-09
      • 1970-01-01
      • 1970-01-01
      • 2015-02-28
      • 2013-08-16
      相关资源
      最近更新 更多