mirror of
https://github.com/sml2h3/ddddocr.git
synced 2025-05-19 10:19:33 +08:00
修复了slide_match部分在simple_target为False时异常情况,异常时自动设置simple_target为True
This commit is contained in:
parent
5013e926cc
commit
8d57008e2a
20
README.md
20
README.md
@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
# 带带弟弟OCR通用验证码识别SDK免费开源版
|
# 带带弟弟OCR通用验证码识别SDK免费开源版
|
||||||
|
|
||||||
# 2022/05/27 关注我的直播间
|
|
||||||
|
|
||||||
[B站直播间-点击关注我哦~在线分享答疑](https://space.bilibili.com/313042688)
|
|
||||||
|
|
||||||
# 今天ddddocr又更新啦!
|
|
||||||
## 当前版本为1.4.3
|
# 当前版本为1.4.7
|
||||||
|
|
||||||
|
## 1.4.3更新内容
|
||||||
|
|
||||||
本次升级的主要原因为,[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 的开源进行适配,使[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练出的模型可以直接无缝导入到ddddocr里面来使用
|
本次升级的主要原因为,[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 的开源进行适配,使[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练出的模型可以直接无缝导入到ddddocr里面来使用
|
||||||
|
|
||||||
## 使用ddddocr调用[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后的模型
|
### 支持使用ddddocr调用 [dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后的自定义模型
|
||||||
|
|
||||||
[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后会在models目录里导出charsets.json和onnx模型
|
[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后会在models目录里导出charsets.json和onnx模型
|
||||||
|
|
||||||
@ -31,8 +31,14 @@ print(res)
|
|||||||
|
|
||||||
# 捐赠 (如果项目有帮助到您,可以选择捐赠一些费用用于ddddocr的后续版本维护,本项目长期维护)
|
# 捐赠 (如果项目有帮助到您,可以选择捐赠一些费用用于ddddocr的后续版本维护,本项目长期维护)
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
# 赞助合作商
|
||||||
|
|
||||||
|
| 赞助合作商 | 推荐理由 |
|
||||||
|
|------------|--------------------------------------------------------------------------------------------------|
|
||||||
|
| [YesCaptcha](https://yescaptcha.com/i/NSwk7i) | 谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口 [点我](https://yescaptcha.com/i/NSwk7i) 直达VIP4 |
|
||||||
|
|
||||||
# 1.4.0版本更新内容
|
# 1.4.0版本更新内容
|
||||||
|
|
||||||
|
@ -2,12 +2,16 @@
|
|||||||
|
|
||||||
# 带带弟弟OCR通用验证码识别SDK免费开源版
|
# 带带弟弟OCR通用验证码识别SDK免费开源版
|
||||||
|
|
||||||
# 今天ddddocr又更新啦!
|
|
||||||
## 当前版本为1.4.3
|
|
||||||
|
|
||||||
|
# 当前版本为1.4.7
|
||||||
|
|
||||||
|
## 1.4.3更新内容
|
||||||
|
|
||||||
本次升级的主要原因为,[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 的开源进行适配,使[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练出的模型可以直接无缝导入到ddddocr里面来使用
|
本次升级的主要原因为,[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 的开源进行适配,使[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练出的模型可以直接无缝导入到ddddocr里面来使用
|
||||||
|
|
||||||
## 使用ddddocr调用[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后的模型
|
### 支持使用ddddocr调用 [dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后的自定义模型
|
||||||
|
|
||||||
[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后会在models目录里导出charsets.json和onnx模型
|
[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后会在models目录里导出charsets.json和onnx模型
|
||||||
|
|
||||||
@ -27,8 +31,14 @@ print(res)
|
|||||||
|
|
||||||
# 捐赠 (如果项目有帮助到您,可以选择捐赠一些费用用于ddddocr的后续版本维护,本项目长期维护)
|
# 捐赠 (如果项目有帮助到您,可以选择捐赠一些费用用于ddddocr的后续版本维护,本项目长期维护)
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
# 赞助合作商
|
||||||
|
|
||||||
|
| 赞助合作商 | 推荐理由 |
|
||||||
|
|------------|--------------------------------------------------------------------------------------------------|
|
||||||
|
| [YesCaptcha](https://yescaptcha.com/i/NSwk7i) | 谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口 [点我](https://yescaptcha.com/i/NSwk7i) 直达VIP4 |
|
||||||
|
|
||||||
# 1.4.0版本更新内容
|
# 1.4.0版本更新内容
|
||||||
|
|
||||||
@ -225,8 +235,7 @@ cv2.imwrite("result.jpg", im)
|
|||||||
|
|
||||||
`Windows/Linux/Macos..`
|
`Windows/Linux/Macos..`
|
||||||
|
|
||||||
M1X用户需要使用 ([传送门](https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-arm64.sh
|
暂时不支持Macbook M1(X),M1(X)用户需要自己编译onnxruntime才可以使用
|
||||||
))创建python环境后即可使用
|
|
||||||
|
|
||||||
## 安装命令
|
## 安装命令
|
||||||
|
|
||||||
@ -248,6 +257,7 @@ M1X用户需要使用 ([传送门](https://github.com/conda-forge/miniforge/re
|
|||||||
|
|
||||||
# 交流群 (加我好友拉你进群)
|
# 交流群 (加我好友拉你进群)
|
||||||
|
|
||||||
|

|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@ class DdddOcr(object):
|
|||||||
print("欢迎使用ddddocr,本项目专注带动行业内卷,个人博客:wenanzhe.com")
|
print("欢迎使用ddddocr,本项目专注带动行业内卷,个人博客:wenanzhe.com")
|
||||||
print("训练数据支持来源于:http://146.56.204.113:19199/preview")
|
print("训练数据支持来源于:http://146.56.204.113:19199/preview")
|
||||||
print("爬虫框架feapder可快速一键接入,快速开启爬虫之旅:https://github.com/Boris-code/feapder")
|
print("爬虫框架feapder可快速一键接入,快速开启爬虫之旅:https://github.com/Boris-code/feapder")
|
||||||
|
print("谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口:https://yescaptcha.com/i/NSwk7i")
|
||||||
self.use_import_onnx = False
|
self.use_import_onnx = False
|
||||||
self.__word = False
|
self.__word = False
|
||||||
self.__resize = []
|
self.__resize = []
|
||||||
@ -1692,10 +1693,16 @@ class DdddOcr(object):
|
|||||||
end_x = x
|
end_x = x
|
||||||
return image.crop([starttx, startty, end_x, end_y]), starttx, startty
|
return image.crop([starttx, startty, end_x, end_y]), starttx, startty
|
||||||
|
|
||||||
def slide_match(self, target_bytes: bytes = None, background_bytes: bytes = None, simple_target: bool=False):
|
def slide_match(self, target_bytes: bytes = None, background_bytes: bytes = None, simple_target: bool=False, flag: bool=False):
|
||||||
if not simple_target:
|
if not simple_target:
|
||||||
target, target_x, target_y = self.get_target(target_bytes)
|
try:
|
||||||
target = cv2.cvtColor(np.asarray(target), cv2.IMREAD_ANYCOLOR)
|
target, target_x, target_y = self.get_target(target_bytes)
|
||||||
|
target = cv2.cvtColor(np.asarray(target), cv2.IMREAD_ANYCOLOR)
|
||||||
|
except SystemError as e:
|
||||||
|
# SystemError: tile cannot extend outside image
|
||||||
|
if flag:
|
||||||
|
raise e
|
||||||
|
return self.slide_match(target_bytes=target_bytes, background_bytes=background_bytes, simple_target=True, flag=True)
|
||||||
else:
|
else:
|
||||||
target = cv2.imdecode(np.frombuffer(target_bytes, np.uint8), cv2.IMREAD_ANYCOLOR)
|
target = cv2.imdecode(np.frombuffer(target_bytes, np.uint8), cv2.IMREAD_ANYCOLOR)
|
||||||
target_y = 0
|
target_y = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user