diff --git a/dnn/train_lpcnet.py b/dnn/train_lpcnet.py index f9bf19a050bd6ac24b1e6eed2cdbaf1f9fac92bc..a927504551ab86eb6cf9bd69d11b75fe759eac8a 100755 --- a/dnn/train_lpcnet.py +++ b/dnn/train_lpcnet.py @@ -86,7 +86,9 @@ 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)*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)]) #noise = np.round(np.concatenate([np.zeros((len(data)*1//5)), np.random.laplace(0, 1.2, len(data)*1//5), np.random.laplace(0, .77, len(data)*1//5), np.random.laplace(0, .33, len(data)*1//5), np.random.randint(-1, 1, len(data)*1//5)])) +del data in_data = in_data + noise +del noise in_data = np.clip(in_data, 0, 255) features = np.reshape(features, (nb_frames*feature_chunk_size, nb_features)) @@ -105,6 +107,7 @@ for i in range(2, nb_frames*feature_chunk_size): 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] +del pred_in pred = lin2ulaw(upred) @@ -116,6 +119,8 @@ in_data = in_data.astype('uint8') # ideal excitation in_exc out_data = lin2ulaw(udata-upred) +del upred +del udata in_exc = np.concatenate([out_data[0:1], out_data[:-1]]); out_data = np.reshape(out_data, (nb_frames, pcm_chunk_size, 1)) @@ -135,6 +140,8 @@ periods = (50*features[:,:,36:37]+100).astype('int16') in_data = np.concatenate([in_data, pred], axis=-1) +del pred + # dump models to disk as we go checkpoint = ModelCheckpoint('lpcnet14_384_10_G16_{epoch:02d}.h5')