diff --git a/doc/doc_ch/detection.md b/doc/doc_ch/detection.md index dead965833ca856cdad11ba3db99f3aa1206acd2..f8ea9a1cae70f23dd912f5217797d86914f7f1f4 100644 --- a/doc/doc_ch/detection.md +++ b/doc/doc_ch/detection.md @@ -81,13 +81,6 @@ python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/ python3 tools/train.py -c configs/det/det_mv3_db.yml -o Optimizer.base_lr=0.0001 ``` -若训练PSE算法,需先编译后处理 - -```bash -cd ppocr/postprocess/pse_postprocess/pse -python3 setup.py build_ext --inplace -``` - #### 断点训练 如果训练程序中断,如果希望加载训练中断的模型从而恢复训练,可以通过指定Global.checkpoints指定要加载的模型路径: diff --git a/doc/doc_en/detection_en.md b/doc/doc_en/detection_en.md index f9cf3d64d04fe679ce85f32ebc9ece0040519f2e..31e24197a9f126f8e59b84886a11375955fca6f0 100644 --- a/doc/doc_en/detection_en.md +++ b/doc/doc_en/detection_en.md @@ -69,12 +69,6 @@ python3 tools/train.py -c configs/det/det_mv3_db.yml -o Optimizer.base_lr=0.0001 python3 -m paddle.distributed.launch --gpus '0,1,2,3' tools/train.py -c configs/det/det_mv3_db.yml -o Optimizer.base_lr=0.0001 ``` -If you train the PSE algorithm, you need to compile the post-processing first. -```bash -cd ppocr/postprocess/pse_postprocess/pse -python3 setup.py build_ext --inplace -``` - #### load trained model and continue training If you expect to load trained model and continue the training again, you can specify the parameter `Global.checkpoints` as the model path to be loaded. diff --git a/ppocr/postprocess/pse_postprocess/pse/__init__.py b/ppocr/postprocess/pse_postprocess/pse/__init__.py index e603ce47a42d8dd13f81db7d6e2a5bad6df2d2b9..a917c705f53972fade7453c1cab15cd5cbcb2b95 100644 --- a/ppocr/postprocess/pse_postprocess/pse/__init__.py +++ b/ppocr/postprocess/pse_postprocess/pse/__init__.py @@ -11,5 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import os +import subprocess + +if subprocess.call('cd ppocr/postprocess/pse_postprocess/pse;python3 setup.py build_ext --inplace;cd -', shell=True) != 0: + raise RuntimeError('Cannot compile pse: {}'.format(os.path.dirname(os.path.realpath(__file__)))) from .pse import pse \ No newline at end of file