diff --git a/Makefile b/Makefile index 1660906..0e15451 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ package: rm -rf build python setup.py sdist bdist_wheel -VERSION = 1.2.3.3 +VERSION = 1.2.3.4 upload: python -m twine upload dist/cnstd-$(VERSION)* --verbose diff --git a/README.md b/README.md index 98546d0..3e75a3c 100644 --- a/README.md +++ b/README.md @@ -98,10 +98,22 @@ MFD 模型检测图片中包含的数学公式,其中行内的公式检测为 pip install cnstd ``` +如果需要使用 ONNX 模型(`model_backend=onnx`),请使用以下命令安装: + +* CPU环境使用 ONNX 模型: + ```bash + pip install cnstd[ort-cpu] + ``` +* GPU环境使用 ONNX 模型: + ```bash + pip install cnstd[ort-gpu] + ``` + * 注意:如果当前环境已经安装了 `onnxruntime` 包,请先手动卸载(`pip uninstall onnxruntime`)后再运行上面的命令。 + 安装速度慢的话,可以指定国内的安装源,如使用豆瓣源: ```bash -pip install cnstd -i https://pypi.doubanio.com/simple +pip install cnstd -i https://mirrors.aliyun.com/pypi/simple ``` 【注意】: diff --git a/RELEASE.md b/RELEASE.md index 3f12dff..8f88ff9 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,13 @@ # Release Notes +# Update 2023.09.23:发布 V1.2.3.4 + +主要变更: +* 增加了对 `onnxruntine` (ORT) 新版的兼容:`InferenceSession` 中显式提供了 `providers` 参数。 +* `setup.py` 中去除对 `onnxruntime` 的依赖,改为在 `extras_require` 中按需指定: + * `cnstd[ort-cpu]`:`onnxruntime`; + * `cnstd[ort-gpu]`: `onnxruntime-gpu`。 + # Update 2023.09.21:发布 V1.2.3.3 主要变更: diff --git a/cnstd/__version__.py b/cnstd/__version__.py index 0e8239e..1f4a245 100644 --- a/cnstd/__version__.py +++ b/cnstd/__version__.py @@ -17,4 +17,4 @@ # specific language governing permissions and limitations # under the License. -__version__ = '1.2.3.3' +__version__ = '1.2.3.4' diff --git a/cnstd/ppocr/utility.py b/cnstd/ppocr/utility.py index 92d1d90..f7e0ded 100644 --- a/cnstd/ppocr/utility.py +++ b/cnstd/ppocr/utility.py @@ -154,7 +154,7 @@ def create_predictor(model_fp, mode, logger): model_file_path = model_fp if not os.path.exists(model_file_path): raise ValueError("not find model file path {}".format(model_file_path)) - sess = ort.InferenceSession(model_file_path) + sess = ort.InferenceSession(model_file_path, providers=['AzureExecutionProvider', 'CPUExecutionProvider']) return sess, sess.get_inputs()[0], None, None diff --git a/setup.py b/setup.py index e790351..7a3fda2 100644 --- a/setup.py +++ b/setup.py @@ -55,11 +55,12 @@ 'matplotlib', 'seaborn', "onnx", - "onnxruntime", "huggingface_hub", ] extras_require = { + "ort-cpu": ["onnxruntime"], + "ort-gpu": ["onnxruntime-gpu"], "dev": ["pip-tools", "pytest"], }