我正在尝试将数据加载到this tutorial model进行测试。我基本上将标记的音频文件转换为图形文件,以便通过CNN进行分类。但我不确定邮票以及数据如何存储在字典中
广告输入我有一个列表: file1.wav classlabel file2.wav classlabel file3.wav classlabel
加载CNN分类器(遗憾的是我没有要检查的示例.pkl文件):
dataset = pickle.load(open(os.path.join('data', prefix+'.pkl'), 'rb'))
def batch_input_fn(dataset, indices, batch_size=100, seed=None, num_epochs=1):
# Get the data into tensorflow
stamps = np.array( dataset['stamp'] )[indices]
print("stamps.shape:", stamps.shape)
labels = np.array( dataset['label'] )[indices]
print("labels.shape:", labels.shape)
我在这里很困惑,邮票到底代表什么?下面看来它既是阶级又是标签?
def wav_to_stamp(prefix, word, wav):
samples, sample_rate = soundfile.read( os.path.join('data', prefix, word, wav) )
return samples_to_stamp(samples, sample_rate)
for each wav file f that I have:
if not f.endswith('.wav'): continue
#print(stamp_file)
stamp = wav_to_stamp(prefix, word, stamp_file)
# stamps are essentially images here created with stamp = scipy.misc.imresize(data_min0, (64, 32), 'bilinear')
data_dictionary = dict(
stamp=stamps, label=labels,
)
ds_file = os.path.join('data', prefix+save_as)
pickle.dump(data_dictionary, open(ds_file, 'wb'), protocol=pickle.HIGHEST_PROTOCOL)
上面的内容已经过一些修改以适应我的数据(read-in script中没有单词和句子。但我不确定邮票和标签是否合适。我如何正确地将它们存储在data_dictionary中,这样每张邮票都有标签?