【发布时间】:2017-09-14 20:17:00
【问题描述】:
我说的是https://research.google.com/audioset/download.html 提供的音频特征数据集,它是一个包含帧级音频 tfrecord 的 tar.gz 存档。
从 tfrecord 文件中提取其他所有内容都可以正常工作(我可以提取键:video_id、start_time_seconds、end_time_seconds、标签),但训练所需的实际嵌入似乎根本不存在。当我从数据集中遍历任何 tfrecord 文件的内容时,只会打印四个键 video_id、start_time_seconds、end_time_seconds 和标签。
这是我正在使用的代码:
import tensorflow as tf
import numpy as np
def readTfRecordSamples(tfrecords_filename):
record_iterator = tf.python_io.tf_record_iterator(path=tfrecords_filename)
for string_record in record_iterator:
example = tf.train.Example()
example.ParseFromString(string_record)
print(example) # this prints the abovementioned 4 keys but NOT audio_embeddings
# the first label can be then parsed like this:
label = (example.features.feature['labels'].int64_list.value[0])
print('label 1: ' + str(label))
# this, however, does not work:
#audio_embedding = (example.features.feature['audio_embedding'].bytes_list.value[0])
readTfRecordSamples('embeddings/01.tfrecord')
提取 128 维嵌入有什么技巧吗? 还是他们真的不在这个数据集中?
【问题讨论】:
标签: python tensorflow protocol-buffers