As far as I know, Using numpy() method isn't possible in map function in tensorflow dataset. So how can I get the value of a tensor there? I want to convert a tensor to an int there so that I can use it as an index of a dictionary.
def process_path(file_path):
print('file_path in process_path:', file_path)
label = tf.strings.split(tf.strings.split(file_path, '/')[-1], '.')[-2]
print('label in process_path:', label, type(label))
label = tf.strings.to_number(label, tf.int64)
labelint = labels['Male'][label]
print(labelint)
img = tf.io.read_file(file_path)
img = decode_img(img)
return img, label
I want to use above code in the map function, but I get error! I appreciate your help.