mirror of
https://github.com/xiph/opus.git
synced 2025-05-28 14:19:13 +00:00
add convolution
This commit is contained in:
parent
fd9002e98e
commit
f884d7bf18
2 changed files with 12 additions and 5 deletions
|
@ -16,15 +16,22 @@ nb_used_features = 37
|
|||
|
||||
|
||||
def new_wavernn_model():
|
||||
pcm = Input(shape=(None, 2))
|
||||
pcm = Input(shape=(None, 1))
|
||||
pitch = Input(shape=(None, 1))
|
||||
feat = Input(shape=(None, nb_used_features))
|
||||
|
||||
conv1 = Conv1D(16, 7, padding='causal')
|
||||
pconv1 = Conv1D(16, 5, padding='same')
|
||||
pconv2 = Conv1D(16, 5, padding='same')
|
||||
|
||||
cpcm = conv1(pcm)
|
||||
cpitch = pconv2(pconv1(pitch))
|
||||
rep = Lambda(lambda x: K.repeat_elements(x, 160, 1))
|
||||
|
||||
rnn = CuDNNGRU(rnn_units, return_sequences=True)
|
||||
rnn_in = Concatenate()([pcm, rep(feat)])
|
||||
rnn_in = Concatenate()([cpcm, cpitch, rep(feat)])
|
||||
md = MDense(pcm_levels, activation='softmax')
|
||||
ulaw_prob = md(rnn(rnn_in))
|
||||
|
||||
model = Model([pcm, feat], ulaw_prob)
|
||||
model = Model([pcm, pitch, feat], ulaw_prob)
|
||||
return model
|
||||
|
|
|
@ -56,7 +56,7 @@ features = np.reshape(features, (nb_frames, feature_chunk_size, nb_features))
|
|||
features = features[:, :, :nb_used_features]
|
||||
|
||||
|
||||
in_data = np.concatenate([in_data, in_pitch], axis=-1)
|
||||
#in_data = np.concatenate([in_data, in_pitch], axis=-1)
|
||||
|
||||
#with h5py.File('in_data.h5', 'w') as f:
|
||||
# f.create_dataset('data', data=in_data[:50000, :, :])
|
||||
|
@ -66,4 +66,4 @@ checkpoint = ModelCheckpoint('lpcnet1e_{epoch:02d}.h5')
|
|||
|
||||
#model.load_weights('wavernn1c_01.h5')
|
||||
model.compile(optimizer=Adam(0.002, amsgrad=True, decay=2e-4), loss='sparse_categorical_crossentropy', metrics=['sparse_categorical_accuracy'])
|
||||
model.fit([in_data, features], out_data, batch_size=batch_size, epochs=30, validation_split=0.2, callbacks=[checkpoint])
|
||||
model.fit([in_data, in_pitch, features], out_data, batch_size=batch_size, epochs=30, validation_split=0.2, callbacks=[checkpoint])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue