Convert string/path and feed into hdf5 dataset

Hi All,

I’m aware that this isn’t a pytorch issue directly, but was wondering, how do I convert a string or path into something that can be fed into a hdf5 table. For example, I am returning a numpy img array, label, and path to the image, from a dataloader, where the path to the image would look like this:

('mults/train/0/5678.ndpi/40x/40x-236247-16634-80384-8704.png',)

I basically want to feed it into a table like this:

path = 'data_' + str(phase) + '.hdf5'
hdf5_file = h5py.File(path, mode='w')
hdf5_file.create_dataset(str(phase) + '_img_paths', (len(dataloaders_dict[phase]),))

Maybe I am wrong to feed into such data into a table :man_shrugging: