【发布时间】:2018-10-31 04:20:44
【问题描述】:
Keras 初学者——我正在尝试在本地文件夹中的一系列图像上训练一个非常简单的神经网络,但是当我尝试使用 fit_generator 时出现错误。
来自
model.fit_generator(train_batches,steps_per_epoch=33, validation_data=valid_batches,validation_steps=50,epochs=10,verbose=2)`
我得到了错误
RuntimeError: You must compile your model before using it.
尽管我立即用
编译了关于它的行中的模型model.compile(Adam(0.01),loss="categorical_crossentropy",metrics=["accuracy"])
运行没有错误。 (见图片)。
【问题讨论】: