I have the following structure in a .txt file:
/path/to/image x y /path/to/image x y
where x and y are integers.
What I want to do now is: Create a hdf5 file to use in Caffe ('train.prototxt'
)
My Python code looks like this:
import h5py
import numpy as np
import os
text = 'train'
text_dir = text + '.txt'
data = np.genfromtxt(text_dir, delimiter=" ", dtype=None)
h = h5py.File(text + '.hdf5', 'w')
h.create_dataset('data', data=data[:1])
h.create_dataset('label', data=data[1:])
with open(text + "_hdf5.txt", "w") as textfile:
textfile.write(os.getcwd() + '/' +text + '.hdf5')
But this does not work! Any ideas what could be wrong?