From 4eba6c0dce5fa23dee55a0fb9912f99d0088b615 Mon Sep 17 00:00:00 2001 From: WenmuZhou Date: Mon, 9 Nov 2020 13:28:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E4=B8=8D=E5=8F=AF=E7=94=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/eval.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/tools/eval.py b/tools/eval.py index 07181ee7..16cfe532 100755 --- a/tools/eval.py +++ b/tools/eval.py @@ -23,12 +23,8 @@ __dir__ = os.path.dirname(os.path.abspath(__file__)) sys.path.append(__dir__) sys.path.append(os.path.abspath(os.path.join(__dir__, '..'))) -import paddle -# paddle.manual_seed(2) - -from ppocr.utils.logging import get_logger from ppocr.data import build_dataloader -from ppocr.modeling import build_model +from ppocr.modeling.architectures import build_model from ppocr.postprocess import build_post_process from ppocr.metrics import build_metric from ppocr.utils.save_load import init_model @@ -39,8 +35,7 @@ import tools.program as program def main(): global_config = config['Global'] # build dataloader - eval_loader, _ = build_dataloader(config['EVAL'], device, False, - global_config) + valid_dataloader = build_dataloader(config, 'Eval', device, logger) # build post process post_process_class = build_post_process(config['PostProcess'], @@ -63,16 +58,13 @@ def main(): eval_class = build_metric(config['Metric']) # start eval - metirc = program.eval(model, eval_loader, post_process_class, eval_class) + metirc = program.eval(model, valid_dataloader, post_process_class, + eval_class) logger.info('metric eval ***************') for k, v in metirc.items(): logger.info('{}:{}'.format(k, v)) if __name__ == '__main__': - device, config = program.preprocess() - paddle.disable_static(device) - - logger = get_logger() - print_dict(config, logger) + config, device, logger, vdl_writer = program.preprocess() main() -- GitLab