From eed41762b7302cdab090ba0c403a493b70a05043 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Tue, 14 Jul 2020 14:52:12 +0800 Subject: [PATCH 1/2] fix bug det train --- tools/program.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/program.py b/tools/program.py index 6a51e5c37..ff8743f15 100755 --- a/tools/program.py +++ b/tools/program.py @@ -256,15 +256,15 @@ def train_eval_det_run(config, exe, train_info_dict, eval_info_dict): t2 = time.time() train_batch_elapse = t2 - t1 train_stats.update(stats) - if train_batch_id > start_eval_step and (train_batch_id -start_eval_step) \ + if train_batch_id > 0 and train_batch_id \ % print_batch_step == 0: logs = train_stats.log() strs = 'epoch: {}, iter: {}, {}, time: {:.3f}'.format( epoch, train_batch_id, logs, train_batch_elapse) logger.info(strs) - if train_batch_id > 0 and\ - train_batch_id % eval_batch_step == 0: + if train_batch_id > start_eval_step and\ + (train_batch_id - start_eval_step) % eval_batch_step == 0: metrics = eval_det_run(exe, config, eval_info_dict, "eval") hmean = metrics['hmean'] if hmean >= best_eval_hmean: From 52e7dbf77317b99cc909b11a027f6457e75b891e Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Tue, 14 Jul 2020 15:48:43 +0800 Subject: [PATCH 2/2] add continue in det Evalreader when img is not exist --- ppocr/data/det/dataset_traversal.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ppocr/data/det/dataset_traversal.py b/ppocr/data/det/dataset_traversal.py index 5331ec191..737cbe2e9 100644 --- a/ppocr/data/det/dataset_traversal.py +++ b/ppocr/data/det/dataset_traversal.py @@ -96,6 +96,7 @@ class EvalTestReader(object): img = cv2.imread(img_path) if img is None: logger.info("{} does not exist!".format(img_path)) + continue elif len(list(img.shape)) == 2 or img.shape[2] == 1: img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR) outs = process_function(img)