【问题标题】: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 文件。

    【讨论】:

      猜你喜欢
      • 2015-11-28
      • 2014-03-07
      • 2018-11-19
      • 1970-01-01
      • 2016-12-13
      • 2013-10-26
      • 2015-08-30
      • 2014-07-08
      • 2017-05-20
      相关资源
      最近更新 更多