提交 93fecc89 编写于 作者: Z zhxfl

fix by review

上级 ec4fb544
...@@ -61,9 +61,9 @@ class SampleInfoBucket(object): ...@@ -61,9 +61,9 @@ class SampleInfoBucket(object):
label_bin_paths (list|tuple): Files containing the binary label data. label_bin_paths (list|tuple): Files containing the binary label data.
label_desc_paths (list|tuple): Files containing the description of label_desc_paths (list|tuple): Files containing the description of
samples' label data. samples' label data.
split_perturb(int): split long sentence' perturb sub-sentence length value. split_perturb(int): Random perturb sub-sentence length when split long sentence.
split_sentence_threshold(int): sentence length large than split_sentence_threshold(int): Sentence whose length larger than
split_sentence_threshold trigger split operator. the value will trigger split operation.
split_sub_sentence_len(int): sub-sentence length is equal to split_sub_sentence_len(int): sub-sentence length is equal to
(split_sub_sentence_len + rand() % split_perturb). (split_sub_sentence_len + rand() % split_perturb).
""" """
...@@ -133,8 +133,8 @@ class SampleInfoBucket(object): ...@@ -133,8 +133,8 @@ class SampleInfoBucket(object):
remain_frame_num = feature_frame_num remain_frame_num = feature_frame_num
while True: while True:
if remain_frame_num > self._split_sentence_threshold: if remain_frame_num > self._split_sentence_threshold:
cur_frame_len = self._split_sub_sentence_len + random.randint( cur_frame_len = self._split_sub_sentence_len + \
0, self._split_perturb) self._rng.randint(0, self._split_perturb)
if cur_frame_len > remain_frame_num: if cur_frame_len > remain_frame_num:
cur_frame_len = remain_frame_num cur_frame_len = remain_frame_num
else: else:
...@@ -291,11 +291,12 @@ class DataReader(object): ...@@ -291,11 +291,12 @@ class DataReader(object):
sample_info.feature_start, sample_info.feature_start,
sample_info.feature_size) sample_info.feature_size)
assert sample_info.feature_frame_num * sample_info.feature_dim * 4 == len( assert sample_info.feature_frame_num * sample_info.feature_dim * 4 \
feature_bytes), (sample_info.feature_bin_path, == len(feature_bytes), \
sample_info.feature_frame_num, (sample_info.feature_bin_path,
sample_info.feature_dim, sample_info.feature_frame_num,
len(feature_bytes)) sample_info.feature_dim,
len(feature_bytes))
label_bytes = read_bytes(sample_info.label_bin_path, label_bytes = read_bytes(sample_info.label_bin_path,
sample_info.label_start, sample_info.label_start,
...@@ -329,8 +330,8 @@ class DataReader(object): ...@@ -329,8 +330,8 @@ class DataReader(object):
time.sleep(0.001) time.sleep(0.001)
# drop long sentence # drop long sentence
if self._drop_frame_len == -1 or self._drop_frame_len >= sample_data[ if self._drop_frame_len == -1 or \
0].shape[0]: self._drop_frame_len >= sample_data[0].shape[0]:
sample_queue.put(sample_data) sample_queue.put(sample_data)
out_order[0] += 1 out_order[0] += 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册