flask8 examine

This commit is contained in:
blessyyyu 2022-03-23 18:41:03 +08:00
parent 07b7beabad
commit 255eec296a
2 changed files with 3 additions and 4 deletions

View File

@ -23,7 +23,7 @@ def load_label_and_score(keyword, label_file, score_file):
for line in fin: for line in fin:
arr = line.strip().split() arr = line.strip().split()
key = arr[0] key = arr[0]
str_list = arr[1: ] str_list = arr[1:]
scores = list(map(float, str_list)) scores = list(map(float, str_list))
score_table[key].append(scores) score_table[key].append(scores)
keyword_table = {} keyword_table = {}
@ -93,4 +93,3 @@ if __name__ == '__main__':
false_alarm_per_hour, false_alarm_per_hour,
false_reject_rate)) false_reject_rate))
threshold += args.step threshold += args.step

View File

@ -57,7 +57,7 @@ def get_args():
help='prefetch number') help='prefetch number')
parser.add_argument('--score_file', parser.add_argument('--score_file',
required=True, required=True,
help='output score file') help='output score file')
parser.add_argument('--jit_model', parser.add_argument('--jit_model',
action='store_true', action='store_true',
default=False, default=False,
@ -117,7 +117,7 @@ def main():
score = logits[i][:lengths[i]] score = logits[i][:lengths[i]]
for keyword_i in range(num_keywords): for keyword_i in range(num_keywords):
keyword_scores = score[:, keyword_i] keyword_scores = score[:, keyword_i]
score_frames = ' '.join(['{:.6f}'.format(x) score_frames = ' '.join(['{:.6f}'.format(x)
for x in keyword_scores.tolist()]) for x in keyword_scores.tolist()])
fout.write('{} {}\n'.format(key, score_frames)) fout.write('{} {}\n'.format(key, score_frames))
if batch_idx % 10 == 0: if batch_idx % 10 == 0: