Fix flooring of the pitch period

Without the 0.1 bias, the rounding error could cause an offset of -1
This commit is contained in:
Jean-Marc Valin 2018-12-10 11:23:31 -05:00
parent d533e4024d
commit b9e0ea23e0
3 changed files with 4 additions and 4 deletions

View file

@ -136,14 +136,14 @@ features[:,:,18:36] = 0
pred = np.reshape(pred, (nb_frames, pcm_chunk_size, 1))
pred = pred.astype('uint8')
periods = (50*features[:,:,36:37]+100).astype('int16')
periods = (.1 + 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')
checkpoint = ModelCheckpoint('lpcnet15_384_10_G16_{epoch:02d}.h5')
#model.load_weights('lpcnet9b_384_10_G16_01.h5')
model.compile(optimizer=Adam(0.001, amsgrad=True, decay=5e-5), loss='sparse_categorical_crossentropy', metrics=['sparse_categorical_accuracy'])