print out the value of tfrecord file of tensorflow. It can also save the values of tfrecord to numpy or write in python pickle file.
tensorflow tfrecord file is not easy to read out. So i release this code.
I try to rewrite the tensorflow tfrecord file into python cpickle file, and then easily play with other tools. I try on Google Audioset: https://research.google.com/audioset/download.html The format of tfrecord in Audioset is like:
Frame-level features are stored as tensorflow.SequenceExample protocol buffers. A tensorflow.SequenceExample proto is reproduced here in text format:
context: { feature: { key : "video_id" value: { bytes_list: { value: [YouTube video id string] } } } feature: { key : "start_time_seconds" value: { float_list: { value: 6.0 } } } feature: { key : "end_time_seconds" value: { float_list: { value: 16.0 } } } feature: { key : "labels" value: { int64_list: { value: [1, 522, 11, 172] # The meaning of the labels can be found here. } } } } feature_lists: { feature_list: { key : "audio_embedding" value: { feature: { bytes_list: { value: [128 8bit quantized features] } } feature: { bytes_list: { value: [128 8bit quantized features] } } } ... # Repeated for every second of the segment }
}