【问题标题】:Keras SimpleRNN - Shape MFCC vectorsKeras SimpleRNN - 形状 MFCC 向量
【发布时间】:2018-03-22 19:03:03
【问题描述】:

我目前正在尝试在 Keras 中实现循环神经网络。数据由 45.000 个集合组成,其中每个条目是 MFCC 向量的集合(长度可变),每个 13 个系数:

spoken = numpy.load('spoken.npy')
print(spoken[0]) # Gives:
example_row = [
[  
       5.67170000e-01  -1.79430000e-01  -7.27360000e+00  -9.59300000e-02
      -9.30140000e-02  -1.62960000e-01   4.11620000e-01   3.00590000e-01
       6.86360000e-02   1.07130000e+00   1.07090000e-01   5.00890000e-01
       7.51750000e-01],
       [.....]
]
print(spoken.shape) # Gives: (45000,0)
print(spoken[0].shape) # Gives (N, 13) --> N amount of MFCC vectors

我很难理解我需要如何重塑这个 Numpy 数组,以便将它提供给 Keras 的 SimpleRNN:

model = Sequential()
model_spoken.add(SimpleRNN(units=10, activation='relu', input_shape=?))
.....

因此,我的问题是我需要如何重塑可变长度 MFCC 向量的集合,以便将其提供给 Keras 的 SimpleRNN 对象?

【问题讨论】:

    标签: python-3.x keras recurrent-neural-network


    【解决方案1】:

    这实际上非常简单,因为 Keras 内置了用于重新格式化数组并填充零以获得静态长度的函数:

    spoken_train = pad_sequences(spoken_train, maxlen=100)
    

    github issue

    【讨论】:

      猜你喜欢
      • 2016-12-31
      • 1970-01-01
      • 2019-09-21
      • 1970-01-01
      • 2018-11-09
      • 2020-04-13
      • 1970-01-01
      • 2023-03-22
      • 2019-05-23
      相关资源
      最近更新 更多