修改了随机读取数据的方法,可以提高模型的泛化能力

This commit is contained in:
nl8590687 2018-07-09 17:50:17 +08:00
parent 9d40bb7f24
commit 1188e9d6e7
1 changed files with 4 additions and 2 deletions

View File

@ -193,9 +193,11 @@ class DataSpeech():
label_length = [] label_length = []
ran_num = random.randint(0,self.DataNum - 1) # 获取一个随机数
for i in range(batch_size): for i in range(batch_size):
data_input, data_labels = self.GetData((ran_num + i) % self.DataNum) # 从随机数开始连续向后取一定数量数据 ran_num = random.randint(0,self.DataNum - 1) # 获取一个随机数
data_input, data_labels = self.GetData(ran_num) # 通过随机数取一个数据
#data_input, data_labels = self.GetData((ran_num + i) % self.DataNum) # 从随机数开始连续向后取一定数量数据
input_length.append(data_input.shape[0] // 8 + data_input.shape[0] % 8) input_length.append(data_input.shape[0] // 8 + data_input.shape[0] % 8)
#print(data_input, data_labels) #print(data_input, data_labels)