From 70f87eee237931455f4669c41418f0a89d76a54c Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Thu, 19 Nov 2020 14:32:34 +0800 Subject: [PATCH 1/3] fix typo and print --- setup.py | 2 +- tools/infer/predict_det.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 2cea853d..eb6f2d65 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ from setuptools import setup from io import open -with open('requirments.txt', encoding="utf-8-sig") as f: +with open('requirements.txt', encoding="utf-8-sig") as f: requirements = f.readlines() requirements.append('tqdm') diff --git a/tools/infer/predict_det.py b/tools/infer/predict_det.py index 60d67c96..b022bc07 100755 --- a/tools/infer/predict_det.py +++ b/tools/infer/predict_det.py @@ -191,10 +191,12 @@ if __name__ == "__main__": if count > 0: total_time += elapse count += 1 - print("Predict time of %s:" % image_file, elapse) + logger.info("Predict time of %s:" % image_file, elapse) src_im = utility.draw_text_det_res(dt_boxes, image_file) img_name_pure = image_file.split("/")[-1] cv2.imwrite( os.path.join(draw_img_save, "det_res_%s" % img_name_pure), src_im) + logger.info("The visualized img saved in {}".format( + os.path.join(draw_img_save, "det_res_%s" % img_name_pure))) if count > 1: - print("Avg Time:", total_time / (count - 1)) + logger.info("Avg Time:", total_time / (count - 1)) From 06921b135be24ddd2fa2c63162d0393bdc7797be Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Mon, 30 Nov 2020 10:20:22 +0800 Subject: [PATCH 2/3] print to logger.info --- tools/infer/predict_det.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/infer/predict_det.py b/tools/infer/predict_det.py index b022bc07..dabce38e 100755 --- a/tools/infer/predict_det.py +++ b/tools/infer/predict_det.py @@ -191,7 +191,8 @@ if __name__ == "__main__": if count > 0: total_time += elapse count += 1 - logger.info("Predict time of %s:" % image_file, elapse) + logger.info("The predicted time of img: {} is {}:".format(image_file, + elapse)) src_im = utility.draw_text_det_res(dt_boxes, image_file) img_name_pure = image_file.split("/")[-1] cv2.imwrite( From f2c35f55a2a72ff5d1282b0990bb05b6cf9ac1e1 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Mon, 30 Nov 2020 10:28:21 +0800 Subject: [PATCH 3/3] enable_static to export_model --- tools/export_model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/export_model.py b/tools/export_model.py index 0bd06b98..7630a77e 100644 --- a/tools/export_model.py +++ b/tools/export_model.py @@ -15,6 +15,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +from ppocr.utils.utility import enable_static_mode import os import sys @@ -43,7 +44,6 @@ logger = initial_logger() from ppocr.utils.save_load import init_model - def main(): startup_prog, eval_program, place, config, _ = program.preprocess() @@ -72,4 +72,5 @@ def main(): if __name__ == '__main__': + enable_static_mode() main()