Skip to content

📄 Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

Add unit testing about fixed issue #170

SWHLe4b66000b024
diff --git a/README.md b/README.md
index 4861d83..84815f1 100755
--- a/README.md
+++ b/README.md
@@ -30,24 +30,6 @@
[简体中文](./docs/README_zh.md) | English
</div>
-<details>
- <summary>Contents</summary>
-
-- [Introduction](#introduction)
-- [Demo](#demo)
-- [Installation](#installation)
-- [Usage](#usage)
-- [Related projects overview](#related-projects-overview)
-- [Documentation](#documentation)
-- [Acknowledgements](#acknowledgements)
-- [Code Contributors](#code-contributors)
-- [Contributing](#contributing)
-- [Sponsor](#sponsor)
-- [Citation](#citation)
-- [Stargazers over time](#stargazers-over-time)
-- [License](#license)
-
-</details>
### Introduction
- The fastest running, most widely supported, completely open source and free multi-platform, multi-language OCR known to support rapid offline deployment.
@@ -77,7 +59,7 @@ rapidocr_onnxruntime -img 1.jpg
```
### Related projects overview
-> In the table below, except for the **Evaluation Collection** part which is hosted under the [ModelScope](https://www.modelscope.cn/home) Community, the rest are all under Github. The details are as follows:
+> In the table below, except for the **Evaluation Collection** part which is hosted under the [Hugging Face](https://huggingface.co/SWHL) Community, the rest are all under Github. The details are as follows:
>
> The first line is the function introduction.
>
diff --git a/docs/README_zh.md b/docs/README_zh.md
index 3c56b20..7b6b6c6 100644
--- a/docs/README_zh.md
+++ b/docs/README_zh.md
@@ -30,24 +30,6 @@
</div>
-<details>
- <summary>目录</summary>
-
-- [简介](#简介)
-- [Demo](#demo)
-- [安装](#安装)
-- [使用](#使用)
-- [相关产品概览图](#相关产品概览图)
-- [文档](#文档)
-- [致谢](#致谢)
-- [贡献者](#贡献者)
-- [贡献指南](#贡献指南)
-- [加入我们](#加入我们)
-- [赞助](#赞助)
-- [引用](#引用)
-- [Star history](#star-history)
-- [开源许可证](#开源许可证)
-</details>
### 简介
- 💖目前已知**运行速度最快、支持最广**,完全开源免费并支持离线快速部署的多平台多语言OCR。
@@ -77,7 +59,7 @@ rapidocr_onnxruntime -img 1.jpg
### 相关产品概览图
-> 下图表格中,除**测评集**部分托管在[魔搭社区](https://www.modelscope.cn/home)下,其余均在Github下,详细介绍如下:
+> 下图表格中,除**测评集**部分托管在[Hugging Face](https://huggingface.co/SWHL)下,其余均在Github下,详细介绍如下:
>
> 第一行是功能介绍
>
diff --git a/python/rapidocr_onnxruntime/utils.py b/python/rapidocr_onnxruntime/utils.py
index 66800af..a3b3870 100644
--- a/python/rapidocr_onnxruntime/utils.py
+++ b/python/rapidocr_onnxruntime/utils.py
@@ -162,8 +162,7 @@ class LoadImage:
if img.mode == "1":
img = img.convert("L")
return np.array(img)
- else:
- return np.array(img)
+ return np.array(img)
def convert_img(self, img: np.ndarray, origin_img_type):
if img.ndim == 2:
diff --git a/python/rapidocr_openvino/utils.py b/python/rapidocr_openvino/utils.py
index bb73a7a..22b5637 100644
--- a/python/rapidocr_openvino/utils.py
+++ b/python/rapidocr_openvino/utils.py
@@ -89,8 +89,7 @@ class LoadImage:
if img.mode == "1":
img = img.convert("L")
return np.array(img)
- else:
- return np.array(img)
+ return np.array(img)
def convert_img(self, img: np.ndarray, origin_img_type):
if img.ndim == 2:
diff --git a/python/rapidocr_paddle/utils.py b/python/rapidocr_paddle/utils.py
index 7f54f56..b8135be 100644
--- a/python/rapidocr_paddle/utils.py
+++ b/python/rapidocr_paddle/utils.py
@@ -171,8 +171,7 @@ class LoadImage:
if img.mode == "1":
img = img.convert("L")
return np.array(img)
- else:
- return np.array(img)
+ return np.array(img)
def convert_img(self, img: np.ndarray, origin_img_type):
if img.ndim == 2:
diff --git a/python/tests/test_files/issue_170.png b/python/tests/test_files/issue_170.png
new file mode 100644
index 0000000..b32140e
Binary files /dev/null and b/python/tests/test_files/issue_170.png differ
diff --git a/python/tests/test_ort.py b/python/tests/test_ort.py
index 45e8971..e943d19 100644
--- a/python/tests/test_ort.py
+++ b/python/tests/test_ort.py
@@ -20,6 +20,12 @@ img_path = tests_dir / "ch_en_num.jpg"
package_name = "rapidocr_onnxruntime"
+def test_mode_one_img():
+ img_path = tests_dir / "issue_170.png"
+ result, _ = engine(img_path)
+ assert result[0][1] == "TEST"
+
+
@pytest.mark.parametrize(
"img_name,gt",
[
diff --git a/python/tests/test_paddle.py b/python/tests/test_paddle.py
index 91edb99..4be8ba3 100644
--- a/python/tests/test_paddle.py
+++ b/python/tests/test_paddle.py
@@ -20,6 +20,12 @@ img_path = tests_dir / "ch_en_num.jpg"
package_name = "rapidocr_paddle"
+def test_mode_one_img():
+ img_path = tests_dir / "issue_170.png"
+ result, _ = engine(img_path)
+ assert result[0][1] == "TEST"
+
+
@pytest.mark.parametrize(
"img_name,gt",
[
diff --git a/python/tests/test_vino.py b/python/tests/test_vino.py
index 113f17d..11b9f42 100644
--- a/python/tests/test_vino.py
+++ b/python/tests/test_vino.py
@@ -20,6 +20,12 @@ img_path = tests_dir / "ch_en_num.jpg"
package_name = "rapidocr_openvino"
+def test_mode_one_img():
+ img_path = tests_dir / "issue_170.png"
+ result, _ = engine(img_path)
+ assert result[0][1] == "TEST"
+
+
@pytest.mark.parametrize(
"img_name,gt",
[