update readme

This commit is contained in:
tink2123 2020-05-14 13:49:28 +08:00
parent 4e1b206ab3
commit 576cbfa78e
3 changed files with 9 additions and 6 deletions

View File

@ -37,10 +37,10 @@ tar -xf inference.tar
export PYTHONPATH=.
# 预测image_dir指定的单张图像
python tools/infer/predict_system.py --image_dir="/Demo.jpg" --det_model_dir="./inference/det/" --rec_model_dir="./inference/rec/"
python3 tools/infer/predict_system.py --image_dir="./demo.jpg" --det_model_dir="./inference/det/" --rec_model_dir="./inference/rec/"
# 预测image_dir指定的图像集合
python tools/infer/predict_system.py --image_dir="/test_imgs/" --det_model_dir="./inference/det/" --rec_model_dir="./inference/rec/"
python3 tools/infer/predict_system.py --image_dir="./infer_imgs/" --det_model_dir="./inference/det/" --rec_model_dir="./inference/rec/"
```
更多的文本检测、识别串联推理使用方式请参考文档教程中[基于推理引擎预测](./doc/inference.md)。

View File

@ -46,9 +46,11 @@ class DBPostProcess(object):
bitmap = _bitmap
height, width = bitmap.shape
# img, contours, _ = cv2.findContours((bitmap * 255).astype(np.uint8), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
contours, _ = cv2.findContours((bitmap * 255).astype(np.uint8),
cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
outs = cv2.findContours((bitmap * 255).astype(np.uint8), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
if len(outs) == 3:
img, contours, _ = outs[0], outs[1], outs[2]
elif len(outs) == 2:
contours, _ = outs[0], outs[1]
num_contours = min(len(contours), self.max_candidates)
boxes = np.zeros((num_contours, 4, 2), dtype=np.int16)

View File

@ -84,7 +84,7 @@ def sorted_boxes(dt_boxes):
"""
Sort text boxes in order from top to bottom, left to right
args:
dt_boxes(array)detected text boxes with shape [4, 2]
dt_boxes(array):detected text boxes with shape [4, 2]
return:
sorted boxes(array) with shape [4, 2]
"""
@ -108,6 +108,7 @@ if __name__ == "__main__":
is_visualize = True
for image_file in image_file_list:
img = cv2.imread(image_file)
print(img.shape)
if img is None:
logger.info("error in loading image:{}".format(image_file))
continue