The example of tensorflow is https://www.tensorflow.org/tutorials/audio/simple_audio
I want to know the file_path
in this example as below:
def get_waveform_and_label(file_path):
label = get_label(file_path)
audio_binary = tf.io.read_file(file_path)
waveform = decode_audio(audio_binary)
return waveform, label
The 'file_path' is called in the function as below:
waveform_ds = files_ds.map(get_waveform_and_label, num_parallel_calls=AUTOTUNE)
I tried to get the value of the file_path using the print(file_path)
, but the answer is Tensor("args_0:0", shape=(), dtype=string)
.
That is not the exact value of file_path.
Finally, I don't know the value of the file_path
and input parameters of get_waveform_and_label
in the waveform_ds = files_ds.map(get_waveform_and_label, num_parallel_calls=AUTOTUNE)
.
I have been stuck in the same problem, but I think I got it:
The file_path comes from the file_ds variable, where file_ds "represents potentially a large set of element", where each element is the 'file path' to each of the wav. file.
After you set the train_files variable, run the following to see what I mean.
Then when you use the map function
It's applyting the function
get_waveform_and_label
to each of the elements of the large set, in this case to each wav file.references: https://www.tensorflow.org/api_docs/python/tf/data/Dataset