Torch 是用C/CUDA作为底层实现,用LuaJIT作为接口的机器学习算法框架。
HDF5是用于海量复杂数据集管理的技术,能够支持多种平台与多种语言接口(C,C++,Python等)。
Torch的tutorial只提供了处理images和random tensors的方法,并没有对其他格式提供示例。本文使用将对如何创建HDF5数据集以及如何在Torch中使用HDF5文件格式做一个梳理。
一.安装 hdf5
1. torch 平台上安装
git clone https://github.com/anibali/torch-hdf5.git
cd torch-hdf5
git checkout hdf5-1.10
luarocks make hdf5-0-0.rockspec
2.python安装
sudo pip install h5py
二. 使用Python创建HDF文件
1.创建HDF5对象