如何使用Keras创建CNN模型?

我想创建一个包含所有nSeizures模型的CNN模型,而不是为每个癫痫发作文件单独创建模型,但我在创建过程中遇到了这个错误 < AttributeError: ‘NoneType’ object has no attribute ‘fit_generator’>。

for i in range(0, nSeizure):
    print(nSeizure)
    print('SEIZURE OUT: '+str(i+1))
    print('训练开始')
    ## 创建模型
    model = createModel()
    filesPath=getFilesPathWithoutSeizure(i, indexPat)
    ## 创建一个包含所有nSeizures模型的模型
    for model in range(0, nSeizure):
        mylist.append(model)
        data=mylist.append(model)
        history=data.fit_generator(generate_arrays_for_training(indexPat, filesPath, end=75),
                                 validation_data=generate_arrays_for_training(indexPat, filesPath,
                                 start=75),
                                #steps_per_epoch=10000, epochs=10)
                                steps_per_epoch=int((len(filesPath)-int(len(filesPath)/100*25))),
                                 validation_steps=int((len(filesPath)-int(len(filesPath)/100*75))),
                                verbose=2,
                                epochs=300, max_queue_size=2, shuffle=True, callbacks=[callback])

回答:

mylist.append(model) 返回None。当你调用 data.fit_generator 时,实际上是 None.fit_generator。请考虑重写代码。

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注