【问题标题】:Converting dataset into HDF5 file将数据集转换为 HDF5 文件
【发布时间】:2019-08-07 05:29:42
【问题描述】:
我想将面部表情数据集转换为 HDF5 文件,但我不知道具体该怎么做。
来自 here 我知道如何使用 cat-vs-dog 数据集进行操作,但我想知道一般情况下是如何完成的。
(我所有这些的目的是加快我在 google colaboratory 中的 CNN 模型训练过程,我通过安装 google drive 并因此从 google drive 读取我的数据集进行了尝试,但是训练我的模型太慢了(甚至比我的电脑!))。
【问题讨论】:
标签:
deep-learning
conv-neural-network
hdf5
google-colaboratory
【解决方案1】:
首先需要导入包h5py
import h5py
然后,打开一个hdf5 格式的文件,如下所示:
with h5py.File(os.path.join(output_folder, 'file_name' + '.hdf5'), 'a') as h:
// process file here as normal
有关详细信息,请参阅函数 create_input_files here 了解更多信息,或者您可以克隆 repo 并运行 python create_input_files 以查看该函数的实际工作原理以及如何创建 hdf5 文件。