Search code examples
pythontensorflowhdf5training-dataconv-neural-network

how to read .hdf5 datafile as input to a convolutional neural network?


I have saved my large array of images and their labels in HDF5 format using this link: Saving and loading a large number of images (data) into a single HDF5 file which gives me following keys.
list of datasets:

['test_img', 'test_labels', 'train_img', 'train_labels', 'train_mean', 'val_img', 'val_labels']  

Now, I want to provide training data and training labels to a convolutional neural network (VGG-16 or ResNet) for training purpose and also want to validate and test my result using CNN. How can I input my data from HDF5 file into CNN?


Solution

  • Have a look at this open-source project tftables.

    This other thread also has a great detailed answer by mikkola, explaining how to use your own generator with the new Tensorflow Dataset API otherwise.