提交 576cbfa7 编写于 作者: T tink2123

update readme

上级 4e1b206a
...@@ -37,10 +37,10 @@ tar -xf inference.tar ...@@ -37,10 +37,10 @@ tar -xf inference.tar
export PYTHONPATH=. export PYTHONPATH=.
# 预测image_dir指定的单张图像 # 预测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指定的图像集合 # 预测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) 更多的文本检测、识别串联推理使用方式请参考文档教程中[基于推理引擎预测](./doc/inference.md)
......
...@@ -46,9 +46,11 @@ class DBPostProcess(object): ...@@ -46,9 +46,11 @@ class DBPostProcess(object):
bitmap = _bitmap bitmap = _bitmap
height, width = bitmap.shape height, width = bitmap.shape
# img, 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)
contours, _ = cv2.findContours((bitmap * 255).astype(np.uint8), if len(outs) == 3:
cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) 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) num_contours = min(len(contours), self.max_candidates)
boxes = np.zeros((num_contours, 4, 2), dtype=np.int16) boxes = np.zeros((num_contours, 4, 2), dtype=np.int16)
......
...@@ -84,7 +84,7 @@ def sorted_boxes(dt_boxes): ...@@ -84,7 +84,7 @@ def sorted_boxes(dt_boxes):
""" """
Sort text boxes in order from top to bottom, left to right Sort text boxes in order from top to bottom, left to right
args: args:
dt_boxes(array)detected text boxes with shape [4, 2] dt_boxes(array):detected text boxes with shape [4, 2]
return: return:
sorted boxes(array) with shape [4, 2] sorted boxes(array) with shape [4, 2]
""" """
...@@ -108,6 +108,7 @@ if __name__ == "__main__": ...@@ -108,6 +108,7 @@ if __name__ == "__main__":
is_visualize = True is_visualize = True
for image_file in image_file_list: for image_file in image_file_list:
img = cv2.imread(image_file) img = cv2.imread(image_file)
print(img.shape)
if img is None: if img is None:
logger.info("error in loading image:{}".format(image_file)) logger.info("error in loading image:{}".format(image_file))
continue continue
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册