I am converting some code which originally used JPEGs as the input to use Matlab MAT files. The code contains the lines:
train_dataset = tf.data.Dataset.list_files(PATH + 'train/*.mat')
train_dataset = train_dataset.shuffle(BUFFER_SIZE)
train_dataset = train_dataset.map(load_image_train)
If I loop through the dataset and print() each element before map(), I get a set of tensors with the file paths visible.
However, within the load_image_train function, this is not the case, the output of print() is:
Tensor("add:0", shape=(), dtype=string)
I would like to use the scipy.io.loadmat() function to get the data from my mat files but it fails because the path is a tensor and not a string. What does dataset.map() do that appears to make the literal string value no longer visible? How do I extract the string so I can use it as input for scipy.io.loadmat()?
Apologies if this is a stupid question, relatively new to Tensorflow and still trying to understand. A lot of discussion I can find of related issues only applies to TF v1. Thank you for any help!
