未验证 提交 0307e4f5 编写于 作者: B BreezeDeus 提交者: GitHub

Merge pull request #227 from breezedeus/dev

bug fixes
......@@ -31,9 +31,10 @@ doc:
package:
rm -rf build
python setup.py sdist bdist_wheel
VERSION = 2.2.2.1
VERSION = 2.2.2.2
upload:
python -m twine upload dist/cnocr-$(VERSION)* --verbose
......
......@@ -2,7 +2,7 @@
<img src="./docs/figs/cnocr-logo.jpg" width="250px"/>
<div>&nbsp;</div>
[![Downloads](https://static.pepy.tech/personalized-badge/cnocr?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://cnocr.readthedocs.io/zh/latest/)
[![Downloads](https://static.pepy.tech/personalized-badge/cnocr?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pepy.tech/project/cnocr)
[![license](https://img.shields.io/github/license/breezedeus/cnocr)](./LICENSE)
[![Docs](https://readthedocs.org/projects/cnocr/badge/?version=latest)](https://cnocr.readthedocs.io/zh/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/cnocr.svg)](https://badge.fury.io/py/cnocr)
......
......@@ -17,4 +17,4 @@
# specific language governing permissions and limitations
# under the License.
__version__ = '2.2.2.1'
__version__ = '2.2.2.2'
......@@ -22,7 +22,13 @@ from functools import partial
from typing import Any, List, Optional, Callable
from torch import nn, Tensor
from torchvision.models.mobilenetv2 import ConvBNActivation
try:
from torchvision.models.mobilenetv2 import ConvBNActivation
except:
# FIXME: 目前的识别模型其实没有用到mobilenetv3的,所以这个文件应该不会被真的用到
# 如果真用到,需要check一下新的Conv2dNormActivation是否能替代之前的ConvBNActivation
# Ref: https://github.com/pytorch/vision/releases/tag/v0.14.0
from torchvision.ops.misc import Conv2dNormActivation as ConvBNActivation
from torchvision.models import mobilenetv3
from torchvision.models.mobilenetv3 import InvertedResidualConfig
......
......@@ -347,7 +347,11 @@ class Recognizer(object):
sorted_out = []
while idx * batch_size < len(sorted_img_list):
imgs = sorted_img_list[idx * batch_size : (idx + 1) * batch_size]
batch_out = self._predict(imgs)
try:
batch_out = self._predict(imgs)
except Exception as e:
# 对于太小的图片,如宽度小于8,会报错
batch_out = {'preds': [([''], 0.0)] * len(imgs)}
sorted_out.extend(batch_out['preds'])
idx += 1
out = [None] * len(sorted_out)
......
# Release Notes
### Update 2023.02.11: 发布 cnocr V2.2.2.2
主要变更:
* 修复了识别很窄图片时异常的问题。
* 修复了对 torchvision 0.14 的兼容问题。
### Update 2022.10.30: 发布 cnocr V2.2.2.1
主要变更:
* 修复了与新版 torch 和 torchvision 不兼容的问题。
### Update 2022.09.09: 发布 cnocr V2.2.2
......
# 给作者加油🥤
# 给作者加油 (Sponsor the Author)🥤
开源不易,如果此项目对您有帮助,可以考虑使用以下方式为作者加油
虽然AI技术偶尔被用于作恶,但我更相信它能给人类和其他生命带来温暖。这是我创建和持续优化这些开源项目的最大动力。它们不是为了展示技术的强大,而是为了给有需要的人带来方便和帮助。通过对这些项目的捐赠,您可以和我一道让AI为更多人带来温暖和美好
My unwavering love for artificial intelligence technology drives me to constantly seek new challenges and opportunities. This is why I have created these open-sourced projects, which aim not just to demonstrate technical prowess, but more importantly, to bring convenience and help to those who need it. I truly believe that these projects have the power to change lives for the better. Seeing the positive impact of my work fills me with a sense of happiness and pride that fuels my drive to continue creating and innovating.
By supporting my projects through a donation, you can be a part of this journey and help me bring more warmth and humanity to the world of AI.
## 一、知识星球
欢迎加入**知识星球** [**CnOCR/CnSTD私享群 **](https://t.zsxq.com/FEYZRJQ)**知识星球私享群**会陆续发布一些CnOCR/CnSTD相关的私有资料,包括**更详细的训练教程****未公开的模型**,使用过程中遇到的难题解答等。本群也会发布OCR/STD相关的最新研究和各种资源。此外,**私享群中作者每月提供两次免费特有数据的训练服务**
## 1. 知识星球
欢迎加入**知识星球** **[CnOCR/CnSTD私享群](https://t.zsxq.com/FEYZRJQ)****知识星球私享群**会陆续发布一些 CnOCR/CnSTD/P2T 相关的私有资料,包括**更详细的训练教程****未公开的模型**,使用过程中遇到的难题解答等。本群也会发布 OCR/STD/AI 相关的最新研究和各种资源。此外,**私享群中作者每月提供两次免费特有数据的训练服务**
<figure markdown>
![知识星球二维码](./cnocr-zsxq.jpeg){: style="width:280px"}
</figure>
## 二、支付宝打赏
## 2. 支付宝打赏 (Alipay reward)
通过**支付宝**给作者打赏。
Give the author a reward through Alipay.
<figure markdown>
![支付宝收款码](./cnocr-zfb.jpg){: style="width:280px"}
</figure>
\ No newline at end of file
</figure>
## 3. Buy me a Coffee
If you are not in mainland China, you can also support the author through:
<div align="center">
<a href="https://www.buymeacoffee.com/breezedeus2" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
</div>
......@@ -3,7 +3,7 @@
</figure>
# CnOCR
[![Downloads](https://static.pepy.tech/personalized-badge/cnocr?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://cnocr.readthedocs.io/zh/latest/)
[![Downloads](https://static.pepy.tech/personalized-badge/cnocr?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pepy.tech/project/cnocr)
[![license](https://img.shields.io/github/license/breezedeus/cnocr)](./LICENSE)
[![PyPI version](https://badge.fury.io/py/cnocr.svg)](https://badge.fury.io/py/cnocr)
[![forks](https://img.shields.io/github/forks/breezedeus/cnocr)](https://github.com/breezedeus/cnocr)
......
--index-url https://pypi.doubanio.com/simple --extra-index-url https://pypi.org/simple
--index-url https://pypi.tuna.tsinghua.edu.cn/simple
--extra-index-url https://pypi.doubanio.com/simple --extra-index-url https://pypi.org/simple
click
tqdm
torch>=1.8.0,<1.13
torchvision>=0.9.0,<0.14
torch>=1.8.0,<2.0
torchvision>=0.9.0
numpy
pytorch-lightning>=1.6.0
torchmetrics>=0.9.0
pillow>=5.3.0
#python-Levenshtein
onnx
onnxruntime
cnstd>=1.2
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile --output-file=requirements.txt requirements.in
#
--index-url https://pypi.doubanio.com/simple
--index-url https://pypi.tuna.tsinghua.edu.cn/simple
--extra-index-url https://pypi.doubanio.com/simple
--extra-index-url https://pypi.org/simple
absl-py==0.13.0
# via tensorboard
aiohttp==3.7.4.post0
aiohttp==3.8.3
# via fsspec
async-timeout==3.0.1
aiosignal==1.3.1
# via aiohttp
attrs==21.2.0
async-timeout==4.0.2
# via aiohttp
cachetools==4.2.2
# via google-auth
certifi==2020.4.5.1
attrs==22.2.0
# via aiohttp
certifi==2022.12.7
# via requests
chardet==3.0.4
charset-normalizer==2.1.1
# via
# aiohttp
# requests
click==8.0.1
click==8.1.3
# via
# -r requirements.in
# cnstd
cnstd==1.2
cnstd==1.2.1
# via -r requirements.in
coloredlogs==15.0.1
# via onnxruntime
contourpy==1.0.7
# via matplotlib
cycler==0.11.0
# via matplotlib
flatbuffers==2.0
flatbuffers==23.1.21
# via onnxruntime
fonttools==4.34.4
fonttools==4.38.0
# via matplotlib
fsspec[http]==2021.7.0
# via pytorch-lightning
google-auth==1.35.0
frozenlist==1.3.3
# via
# google-auth-oauthlib
# tensorboard
google-auth-oauthlib==0.4.5
# via tensorboard
grpcio==1.39.0
# via tensorboard
idna==2.9
# aiohttp
# aiosignal
fsspec[http]==2023.1.0
# via pytorch-lightning
humanfriendly==10.0
# via coloredlogs
idna==3.4
# via
# requests
# yarl
kiwisolver==1.4.3
kiwisolver==1.4.4
# via matplotlib
markdown==3.3.4
# via tensorboard
matplotlib==3.5.2
# via cnstd
multidict==5.1.0
lightning-utilities==0.6.0.post0
# via pytorch-lightning
matplotlib==3.6.3
# via
# cnstd
# seaborn
mpmath==1.2.1
# via sympy
multidict==6.0.4
# via
# aiohttp
# yarl
numpy==1.22.3
numpy==1.24.2
# via
# -r requirements.in
# cnstd
# contourpy
# matplotlib
# onnx
# onnxruntime
# opencv-python
# pandas
# pytorch-lightning
# scipy
# tensorboard
# seaborn
# shapely
# torchmetrics
# torchvision
oauthlib==3.1.1
# via requests-oauthlib
onnx==1.11.0
onnx==1.13.0
# via
# -r requirements.in
# cnstd
onnxruntime==1.11.1
onnxruntime==1.14.0
# via
# -r requirements.in
# cnstd
opencv-python==4.6.0.66
opencv-python==4.7.0.68
# via cnstd
packaging==21.0
packaging==23.0
# via
# lightning-utilities
# matplotlib
# onnxruntime
# pytorch-lightning
# torchmetrics
pillow==9.1.1
pandas==1.5.3
# via
# cnstd
# seaborn
pillow==9.4.0
# via
# -r requirements.in
# cnstd
......@@ -97,95 +109,73 @@ pillow==9.1.1
# torchvision
polygon3==3.0.9.1
# via cnstd
protobuf==3.17.3
protobuf==3.20.3
# via
# onnx
# onnxruntime
# tensorboard
pyasn1==0.4.8
# via
# pyasn1-modules
# rsa
pyasn1-modules==0.2.8
# via google-auth
pyclipper==1.3.0.post3
pyclipper==1.3.0.post4
# via cnstd
pydeprecate==0.3.1
# via pytorch-lightning
pyparsing==2.4.7
pyparsing==3.0.9
# via matplotlib
python-dateutil==2.8.2
# via
# matplotlib
# packaging
python-dateutil==2.8.2
# via matplotlib
pytorch-lightning==1.6.3
# pandas
pytorch-lightning==1.9.1
# via
# -r requirements.in
# cnstd
pyyaml==5.4.1
# via pytorch-lightning
requests==2.23.0
pytz==2022.7.1
# via pandas
pyyaml==6.0
# via
# cnstd
# pytorch-lightning
requests==2.28.2
# via
# fsspec
# requests-oauthlib
# tensorboard
requests-oauthlib==1.3.0
# via google-auth-oauthlib
rsa==4.7.2
# via google-auth
scipy==1.8.1
# torchvision
scipy==1.10.0
# via cnstd
shapely==1.8.2
seaborn==0.12.2
# via cnstd
six==1.14.0
# via
# absl-py
# google-auth
# grpcio
# protobuf
# python-dateutil
tensorboard==2.6.0
# via pytorch-lightning
tensorboard-data-server==0.6.1
# via tensorboard
tensorboard-plugin-wit==1.8.0
# via tensorboard
torch==1.9.0
shapely==2.0.1
# via cnstd
six==1.16.0
# via python-dateutil
sympy==1.11.1
# via onnxruntime
torch==1.13.1
# via
# -r requirements.in
# cnstd
# pytorch-lightning
# torchmetrics
# torchvision
torchmetrics==0.9.3
torchmetrics==0.11.1
# via
# -r requirements.in
# pytorch-lightning
torchvision==0.10.0
torchvision==0.14.1
# via
# -r requirements.in
# cnstd
tqdm==4.64.0
tqdm==4.64.1
# via
# -r requirements.in
# cnstd
# pytorch-lightning
typing-extensions==4.2.0
typing-extensions==4.4.0
# via
# aiohttp
# lightning-utilities
# onnx
# pytorch-lightning
# torch
unidecode==1.3.4
# torchmetrics
# torchvision
unidecode==1.3.6
# via cnstd
urllib3==1.25.9
urllib3==1.26.14
# via requests
werkzeug==2.0.1
# via tensorboard
wheel==0.37.0
# via tensorboard
yarl==1.6.3
yarl==1.8.2
# via aiohttp
# The following packages are considered to be unsafe in a requirements file:
# setuptools
......@@ -39,8 +39,8 @@ exec(
required = [
"click",
"tqdm",
"torch>=1.8.0,<1.13",
"torchvision>=0.9.0,<0.14",
"torch>=1.8.0,<2.0",
"torchvision>=0.9.0",
'numpy',
"pytorch-lightning>=1.6.0",
"torchmetrics",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册