Skip to content

Commit

Permalink
fix: 修复一个会在evaluate部分由于音频过长判断时没有跳出导致死循环的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nl8590687 committed Dec 3, 2021
1 parent dbfc3cd commit 84e7834
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions speech_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,11 @@ def evaluate_model(self, data_loader, data_count = -1, out_report = False, show_
data_input = data_input.reshape(data_input.shape[0],data_input.shape[1],1)
# 数据格式出错处理 开始
# 当输入的wav文件长度过长时自动跳过该文件,转而使用下一个wav文件来运行
while data_input.shape[0] > self.speech_model.input_shape[0]:
print('*[Error]','wave data lenghth of num',(ran_num + i) % data_nums, 'is too long.','\n A Exception raise when test Speech Model.')
if data_input.shape[0] > self.speech_model.input_shape[0]:
print('*[Error]','wave data lenghth of num',(ran_num + i) % data_nums, 'is too long.',
'this data\'s length is', data_input.shape[0],
'expect <=', self.speech_model.input_shape[0],
'\n A Exception raise when test Speech Model.')
i += 1
continue
# 数据格式出错处理 结束
Expand Down

0 comments on commit 84e7834

Please sign in to comment.