attention ocr infer.py不能顺利加载模型
Created by: wenston2006
attention ocr 采用train.py训练和保存模型, 运行infer.py时不能顺利加载模型; 控制台打印的信息如下:
/usr/bin/python3.5 /home/liusong/program_install/pycharm-2018.3.4/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 33763 --file /home/liusong/work_proj_2/paddle-models/PaddleCV/ocr_recognition/infer.py --model_path=gpu_model/model_51000 pydev debugger: process 9120 is connecting
Connected to pydev debugger (build 183.5429.31) ----------- Configuration Arguments ----------- batch_size: 1 dict: None input_images_dir: None input_images_list: None iterations: 0 model: crnn_ctc model_path: gpu_model/model_51000 profile: False skip_batch_num: 0 use_gpu: True
W0905 14:58:19.599503 9120 device_context.cc:259] Please NOTE: device: 0, CUDA Capability: 61, Driver API Version: 9.0, Runtime API Version: 9.0 W0905 14:58:19.635993 9120 device_context.cc:267] device: 0, cuDNN Version: 7.3. Traceback (most recent call last): File "/home/liusong/program_install/pycharm-2018.3.4/helpers/pydev/pydevd.py", line 1741, in main() File "/home/liusong/program_install/pycharm-2018.3.4/helpers/pydev/pydevd.py", line 1735, in main globals = debugger.run(setup['file'], None, None, is_module) File "/home/liusong/program_install/pycharm-2018.3.4/helpers/pydev/pydevd.py", line 1135, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/liusong/program_install/pycharm-2018.3.4/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/liusong/work_proj_2/paddle-models/PaddleCV/ocr_recognition/infer.py", line 169, in main() File "/home/liusong/work_proj_2/paddle-models/PaddleCV/ocr_recognition/infer.py", line 165, in main inference(args) File "/home/liusong/work_proj_2/paddle-models/PaddleCV/ocr_recognition/infer.py", line 90, in inference fluid.io.load_params(exe, dirname=model_dir, filename=model_file_name) File "/usr/local/lib/python3.5/dist-packages/paddle/fluid/io.py", line 699, in load_params filename=filename) File "/usr/local/lib/python3.5/dist-packages/paddle/fluid/io.py", line 611, in load_vars filename=filename) File "/usr/local/lib/python3.5/dist-packages/paddle/fluid/io.py", line 648, in load_vars executor.run(load_prog) File "/usr/local/lib/python3.5/dist-packages/paddle/fluid/executor.py", line 651, in run use_program_cache=use_program_cache) File "/usr/local/lib/python3.5/dist-packages/paddle/fluid/executor.py", line 749, in _run exe.run(program.desc, scope, 0, True, True, fetch_var_name) MemoryError: std::bad_alloc