Skip to content

Commit

Permalink
更新拼音参数和几条文件路径,声学模型文件跟之前版本不再兼容,需要重新训练
Browse files Browse the repository at this point in the history
  • Loading branch information
nl8590687 committed Mar 29, 2019
1 parent 07c9b36 commit 6579229
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions SpeechModel24.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class ModelSpeech(): # 语音模型类
def __init__(self, datapath):
'''
初始化
默认输出的拼音的表示大小是1422,即1421个拼音+1个空白块
默认输出的拼音的表示大小是1424,即1423个拼音+1个空白块
'''
MS_OUTPUT_SIZE = 1422
MS_OUTPUT_SIZE = 1424
self.MS_OUTPUT_SIZE = MS_OUTPUT_SIZE # 神经网络最终输出的每一个字符向量维度的大小
#self.BATCH_SIZE = BATCH_SIZE # 一次训练的batch
self.label_max_string_length = 64
Expand Down
4 changes: 2 additions & 2 deletions SpeechModel25.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class ModelSpeech(): # 语音模型类
def __init__(self, datapath):
'''
初始化
默认输出的拼音的表示大小是1422,即1421个拼音+1个空白块
默认输出的拼音的表示大小是1424,即1423个拼音+1个空白块
'''
MS_OUTPUT_SIZE = 1422
MS_OUTPUT_SIZE = 1424
self.MS_OUTPUT_SIZE = MS_OUTPUT_SIZE # 神经网络最终输出的每一个字符向量维度的大小
#self.BATCH_SIZE = BATCH_SIZE # 一次训练的batch
self.label_max_string_length = 64
Expand Down
4 changes: 2 additions & 2 deletions SpeechModel251.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class ModelSpeech(): # 语音模型类
def __init__(self, datapath):
'''
初始化
默认输出的拼音的表示大小是1422,即1421个拼音+1个空白块
默认输出的拼音的表示大小是1424,即1423个拼音+1个空白块
'''
MS_OUTPUT_SIZE = 1422
MS_OUTPUT_SIZE = 1424
self.MS_OUTPUT_SIZE = MS_OUTPUT_SIZE # 神经网络最终输出的每一个字符向量维度的大小
#self.BATCH_SIZE = BATCH_SIZE # 一次训练的batch
self.label_max_string_length = 64
Expand Down
4 changes: 2 additions & 2 deletions SpeechModel251_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class ModelSpeech(): # 语音模型类
def __init__(self, datapath):
'''
初始化
默认输出的拼音的表示大小是1422,即1421个拼音+1个空白块
默认输出的拼音的表示大小是1424,即1423个拼音+1个空白块
'''
MS_OUTPUT_SIZE = 1422
MS_OUTPUT_SIZE = 1424
self.MS_OUTPUT_SIZE = MS_OUTPUT_SIZE # 神经网络最终输出的每一个字符向量维度的大小
#self.BATCH_SIZE = BATCH_SIZE # 一次训练的batch
self.label_max_string_length = 64
Expand Down
4 changes: 2 additions & 2 deletions SpeechModel26.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class ModelSpeech(): # 语音模型类
def __init__(self, datapath):
'''
初始化
默认输出的拼音的表示大小是1422,即1421个拼音+1个空白块
默认输出的拼音的表示大小是1424,即1423个拼音+1个空白块
'''
MS_OUTPUT_SIZE = 1422
MS_OUTPUT_SIZE = 1424
self.MS_OUTPUT_SIZE = MS_OUTPUT_SIZE # 神经网络最终输出的每一个字符向量维度的大小
#self.BATCH_SIZE = BATCH_SIZE # 一次训练的batch
self.label_max_string_length = 64
Expand Down
14 changes: 7 additions & 7 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
import platform as plat

from SpeechModel251 import ModelSpeech
from LanguageModel import ModelLanguage
from LanguageModel2 import ModelLanguage
from keras import backend as K

datapath = ''
modelpath = 'model_speech'

system_type = plat.system() # 由于不同的系统的文件路径表示不一样,需要进行判断
if(system_type == 'Windows'):
datapath = 'E:\\语音数据集'
datapath = 'D:\\语音数据集'
modelpath = modelpath + '\\'
elif(system_type == 'Linux'):
datapath = 'dataset'
Expand All @@ -29,14 +29,14 @@
ms = ModelSpeech(datapath)

#ms.LoadModel(modelpath + 'm22_2\\0\\speech_model22_e_0_step_257000.model')
ms.LoadModel(modelpath + 'm251\\speech_model251_e_0_step_117000.model')
ms.LoadModel(modelpath + 'm251\\speech_model251_e_0_step_12000.model')

#ms.TestModel(datapath, str_dataset='test', data_count = 64, out_report = True)
r = ms.RecognizeSpeech_FromFile('D:\\语音数据集\\ST-CMDS-20170001_1-OS\\20170001P00241I0052.wav')
#r = ms.RecognizeSpeech_FromFile('E:\语音数据集\ST-CMDS-20170001_1-OS\\20170001P00241I0053.wav')
#r = ms.RecognizeSpeech_FromFile('E:\\语音数据集\\ST-CMDS-20170001_1-OS\\20170001P00020I0087.wav')
#r = ms.RecognizeSpeech_FromFile('E:\\语音数据集\\wav\\train\\A11\\A11_167.WAV')
#r = ms.RecognizeSpeech_FromFile('E:\\语音数据集\\wav\\test\\D4\\D4_750.wav')
#r = ms.RecognizeSpeech_FromFile('D:\语音数据集\ST-CMDS-20170001_1-OS\\20170001P00241I0053.wav')
#r = ms.RecognizeSpeech_FromFile('D:\\语音数据集\\ST-CMDS-20170001_1-OS\\20170001P00020I0087.wav')
#r = ms.RecognizeSpeech_FromFile('D:\\语音数据集\\data_thchs30\\data\\A11_167.WAV')
#r = ms.RecognizeSpeech_FromFile('D:\\语音数据集\\data_thchs30\\data\\D4_750.wav')

K.clear_session()

Expand Down

0 comments on commit 6579229

Please sign in to comment.