【发布时间】:2022-12-12 07:09:32
【问题描述】:
# Load the hdf5 files
resnet50 = h5py.File('/content/RestNet 50 best_model.hdf5', 'r')
ourmodel = h5py.File('/content/best_model.hdf5', 'r')
resnet152 = h5py.File('/content/best_model_4.hdf5', 'r')
# Get the predictions from each model
predictions1 = resnet50.predict(images)
predictions2 = ourmodel.predict(images)
predictions3 = resnet152.predict(images)
# Combine the predictions using a majority vote
predictions = np.array([predictions1, predictions2, predictions3])
predictions = np.mean(predictions, axis=0)
print(predictions)
错误是
OSError:无法打开文件(截断文件:eof = 225443840,sblock->base_addr = 0,stored_eof = 245806944)
【问题讨论】:
-
你应该使用
tf.keras.models.load_model而不是h5py.File加载模型 -
@V.M 这不是问题所在,问题是为什么会出现错误。
-
问题是这些 HDF5 文件之一已损坏或不完整(如部分下载),您从哪里得到它们?
标签: python tensorflow machine-learning keras deep-learning