From e68ea88ddc7fa8e5e90e2fb7df0517ef07b65e06 Mon Sep 17 00:00:00 2001 From: dyning Date: Sun, 12 Jul 2020 11:59:11 +0800 Subject: [PATCH] fix cpu memory problem for a short time --- tools/infer/predict_system.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/infer/predict_system.py b/tools/infer/predict_system.py index e96a1934bd..65478b6964 100755 --- a/tools/infer/predict_system.py +++ b/tools/infer/predict_system.py @@ -117,12 +117,16 @@ def main(args): image_file_list = get_image_file_list(args.image_dir) text_sys = TextSystem(args) is_visualize = True + tackle_img_num = 0 for image_file in image_file_list: img = cv2.imread(image_file) if img is None: logger.info("error in loading image:{}".format(image_file)) continue starttime = time.time() + tackle_img_num += 1 + if not args.use_gpu and tackle_img_num % 30 == 0: + text_sys = TextSystem(args) dt_boxes, rec_res = text_sys(img) elapse = time.time() - starttime print("Predict time of %s: %.3fs" % (image_file, elapse))