mirror of https://github.com/drowe67/LPCNet.git
...
parent
fdaa047fa5
commit
c8ff029a5a
|
|
@ -10,7 +10,7 @@ import numpy as np
|
|||
import h5py
|
||||
import sys
|
||||
|
||||
rnn_units=512
|
||||
rnn_units=128
|
||||
pcm_bits = 8
|
||||
embed_size = 128
|
||||
pcm_levels = 2**pcm_bits
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ pcmfile = sys.argv[1]
|
|||
feature_file = sys.argv[2]
|
||||
frame_size = 160
|
||||
nb_features = 55
|
||||
nb_used_features = wavenet.nb_used_features
|
||||
nb_used_features = lpcnet.nb_used_features
|
||||
feature_chunk_size = 15
|
||||
pcm_chunk_size = frame_size*feature_chunk_size
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ in_data = np.reshape(in_data, (nb_frames*pcm_chunk_size, 1))
|
|||
out_data = np.reshape(data, (nb_frames*pcm_chunk_size, 1))
|
||||
|
||||
|
||||
model.load_weights('wavenet4b_30.h5')
|
||||
model.load_weights('wavenet4d2_203.h5')
|
||||
|
||||
order = 16
|
||||
|
||||
|
|
@ -92,8 +92,8 @@ for c in range(1, nb_frames):
|
|||
p, state = dec.predict([fexc, iexc, cfeat[:, fr:fr+1, :], state])
|
||||
#p = p*p
|
||||
#p = p/(1e-18 + np.sum(p))
|
||||
p = np.maximum(p-0.001, 0)
|
||||
p = p/(1e-5 + np.sum(p))
|
||||
p = np.maximum(p-0.001, 0).astype('float64')
|
||||
p = p/(1e-8 + np.sum(p))
|
||||
|
||||
iexc[0, 0, 0] = np.argmax(np.random.multinomial(1, p[0,0,:], 1))
|
||||
pcm[f*frame_size + i, 0] = pred + 32768*ulaw2lin(iexc[0, 0, 0]-128)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ pred_file = sys.argv[3]
|
|||
pcm_file = sys.argv[4]
|
||||
frame_size = 160
|
||||
nb_features = 55
|
||||
nb_used_features = wavenet.nb_used_features
|
||||
nb_used_features = lpcnet.nb_used_features
|
||||
feature_chunk_size = 15
|
||||
pcm_chunk_size = frame_size*feature_chunk_size
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ udata = udata[:nb_frames*pcm_chunk_size]
|
|||
features = features[:nb_frames*feature_chunk_size*nb_features]
|
||||
|
||||
in_data = np.concatenate([data[0:1], data[:-1]]);
|
||||
noise = np.concatenate([np.zeros((len(data)*2//5)), np.random.randint(-1, 1, len(data)*3//5)])
|
||||
noise = np.concatenate([np.zeros((len(data)*1//5)), np.random.randint(-3, 3, len(data)*1//5), np.random.randint(-2, 2, len(data)*1//5), np.random.randint(-1, 1, len(data)*2//5)])
|
||||
in_data = in_data + noise
|
||||
in_data = np.maximum(-127, np.minimum(127, in_data))
|
||||
|
||||
|
|
@ -58,8 +58,8 @@ upred = upred[:nb_frames*pcm_chunk_size]
|
|||
pred_in = 32768.*ulaw2lin(in_data)
|
||||
for i in range(2, nb_frames*feature_chunk_size):
|
||||
upred[i*frame_size:(i+1)*frame_size] = 0
|
||||
if i % 100000 == 0:
|
||||
print(i)
|
||||
#if i % 100000 == 0:
|
||||
# print(i)
|
||||
for k in range(16):
|
||||
upred[i*frame_size:(i+1)*frame_size] = upred[i*frame_size:(i+1)*frame_size] - \
|
||||
pred_in[i*frame_size-k:(i+1)*frame_size-k]*features[i, nb_features-16+k]
|
||||
|
|
@ -103,7 +103,7 @@ in_data = np.concatenate([in_data, pred], axis=-1)
|
|||
# f.create_dataset('data', data=in_data[:50000, :, :])
|
||||
# f.create_dataset('feat', data=features[:50000, :, :])
|
||||
|
||||
checkpoint = ModelCheckpoint('wavenet4b_{epoch:02d}.h5')
|
||||
checkpoint = ModelCheckpoint('wavenet4d3_{epoch:02d}.h5')
|
||||
|
||||
#model.load_weights('wavernn1c_01.h5')
|
||||
model.compile(optimizer=Adam(0.001, amsgrad=True, decay=2e-4), loss='sparse_categorical_crossentropy', metrics=['sparse_categorical_accuracy'])
|
||||
|
|
|
|||
Loading…
Reference in New Issue