使用Google Colab在Google Drive中使用Google Colab创建使用最佳参数的HDF5文件
我正在尝试使用Google Colab和Google Drive创建一个HDF5,其中包括EPOC,损失和准确性信息。
from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping
filepath = '/models/{epoch:02d}-{loss:.4f}-{val_loss:.4f}-{mae:.4f}-{val_mae:.4f}.hdf5'
callbacks = [EarlyStopping(monitor='val_loss', patience=20),
ModelCheckpoint(filepath, monitor='loss', save_best_only=True, mode='min')]
optimizers.SGD(momentum=0.9)
model.compile(optimizer='SGD', loss='mse', metrics=['mae'])
model.fit(X_train, y_train, validation_split=0.2, epochs=5, callbacks=callbacks, batch_size=16)
我在上面分享了一个简单的代码示例,我没有在代码中遇到错误,但是在Google驱动器中没有创建HDF5文件。
我需要事先在Google Drive中的某个文件夹下在某个文件夹下创建空的HDF5文件吗?
I'm trying to create a hdf5 which is included epoc, loss, and accuracy information by using Google Colab, and Google Drive.
from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping
filepath = '/models/{epoch:02d}-{loss:.4f}-{val_loss:.4f}-{mae:.4f}-{val_mae:.4f}.hdf5'
callbacks = [EarlyStopping(monitor='val_loss', patience=20),
ModelCheckpoint(filepath, monitor='loss', save_best_only=True, mode='min')]
optimizers.SGD(momentum=0.9)
model.compile(optimizer='SGD', loss='mse', metrics=['mae'])
model.fit(X_train, y_train, validation_split=0.2, epochs=5, callbacks=callbacks, batch_size=16)
I shared a simple code example above, I'm not getting an error in the code, but there is no hdf5 file created in google drive.
Do I need to create the empty hdf5 file under a certain folder beforehand in Google Drive?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论