diff --git a/deploy/cpp_infer/readme.md b/deploy/cpp_infer/readme.md index b563ecf48c2aba03e25a03ae0328c244bb900356..f81d9c75e93808b81f0659ccf46b629091b2c9fb 100644 --- a/deploy/cpp_infer/readme.md +++ b/deploy/cpp_infer/readme.md @@ -1,6 +1,8 @@ # 服务器端C++预测 -本教程将介绍在服务器端部署PaddleOCR超轻量中文检测、识别模型的详细步骤。 +本章节介绍PaddleOCR 模型的的C++部署方法,与之对应的python预测部署方式参考[文档](../../doc/doc_ch/inference.md)。 +C++在性能计算上优于python,因此,在大多数CPU、GPU部署场景,多采用C++的部署方式,本节将介绍如何在Linux\Windows (CPU\GPU)环境下配置C++环境并完成 +PaddleOCR模型部署。 ## 1. 准备环境 diff --git a/deploy/cpp_infer/readme_en.md b/deploy/cpp_infer/readme_en.md index 41c764bc18a69965da6ad2ea521f438840c286e6..8a0bd62ecc6bf617c6e2954d1080bf97a6582acd 100644 --- a/deploy/cpp_infer/readme_en.md +++ b/deploy/cpp_infer/readme_en.md @@ -1,7 +1,9 @@ # Server-side C++ inference - -In this tutorial, we will introduce the detailed steps of deploying PaddleOCR ultra-lightweight Chinese detection and recognition models on the server side. +This chapter introduces the C++ deployment method of the PaddleOCR model, and the corresponding python predictive deployment method refers to [document](../../doc/doc_ch/inference.md). +C++ is better than python in terms of performance calculation. Therefore, in most CPU and GPU deployment scenarios, C++ deployment is mostly used. +This section will introduce how to configure the C++ environment and complete it in the Linux\Windows (CPU\GPU) environment +PaddleOCR model deployment. ## 1. Prepare the environment diff --git a/doc/doc_ch/inference.md b/doc/doc_ch/inference.md index f0a8983c4ba7d2413ed8b6dbced79eecced85140..7968b355ea936d465b3c173c0fcdb3e08f12f16e 100755 --- a/doc/doc_ch/inference.md +++ b/doc/doc_ch/inference.md @@ -2,10 +2,11 @@ # 基于Python预测引擎推理 inference 模型(`paddle.jit.save`保存的模型) -一般是模型训练完成后保存的固化模型,多用于预测部署。训练过程中保存的模型是checkpoints模型,保存的是模型的参数,多用于恢复训练等。 -与checkpoints模型相比,inference 模型会额外保存模型的结构信息,在预测部署、加速推理上性能优越,灵活方便,适合与实际系统集成。 +一般是模型训练,把模型结构和模型参数保存在文件中的固化模型,多用于预测部署场景。 +训练过程中保存的模型是checkpoints模型,保存的只有模型的参数,多用于恢复训练等。 +与checkpoints模型相比,inference 模型会额外保存模型的结构信息,在预测部署、加速推理上性能优越,灵活方便,适合于实际系统集成。 -接下来首先介绍如何将训练的模型转换成inference模型,然后将依次介绍文本检测、文本角度分类器、文本识别以及三者串联基于预测引擎推理。 +接下来首先介绍如何将训练的模型转换成inference模型,然后将依次介绍文本检测、文本角度分类器、文本识别以及三者串联在CPU、GPU上的预测方法。 - [一、训练模型转inference模型](#训练模型转inference模型) diff --git a/doc/doc_ch/installation.md b/doc/doc_ch/installation.md index fce151eb9fee567477c09eee211633f7377dddb3..7e7523b999aa6fdee9bbaa4fb388655e01c28c16 100644 --- a/doc/doc_ch/installation.md +++ b/doc/doc_ch/installation.md @@ -30,7 +30,7 @@ sudo nvidia-docker run --name ppocr -v $PWD:/paddle --shm-size=64G --network=hos sudo docker container exec -it ppocr /bin/bash ``` -**2. 安装PaddlePaddle Fluid v2.0** +**2. 安装PaddlePaddle 2.0** ``` pip3 install --upgrade pip diff --git a/doc/doc_en/inference_en.md b/doc/doc_en/inference_en.md index 6b745619c968f50e063ee78bd23c0a73f14f4511..aa3e0536cb6a4cb73f0388293ce72183c62e87a1 100755 --- a/doc/doc_en/inference_en.md +++ b/doc/doc_en/inference_en.md @@ -5,7 +5,8 @@ The inference model (the model saved by `paddle.jit.save`) is generally a solidi The model saved during the training process is the checkpoints model, which saves the parameters of the model and is mostly used to resume training. -Compared with the checkpoints model, the inference model will additionally save the structural information of the model. It has superior performance in predicting in deployment and accelerating inferencing, is flexible and convenient, and is suitable for integration with actual systems. For more details, please refer to the document [Classification Framework](https://github.com/PaddlePaddle/PaddleClas/blob/master/docs/zh_CN/extension/paddle_inference.md). +Compared with the checkpoints model, the inference model will additionally save the structural information of the model. Therefore, it is easier to deploy because the model structure and model parameters are already solidified in the inference model file, and is suitable for integration with actual systems. +For more details, please refer to the document [Classification Framework](https://github.com/PaddlePaddle/PaddleClas/blob/release%2F2.0/docs/zh_CN/extension/paddle_mobile_inference.md). Next, we first introduce how to convert a trained model into an inference model, and then we will introduce text detection, text recognition, angle class, and the concatenation of them based on inference model. diff --git a/doc/doc_en/installation_en.md b/doc/doc_en/installation_en.md index 35c1881d12087e6509a68b504729d9ef20240e9c..dec384b2f27f8bb36ee67d8b040b532b30e0b028 100644 --- a/doc/doc_en/installation_en.md +++ b/doc/doc_en/installation_en.md @@ -33,7 +33,7 @@ You can also visit [DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags sudo docker container exec -it ppocr /bin/bash ``` -**2. Install PaddlePaddle Fluid v2.0** +**2. Install PaddlePaddle 2.0** ``` pip3 install --upgrade pip diff --git a/tools/infer/utility.py b/tools/infer/utility.py index 4171a29bdd4194813638b72f0aae015da48fbcb1..a4a91efdd2ec04e2a2959c77a444549ad413c13d 100755 --- a/tools/infer/utility.py +++ b/tools/infer/utility.py @@ -47,6 +47,7 @@ def parse_args(): parser.add_argument("--det_db_box_thresh", type=float, default=0.5) parser.add_argument("--det_db_unclip_ratio", type=float, default=1.6) parser.add_argument("--max_batch_size", type=int, default=10) + parser.add_argument("--use_dilation", type=bool, default=False) # EAST parmas parser.add_argument("--det_east_score_thresh", type=float, default=0.8) parser.add_argument("--det_east_cover_thresh", type=float, default=0.1) @@ -123,6 +124,8 @@ def create_predictor(args, mode, logger): # cache 10 different shapes for mkldnn to avoid memory leak config.set_mkldnn_cache_capacity(10) config.enable_mkldnn() + # TODO LDOUBLEV: fix mkldnn bug when bach_size > 1 + #config.set_mkldnn_op({'conv2d', 'depthwise_conv2d', 'pool2d', 'batch_norm'}) args.rec_batch_num = 1 # config.enable_memory_optim() diff --git a/tools/program.py b/tools/program.py index 6277d7475868912ad86e1475c2ea6ac930cd6297..ae6491768ceff0379c917c45fd29b30514eba9c1 100755 --- a/tools/program.py +++ b/tools/program.py @@ -394,6 +394,7 @@ def preprocess(is_train=False): logger = get_logger(name='root', log_file=log_file) if config['Global']['use_visualdl']: from visualdl import LogWriter + save_model_dir = config['Global']['save_model_dir'] vdl_writer_path = '{}/vdl/'.format(save_model_dir) os.makedirs(vdl_writer_path, exist_ok=True) vdl_writer = LogWriter(logdir=vdl_writer_path) diff --git a/train.sh b/train.sh index 8fe861a3d79d38929fc4a4f4464187f77d27ff2f..4225470cb9f545b874e5f806af22405895e8f6c7 100644 --- a/train.sh +++ b/train.sh @@ -1,2 +1,2 @@ # recommended paddle.__version__ == 2.0.0 -python3 -m paddle.distributed.launch --gpus '0,1,2,3,4,5,6,7' tools/train.py -c configs/rec/rec_mv3_none_bilstm_ctc.yml +python3 -m paddle.distributed.launch --log_dir=./debug/ --gpus '0,1,2,3,4,5,6,7' tools/train.py -c configs/rec/rec_mv3_none_bilstm_ctc.yml