Skip to content

Commit

Permalink
remove lanms-nova
Browse files Browse the repository at this point in the history
  • Loading branch information
WenmuZhou committed Nov 25, 2021
1 parent 0d85119 commit 35e4718
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions doc/doc_ch/detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,7 @@ Q1: 训练模型转inference 模型之后预测效果不一致?
**A**:此类问题出现较多,问题多是trained model预测时候的预处理、后处理参数和inference model预测的时候的预处理、后处理参数不一致导致的。以det_mv3_db.yml配置文件训练的模型为例,训练模型、inference模型预测结果不一致问题解决方式如下:
- 检查[trained model预处理](https://github.com/PaddlePaddle/PaddleOCR/blob/c1ed243fb68d5d466258243092e56cbae32e2c14/configs/det/det_mv3_db.yml#L116),和[inference model的预测预处理](https://github.com/PaddlePaddle/PaddleOCR/blob/c1ed243fb68d5d466258243092e56cbae32e2c14/tools/infer/predict_det.py#L42)函数是否一致。算法在评估的时候,输入图像大小会影响精度,为了和论文保持一致,训练icdar15配置文件中将图像resize到[736, 1280],但是在inference model预测的时候只有一套默认参数,会考虑到预测速度问题,默认限制图像最长边为960做resize的。训练模型预处理和inference模型的预处理函数位于[ppocr/data/imaug/operators.py](https://github.com/PaddlePaddle/PaddleOCR/blob/c1ed243fb68d5d466258243092e56cbae32e2c14/ppocr/data/imaug/operators.py#L147)
- 检查[trained model后处理](https://github.com/PaddlePaddle/PaddleOCR/blob/c1ed243fb68d5d466258243092e56cbae32e2c14/configs/det/det_mv3_db.yml#L51),和[inference 后处理参数](https://github.com/PaddlePaddle/PaddleOCR/blob/c1ed243fb68d5d466258243092e56cbae32e2c14/tools/infer/utility.py#L50)是否一致。

Q1: 训练EAST模型提示找不到lanms库?

**A**:执行pip3 install lanms-nova 即可。
7 changes: 6 additions & 1 deletion ppocr/postprocess/east_postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from .locality_aware_nms import nms_locality
import cv2
import paddle
import lanms

import os
import sys
Expand Down Expand Up @@ -61,6 +60,12 @@ def detect(self,
"""
restore text boxes from score map and geo map
"""
try:
import lanms
except:
raise Exception(
'you should install lanms by pip3 install lanms-nova')

score_map = score_map[0]
geo_map = np.swapaxes(geo_map, 1, 0)
geo_map = np.swapaxes(geo_map, 1, 2)
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ cython
lxml
premailer
openpyxl
fasttext==0.9.1
lanms-nova
fasttext==0.9.1

0 comments on commit 35e4718

Please sign in to comment.