Merge pull request #96 from LDOUBLEV/fixocr

Fixocr
This commit is contained in:
Double_V 2020-05-25 20:55:00 +08:00 committed by GitHub
commit 10ac172291
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 3 deletions

View File

@ -117,7 +117,6 @@ if __name__ == "__main__":
valid_image_file_list.append(image_file) valid_image_file_list.append(image_file)
img_list.append(img) img_list.append(img)
rec_res, predict_time = text_recognizer(img_list) rec_res, predict_time = text_recognizer(img_list)
rec_res, predict_time = text_recognizer(img_list)
for ino in range(len(img_list)): for ino in range(len(img_list)):
print("Predicts of %s:%s" % (valid_image_file_list[ino], rec_res[ino])) print("Predicts of %s:%s" % (valid_image_file_list[ino], rec_res[ino]))
print("Total predict time for %d images:%.3f" % print("Total predict time for %d images:%.3f" %

View File

@ -174,8 +174,7 @@ def draw_ocr(image, boxes, txts, scores, draw_txt=True, drop_score=0.5):
continue continue
font = ImageFont.truetype( font = ImageFont.truetype(
"./doc/simfang.ttf", font_size, encoding="utf-8") "./doc/simfang.ttf", font_size, encoding="utf-8")
new_txt = str(count) + ': ' + txt + ' ' + '%.3f' % ( new_txt = str(idx) + ': ' + txt + ' ' + '%.3f' % (scores[idx])
scores[count])
draw_txt.text( draw_txt.text(
(20, gap * (count + 1)), new_txt, txt_color, font=font) (20, gap * (count + 1)), new_txt, txt_color, font=font)
count += 1 count += 1