ref: 8f6e490ba20b0c0dbf1e81cc2d52a7c8ecf5daca
parent: 8a276fb44a56a362e27336be0a69064c3747401b
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Wed Aug 22 19:32:36 EDT 2018
clean excitation
--- a/dnn/test_wavenet_audio.py
+++ b/dnn/test_wavenet_audio.py
@@ -66,7 +66,7 @@
out_data = np.reshape(data, (nb_frames*pcm_chunk_size, 1))
-model.load_weights('wavenet4a1_13.h5')+model.load_weights('wavenet4a3_30.h5')order = 16
--- a/dnn/train_wavenet_audio.py
+++ b/dnn/train_wavenet_audio.py
@@ -35,17 +35,18 @@
feature_chunk_size = 15
pcm_chunk_size = frame_size*feature_chunk_size
-data = np.fromfile(pcm_file, dtype='int16')
-data = np.minimum(127, lin2ulaw(data/32768.))
+udata = np.fromfile(pcm_file, dtype='int16')
+data = np.minimum(127, lin2ulaw(udata/32768.))
nb_frames = len(data)//pcm_chunk_size
features = np.fromfile(feature_file, dtype='float32')
data = data[:nb_frames*pcm_chunk_size]
+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)//3)), np.random.randint(-2, 2, len(data)//3), np.random.randint(-1, 1, len(data)//3)])
+noise = np.concatenate([np.zeros((len(data)*2//5)), np.random.randint(-2, 2, len(data)//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))
@@ -77,7 +78,7 @@
in_data = np.reshape(in_data, (nb_frames, pcm_chunk_size, 1))
in_data = (in_data.astype('int16')+128).astype('uint8')-out_data = np.reshape(lin2ulaw((32768*ulaw2lin(data)-upred)/32768), (nb_frames, pcm_chunk_size, 1))
+out_data = np.reshape(lin2ulaw((udata-upred)/32768), (nb_frames, pcm_chunk_size, 1))
out_data = np.maximum(-127, np.minimum(127, out_data))
out_data = (out_data.astype('int16')+128).astype('uint8')features = np.reshape(features, (nb_frames, feature_chunk_size, nb_features))
@@ -93,7 +94,7 @@
# f.create_dataset('data', data=in_data[:50000, :, :]) # f.create_dataset('feat', data=features[:50000, :, :])-checkpoint = ModelCheckpoint('wavenet4a1_{epoch:02d}.h5')+checkpoint = ModelCheckpoint('wavenet4a3_{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'])
--
⑨