![header.png](https://cdn.wenanzhe.com/img/68747470733a2f2f7a332e617831782e636f6d2f323032312f30372f30322f5236496832382e6a7067.jfif)
# 带带弟弟OCR通用验证码识别SDK免费开源版
# 当前版本为1.4.8
## 1.4.3更新内容
本次升级的主要原因为,[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) 训练后的自定义模型
[dddd_trainer](https://github.com/sml2h3/dddd_trainer) 训练后会在models目录里导出charsets.json和onnx模型
如下所示,import_onnx_path为onnx所在地址,charsets_path为onnx所在地址
```python
import ddddocr
ocr = ddddocr.DdddOcr(det=False, ocr=False, import_onnx_path="myproject_0.984375_139_13000_2022-02-26-15-34-13.onnx", charsets_path="charsets.json")
with open('888e28774f815b01e871d474e5c84ff2.jpg', 'rb') as f:
image_bytes = f.read()
res = ocr.classification(image_bytes)
print(res)
```
# 捐赠 (如果项目有帮助到您,可以选择捐赠一些费用用于ddddocr的后续版本维护,本项目长期维护)
![Test](https://cdn.wenanzhe.com/img/zhifubao.jpg!/scale/30)
![Test](https://cdn.wenanzhe.com/img/weixin.jpg!/scale/30)
# 赞助合作商
| | 赞助合作商 | 推荐理由 |
|------------------------------------------------------------|------------|--------------------------------------------------------------------------------------------------|
| ![YesCaptcha](https://cdn.wenanzhe.com/img/yescaptcha.png) | [YesCaptcha](https://yescaptcha.com/i/NSwk7i) | 谷歌reCaptcha验证码 / hCaptcha验证码 / funCaptcha验证码商业级识别接口 [点我](https://yescaptcha.com/i/NSwk7i) 直达VIP4 |
# 1.4.0版本更新内容
本次更新新增了两种滑块识别算法,算法非深度神经网络实现,仅使用opencv和PIL完成。
## 算法1
小滑块为单独的png图片,背景是透明图,如下图
![Test](https://cdn.wenanzhe.com/img/b.png)
然后背景为带小滑块坑位的,如下图
![Test](https://cdn.wenanzhe.com/img/a.png)
```python
det = ddddocr.DdddOcr(det=False, ocr=False)
with open('target.png', 'rb') as f:
target_bytes = f.read()
with open('background.png', 'rb') as f:
background_bytes = f.read()
res = det.slide_match(target_bytes, background_bytes)
print(res)
```
*提示:如果小图无过多背景部分,则可以添加simple_target参数, 通常为jpg或者bmp格式的图片*
```python
slide = ddddocr.DdddOcr(det=False, ocr=False)
with open('target.jpg', 'rb') as f:
target_bytes = f.read()
with open('background.jpg', 'rb') as f:
background_bytes = f.read()
res = slide.slide_match(target_bytes, background_bytes, simple_target=True)
print(res)
```
## 算法2
一张图为带坑位的原图,如下图
![Test](https://cdn.wenanzhe.com/img/bg.jpg)
一张图为原图,如下图
![Test](https://cdn.wenanzhe.com/img/fullpage.jpg)
```python
slide = ddddocr.DdddOcr(det=False, ocr=False)
with open('bg.jpg', 'rb') as f:
target_bytes = f.read()
with open('fullpage.jpg', 'rb') as f:
background_bytes = f.read()
img = cv2.imread("bg.jpg")
res = slide.slide_comparison(target_bytes, background_bytes)
print(res)
```
## 更新内容2
添加全局ocr关闭参数,初始化时传入
`dddd = ddddocr.DdddOcr(ocr=False)`
则为关闭ocr功能,如果det = True,则会自动关闭ocr
# 1.3.1版本更新内容
想必很多做验证码的新手,一定头疼碰到点选类型的图像,做样本费时费力,神经网络不会写,训练设备太昂贵,模型效果又不好。
市场上常见的点选类验证码图片如下图所示
![Test](https://cdn.wenanzhe.com/img/0446fe794381489f90719d5e0506f2da.jpg)
![Test](https://cdn.wenanzhe.com/img/6175e944c1dc408a89aabe4f7fc07fca.jpg)
![Test](https://cdn.wenanzhe.com/img/20211226135747.png)
![Test](https://cdn.wenanzhe.com/img/f34390d4911c45ce9058dc2e7e9d847a.jpg)
那么今天,他来了,ddddocr带着重磅更新大摇大摆的走来了。
# 简介
ddddocr是由sml2h3开发的专为验证码厂商进行对自家新版本验证码难易强度进行验证的一个python库,其由作者与kerlomz共同合作完成,通过大批量生成随机数据后进行深度网络训练,本身并非针对任何一家验证码厂商而制作,本库使用效果完全靠玄学,可能可以识别,可能不能识别。
ddddocr奉行着开箱即用、最简依赖的理念,尽量减少用户的配置和使用成本,希望给每一位测试者带来舒适的体验
项目地址: [点我传送](https://github.com/sml2h3/ddddocr)
# 更新说明
本次更新其实分为两部分,其中有一部分是在1.2.0版本就已经更新了,但是在这里还是有必要提一下的。
## 第一部分 OCR识别部分
在1.2.0开始,ddddocr的识别部分进行了一次beta更新,主要更新在于网络结构主体的升级,其训练数据并没有发生过多的改变,所以理论上在识别结果上,原先可能识别效果的很好的图形在1.2.0上有一小部分概率会有一定程度的下降,也有可能原本识别不好的图形在1.2.0之后效果却变得特别好。
测试代码:
```python
import ddddocr
ocr = ddddocr.DdddOcr()
with open("test.jpg", 'rb') as f:
image = f.read()
res = ocr.classification(image)
print(res)
```
通过在初始化ddddocr的时候使用beta参数即可快速切换新模型
```python
import ddddocr
ocr = ddddocr.DdddOcr(beta=True)
with open("test.jpg", 'rb') as f:
image = f.read()
res = ocr.classification(image)
print(res)
```
OCR部分应该已经有很多人做了测试,在这里就放一部分网友的测试图片。
![Test](https://cdn.wenanzhe.com/img/20210715211733855.png)
![Test](https://cdn.wenanzhe.com/img/78b7f57d-371d-4b65-afb2-d19608ae1892.png)
![Test](https://cdn.wenanzhe.com/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20211226142305.png)
![Test](https://cdn.wenanzhe.com/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20211226142325.png)
![Test](https://cdn.wenanzhe.com/img/2AMLyA_fd83e1f1800e829033417ae6dd0e0ae0.png)
![Test](https://cdn.wenanzhe.com/img/aabd_181ae81dd5526b8b89f987d1179266ce.jpg)
![Test](https://cdn.wenanzhe.com/img/2bghz_b504e9f9de1ed7070102d21c6481e0cf.png)
![Test](https://cdn.wenanzhe.com/img/0000_z4ecc2p65rxc610x.jpg)
![Test](https://cdn.wenanzhe.com/img/2acd_0586b6b36858a4e8a9939db8a7ec07b7.jpg)
![Test](https://cdn.wenanzhe.com/img/2a8r_79074e311d573d31e1630978fe04b990.jpg)
![Test](https://cdn.wenanzhe.com/img/aftf_C2vHZlk8540y3qAmCM.bmp)
![Test](https://cdn.wenanzhe.com/img/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20211226144057.png)
等等更多图片等你测试哟~
## 第二部分 目标检测部分
在本次1.3.0的更新中,目标检测部分隆重登场!
目标检测部分同样也是由大量随机合成数据训练而成,对于现在已有的点选验证码图片或者未知的验证码图片都有可能具备一定的识别能力,适用于文字点选和图标点选。
简单来说,对于点选类的验证码,可以快速的检测出图片上的文字或者图标。
```python
import ddddocr
import cv2
det = ddddocr.DdddOcr(det=True)
with open("test.jpg", 'rb') as f:
image = f.read()
poses = det.detection(image)
print(poses)
im = cv2.imread("test.jpg")
for box in poses:
x1, y1, x2, y2 = box
im = cv2.rectangle(im, (x1, y1), (x2, y2), color=(0, 0, 255), thickness=2)
cv2.imwrite("result.jpg", im)
```
举些例子:
![Test](https://cdn.wenanzhe.com/img/page1_1.jpg)
![Test](https://cdn.wenanzhe.com/img/page1_2.jpg)
![Test](https://cdn.wenanzhe.com/img/page1_3.jpg)
![Test](https://cdn.wenanzhe.com/img/page1_4.jpg)
![Test](https://cdn.wenanzhe.com/img/result.jpg)
![Test](https://cdn.wenanzhe.com/img/result2.jpg)
![Test](https://cdn.wenanzhe.com/img/result4.jpg)
以上只是目前我能找到的点选验证码图片,做了一个简单的测试。
# 安装
## 环境支持
`python <= 3.9`
`Windows/Linux/Macos..`
暂时不支持Macbook M1(X),M1(X)用户需要自己编译onnxruntime才可以使用
## 安装命令
`pip install ddddocr`
以上命令将自动安装符合自己电脑环境的最新ddddocr
## 拓展 一键部署ddddocr api,支持docker部署
[github](https://github.com/sml2h3/ocr_api_server)
[gitee](https://gitee.com/fkgeek/ocr_api_server)
## 爬虫框架推荐
[feapder](https://github.com/Boris-code/feapder)
[crawlab](https://github.com/crawlab-team/crawlab)
# 交流群 (加我好友拉你进群)
![五群链接](https://cdn.wenanzhe.com/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220929101325.jpg!/scale/50)
![Test](https://cdn.wenanzhe.com/img/mmqrcode1640418911274.png!/scale/50)
## Star 历史
[![Star History Chart](https://api.star-history.com/svg?repos=sml2h3/ddddocr&type=Date)](https://star-history.com/#sml2h3/ddddocr&Date)
Raw data
{
"_id": null,
"home_page": "https://github.com/sml2h3/ddddocr",
"name": "ddddocrfix",
"maintainer": "",
"docs_url": null,
"requires_python": "<3.11",
"maintainer_email": "",
"keywords": "",
"author": "sml2h3",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/73/02/048e6b712ca786c05cf1764bfd8d3dddd045b2264d0fe5d7e4f4262c3a94/ddddocrfix-1.4.8.tar.gz",
"platform": null,
"description": "![header.png](https://cdn.wenanzhe.com/img/68747470733a2f2f7a332e617831782e636f6d2f323032312f30372f30322f5236496832382e6a7067.jfif)\n\n# \u5e26\u5e26\u5f1f\u5f1fOCR\u901a\u7528\u9a8c\u8bc1\u7801\u8bc6\u522bSDK\u514d\u8d39\u5f00\u6e90\u7248\n\n# \u5f53\u524d\u7248\u672c\u4e3a1.4.8\n\n## 1.4.3\u66f4\u65b0\u5185\u5bb9\n\n\u672c\u6b21\u5347\u7ea7\u7684\u4e3b\u8981\u539f\u56e0\u4e3a\uff0c[dddd_trainer](https://github.com/sml2h3/dddd_trainer) \u7684\u5f00\u6e90\u8fdb\u884c\u9002\u914d\uff0c\u4f7f[dddd_trainer](https://github.com/sml2h3/dddd_trainer) \u8bad\u7ec3\u51fa\u7684\u6a21\u578b\u53ef\u4ee5\u76f4\u63a5\u65e0\u7f1d\u5bfc\u5165\u5230ddddocr\u91cc\u9762\u6765\u4f7f\u7528\n\n### \u652f\u6301\u4f7f\u7528ddddocr\u8c03\u7528 [dddd_trainer](https://github.com/sml2h3/dddd_trainer) \u8bad\u7ec3\u540e\u7684\u81ea\u5b9a\u4e49\u6a21\u578b\n\n[dddd_trainer](https://github.com/sml2h3/dddd_trainer) \u8bad\u7ec3\u540e\u4f1a\u5728models\u76ee\u5f55\u91cc\u5bfc\u51facharsets.json\u548connx\u6a21\u578b\n\n\u5982\u4e0b\u6240\u793a\uff0cimport_onnx_path\u4e3aonnx\u6240\u5728\u5730\u5740\uff0ccharsets_path\u4e3aonnx\u6240\u5728\u5730\u5740\n```python\nimport ddddocr\n\nocr = ddddocr.DdddOcr(det=False, ocr=False, import_onnx_path=\"myproject_0.984375_139_13000_2022-02-26-15-34-13.onnx\", charsets_path=\"charsets.json\")\n\nwith open('888e28774f815b01e871d474e5c84ff2.jpg', 'rb') as f:\n image_bytes = f.read()\n\nres = ocr.classification(image_bytes)\nprint(res)\n\n```\n\n# \u6350\u8d60 \uff08\u5982\u679c\u9879\u76ee\u6709\u5e2e\u52a9\u5230\u60a8\uff0c\u53ef\u4ee5\u9009\u62e9\u6350\u8d60\u4e00\u4e9b\u8d39\u7528\u7528\u4e8eddddocr\u7684\u540e\u7eed\u7248\u672c\u7ef4\u62a4\uff0c\u672c\u9879\u76ee\u957f\u671f\u7ef4\u62a4\uff09\n\n ![Test](https://cdn.wenanzhe.com/img/zhifubao.jpg!/scale/30) \n ![Test](https://cdn.wenanzhe.com/img/weixin.jpg!/scale/30)\n\n# \u8d5e\u52a9\u5408\u4f5c\u5546\n\n| | \u8d5e\u52a9\u5408\u4f5c\u5546 | \u63a8\u8350\u7406\u7531 |\n|------------------------------------------------------------|------------|--------------------------------------------------------------------------------------------------|\n| ![YesCaptcha](https://cdn.wenanzhe.com/img/yescaptcha.png) | [YesCaptcha](https://yescaptcha.com/i/NSwk7i) | \u8c37\u6b4creCaptcha\u9a8c\u8bc1\u7801 / hCaptcha\u9a8c\u8bc1\u7801 / funCaptcha\u9a8c\u8bc1\u7801\u5546\u4e1a\u7ea7\u8bc6\u522b\u63a5\u53e3 [\u70b9\u6211](https://yescaptcha.com/i/NSwk7i) \u76f4\u8fbeVIP4 |\n\n# 1.4.0\u7248\u672c\u66f4\u65b0\u5185\u5bb9\n\n \u672c\u6b21\u66f4\u65b0\u65b0\u589e\u4e86\u4e24\u79cd\u6ed1\u5757\u8bc6\u522b\u7b97\u6cd5\uff0c\u7b97\u6cd5\u975e\u6df1\u5ea6\u795e\u7ecf\u7f51\u7edc\u5b9e\u73b0\uff0c\u4ec5\u4f7f\u7528opencv\u548cPIL\u5b8c\u6210\u3002\n\n ## \u7b97\u6cd51\n \u5c0f\u6ed1\u5757\u4e3a\u5355\u72ec\u7684png\u56fe\u7247\uff0c\u80cc\u666f\u662f\u900f\u660e\u56fe\uff0c\u5982\u4e0b\u56fe\n\n ![Test](https://cdn.wenanzhe.com/img/b.png) \n\n \u7136\u540e\u80cc\u666f\u4e3a\u5e26\u5c0f\u6ed1\u5757\u5751\u4f4d\u7684\uff0c\u5982\u4e0b\u56fe \n \n ![Test](https://cdn.wenanzhe.com/img/a.png) \n\n ```python\n det = ddddocr.DdddOcr(det=False, ocr=False)\n \n with open('target.png', 'rb') as f:\n target_bytes = f.read()\n \n with open('background.png', 'rb') as f:\n background_bytes = f.read()\n \n res = det.slide_match(target_bytes, background_bytes)\n \n print(res)\n ```\n *\u63d0\u793a\uff1a\u5982\u679c\u5c0f\u56fe\u65e0\u8fc7\u591a\u80cc\u666f\u90e8\u5206\uff0c\u5219\u53ef\u4ee5\u6dfb\u52a0simple_target\u53c2\u6570\uff0c \u901a\u5e38\u4e3ajpg\u6216\u8005bmp\u683c\u5f0f\u7684\u56fe\u7247*\n```python\n slide = ddddocr.DdddOcr(det=False, ocr=False)\n \n with open('target.jpg', 'rb') as f:\n target_bytes = f.read()\n \n with open('background.jpg', 'rb') as f:\n background_bytes = f.read()\n \n res = slide.slide_match(target_bytes, background_bytes, simple_target=True)\n \n print(res)\n ```\n ## \u7b97\u6cd52\n \u4e00\u5f20\u56fe\u4e3a\u5e26\u5751\u4f4d\u7684\u539f\u56fe\uff0c\u5982\u4e0b\u56fe\n\n ![Test](https://cdn.wenanzhe.com/img/bg.jpg) \n\n \u4e00\u5f20\u56fe\u4e3a\u539f\u56fe\uff0c\u5982\u4e0b\u56fe \n \n ![Test](https://cdn.wenanzhe.com/img/fullpage.jpg) \n\n ```python\n slide = ddddocr.DdddOcr(det=False, ocr=False)\n\n with open('bg.jpg', 'rb') as f:\n target_bytes = f.read()\n \n with open('fullpage.jpg', 'rb') as f:\n background_bytes = f.read()\n \n img = cv2.imread(\"bg.jpg\")\n \n res = slide.slide_comparison(target_bytes, background_bytes)\n\n print(res)\n ```\n\n ## \u66f4\u65b0\u5185\u5bb92\n \u6dfb\u52a0\u5168\u5c40ocr\u5173\u95ed\u53c2\u6570\uff0c\u521d\u59cb\u5316\u65f6\u4f20\u5165\n\n `dddd = ddddocr.DdddOcr(ocr=False)`\n\n \u5219\u4e3a\u5173\u95edocr\u529f\u80fd\uff0c\u5982\u679cdet = True\uff0c\u5219\u4f1a\u81ea\u52a8\u5173\u95edocr\n\n\n# 1.3.1\u7248\u672c\u66f4\u65b0\u5185\u5bb9\n\n \u60f3\u5fc5\u5f88\u591a\u505a\u9a8c\u8bc1\u7801\u7684\u65b0\u624b\uff0c\u4e00\u5b9a\u5934\u75bc\u78b0\u5230\u70b9\u9009\u7c7b\u578b\u7684\u56fe\u50cf\uff0c\u505a\u6837\u672c\u8d39\u65f6\u8d39\u529b\uff0c\u795e\u7ecf\u7f51\u7edc\u4e0d\u4f1a\u5199\uff0c\u8bad\u7ec3\u8bbe\u5907\u592a\u6602\u8d35\uff0c\u6a21\u578b\u6548\u679c\u53c8\u4e0d\u597d\u3002\n\n \u5e02\u573a\u4e0a\u5e38\u89c1\u7684\u70b9\u9009\u7c7b\u9a8c\u8bc1\u7801\u56fe\u7247\u5982\u4e0b\u56fe\u6240\u793a\n\n\n ![Test](https://cdn.wenanzhe.com/img/0446fe794381489f90719d5e0506f2da.jpg) \n\n ![Test](https://cdn.wenanzhe.com/img/6175e944c1dc408a89aabe4f7fc07fca.jpg) \n\n ![Test](https://cdn.wenanzhe.com/img/20211226135747.png) \n\n ![Test](https://cdn.wenanzhe.com/img/f34390d4911c45ce9058dc2e7e9d847a.jpg) \n\n \u90a3\u4e48\u4eca\u5929\uff0c\u4ed6\u6765\u4e86\uff0cddddocr\u5e26\u7740\u91cd\u78c5\u66f4\u65b0\u5927\u6447\u5927\u6446\u7684\u8d70\u6765\u4e86\u3002\n# \u7b80\u4ecb\n ddddocr\u662f\u7531sml2h3\u5f00\u53d1\u7684\u4e13\u4e3a\u9a8c\u8bc1\u7801\u5382\u5546\u8fdb\u884c\u5bf9\u81ea\u5bb6\u65b0\u7248\u672c\u9a8c\u8bc1\u7801\u96be\u6613\u5f3a\u5ea6\u8fdb\u884c\u9a8c\u8bc1\u7684\u4e00\u4e2apython\u5e93\uff0c\u5176\u7531\u4f5c\u8005\u4e0ekerlomz\u5171\u540c\u5408\u4f5c\u5b8c\u6210\uff0c\u901a\u8fc7\u5927\u6279\u91cf\u751f\u6210\u968f\u673a\u6570\u636e\u540e\u8fdb\u884c\u6df1\u5ea6\u7f51\u7edc\u8bad\u7ec3\uff0c\u672c\u8eab\u5e76\u975e\u9488\u5bf9\u4efb\u4f55\u4e00\u5bb6\u9a8c\u8bc1\u7801\u5382\u5546\u800c\u5236\u4f5c\uff0c\u672c\u5e93\u4f7f\u7528\u6548\u679c\u5b8c\u5168\u9760\u7384\u5b66\uff0c\u53ef\u80fd\u53ef\u4ee5\u8bc6\u522b\uff0c\u53ef\u80fd\u4e0d\u80fd\u8bc6\u522b\u3002\n\n ddddocr\u5949\u884c\u7740\u5f00\u7bb1\u5373\u7528\u3001\u6700\u7b80\u4f9d\u8d56\u7684\u7406\u5ff5\uff0c\u5c3d\u91cf\u51cf\u5c11\u7528\u6237\u7684\u914d\u7f6e\u548c\u4f7f\u7528\u6210\u672c\uff0c\u5e0c\u671b\u7ed9\u6bcf\u4e00\u4f4d\u6d4b\u8bd5\u8005\u5e26\u6765\u8212\u9002\u7684\u4f53\u9a8c\n\n\u9879\u76ee\u5730\u5740\uff1a [\u70b9\u6211\u4f20\u9001](https://github.com/sml2h3/ddddocr) \n\n# \u66f4\u65b0\u8bf4\u660e\n\n \u672c\u6b21\u66f4\u65b0\u5176\u5b9e\u5206\u4e3a\u4e24\u90e8\u5206\uff0c\u5176\u4e2d\u6709\u4e00\u90e8\u5206\u662f\u57281.2.0\u7248\u672c\u5c31\u5df2\u7ecf\u66f4\u65b0\u4e86\uff0c\u4f46\u662f\u5728\u8fd9\u91cc\u8fd8\u662f\u6709\u5fc5\u8981\u63d0\u4e00\u4e0b\u7684\u3002\n\n## \u7b2c\u4e00\u90e8\u5206 OCR\u8bc6\u522b\u90e8\u5206\n\n \u57281.2.0\u5f00\u59cb\uff0cddddocr\u7684\u8bc6\u522b\u90e8\u5206\u8fdb\u884c\u4e86\u4e00\u6b21beta\u66f4\u65b0\uff0c\u4e3b\u8981\u66f4\u65b0\u5728\u4e8e\u7f51\u7edc\u7ed3\u6784\u4e3b\u4f53\u7684\u5347\u7ea7\uff0c\u5176\u8bad\u7ec3\u6570\u636e\u5e76\u6ca1\u6709\u53d1\u751f\u8fc7\u591a\u7684\u6539\u53d8\uff0c\u6240\u4ee5\u7406\u8bba\u4e0a\u5728\u8bc6\u522b\u7ed3\u679c\u4e0a\uff0c\u539f\u5148\u53ef\u80fd\u8bc6\u522b\u6548\u679c\u7684\u5f88\u597d\u7684\u56fe\u5f62\u57281.2.0\u4e0a\u6709\u4e00\u5c0f\u90e8\u5206\u6982\u7387\u4f1a\u6709\u4e00\u5b9a\u7a0b\u5ea6\u7684\u4e0b\u964d\uff0c\u4e5f\u6709\u53ef\u80fd\u539f\u672c\u8bc6\u522b\u4e0d\u597d\u7684\u56fe\u5f62\u57281.2.0\u4e4b\u540e\u6548\u679c\u5374\u53d8\u5f97\u7279\u522b\u597d\u3002\n \u6d4b\u8bd5\u4ee3\u7801\uff1a\n \n\n```python\nimport ddddocr\n\nocr = ddddocr.DdddOcr()\n\nwith open(\"test.jpg\", 'rb') as f:\n image = f.read()\n\nres = ocr.classification(image)\nprint(res)\n``` \n\u901a\u8fc7\u5728\u521d\u59cb\u5316ddddocr\u7684\u65f6\u5019\u4f7f\u7528beta\u53c2\u6570\u5373\u53ef\u5feb\u901f\u5207\u6362\u65b0\u6a21\u578b\n\n```python\nimport ddddocr\n\nocr = ddddocr.DdddOcr(beta=True)\n\nwith open(\"test.jpg\", 'rb') as f:\n image = f.read()\n\nres = ocr.classification(image)\nprint(res)\n``` \n\n OCR\u90e8\u5206\u5e94\u8be5\u5df2\u7ecf\u6709\u5f88\u591a\u4eba\u505a\u4e86\u6d4b\u8bd5\uff0c\u5728\u8fd9\u91cc\u5c31\u653e\u4e00\u90e8\u5206\u7f51\u53cb\u7684\u6d4b\u8bd5\u56fe\u7247\u3002\n\n ![Test](https://cdn.wenanzhe.com/img/20210715211733855.png) \n ![Test](https://cdn.wenanzhe.com/img/78b7f57d-371d-4b65-afb2-d19608ae1892.png) \n ![Test](https://cdn.wenanzhe.com/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20211226142305.png) \n ![Test](https://cdn.wenanzhe.com/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20211226142325.png) \n ![Test](https://cdn.wenanzhe.com/img/2AMLyA_fd83e1f1800e829033417ae6dd0e0ae0.png) \n ![Test](https://cdn.wenanzhe.com/img/aabd_181ae81dd5526b8b89f987d1179266ce.jpg) \n ![Test](https://cdn.wenanzhe.com/img/2bghz_b504e9f9de1ed7070102d21c6481e0cf.png) \n ![Test](https://cdn.wenanzhe.com/img/0000_z4ecc2p65rxc610x.jpg) \n ![Test](https://cdn.wenanzhe.com/img/2acd_0586b6b36858a4e8a9939db8a7ec07b7.jpg) \n ![Test](https://cdn.wenanzhe.com/img/2a8r_79074e311d573d31e1630978fe04b990.jpg) \n ![Test](https://cdn.wenanzhe.com/img/aftf_C2vHZlk8540y3qAmCM.bmp) \n ![Test](https://cdn.wenanzhe.com/img/%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE_20211226144057.png) \n\u7b49\u7b49\u66f4\u591a\u56fe\u7247\u7b49\u4f60\u6d4b\u8bd5\u54df~\n\n## \u7b2c\u4e8c\u90e8\u5206 \u76ee\u6807\u68c0\u6d4b\u90e8\u5206\n \u5728\u672c\u6b211.3.0\u7684\u66f4\u65b0\u4e2d\uff0c\u76ee\u6807\u68c0\u6d4b\u90e8\u5206\u9686\u91cd\u767b\u573a\uff01\n \u76ee\u6807\u68c0\u6d4b\u90e8\u5206\u540c\u6837\u4e5f\u662f\u7531\u5927\u91cf\u968f\u673a\u5408\u6210\u6570\u636e\u8bad\u7ec3\u800c\u6210\uff0c\u5bf9\u4e8e\u73b0\u5728\u5df2\u6709\u7684\u70b9\u9009\u9a8c\u8bc1\u7801\u56fe\u7247\u6216\u8005\u672a\u77e5\u7684\u9a8c\u8bc1\u7801\u56fe\u7247\u90fd\u6709\u53ef\u80fd\u5177\u5907\u4e00\u5b9a\u7684\u8bc6\u522b\u80fd\u529b\uff0c\u9002\u7528\u4e8e\u6587\u5b57\u70b9\u9009\u548c\u56fe\u6807\u70b9\u9009\u3002\n \u7b80\u5355\u6765\u8bf4\uff0c\u5bf9\u4e8e\u70b9\u9009\u7c7b\u7684\u9a8c\u8bc1\u7801\uff0c\u53ef\u4ee5\u5feb\u901f\u7684\u68c0\u6d4b\u51fa\u56fe\u7247\u4e0a\u7684\u6587\u5b57\u6216\u8005\u56fe\u6807\u3002\n \n\n```python\nimport ddddocr\nimport cv2\n\ndet = ddddocr.DdddOcr(det=True)\n\nwith open(\"test.jpg\", 'rb') as f:\n image = f.read()\n\nposes = det.detection(image)\nprint(poses)\n\nim = cv2.imread(\"test.jpg\")\n\nfor box in poses:\n x1, y1, x2, y2 = box\n im = cv2.rectangle(im, (x1, y1), (x2, y2), color=(0, 0, 255), thickness=2)\n\ncv2.imwrite(\"result.jpg\", im)\n\n```\n\n\u4e3e\u4e9b\u4f8b\u5b50\uff1a\n\n ![Test](https://cdn.wenanzhe.com/img/page1_1.jpg) \n ![Test](https://cdn.wenanzhe.com/img/page1_2.jpg) \n ![Test](https://cdn.wenanzhe.com/img/page1_3.jpg) \n ![Test](https://cdn.wenanzhe.com/img/page1_4.jpg) \n ![Test](https://cdn.wenanzhe.com/img/result.jpg) \n ![Test](https://cdn.wenanzhe.com/img/result2.jpg) \n ![Test](https://cdn.wenanzhe.com/img/result4.jpg) \n\n\u4ee5\u4e0a\u53ea\u662f\u76ee\u524d\u6211\u80fd\u627e\u5230\u7684\u70b9\u9009\u9a8c\u8bc1\u7801\u56fe\u7247\uff0c\u505a\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u6d4b\u8bd5\u3002\n\n# \u5b89\u88c5\n\n## \u73af\u5883\u652f\u6301\n\n`python <= 3.9`\n\n`Windows/Linux/Macos..`\n\n\u6682\u65f6\u4e0d\u652f\u6301Macbook M1(X)\uff0cM1(X)\u7528\u6237\u9700\u8981\u81ea\u5df1\u7f16\u8bd1onnxruntime\u624d\u53ef\u4ee5\u4f7f\u7528\n\n## \u5b89\u88c5\u547d\u4ee4\n\n`pip install ddddocr`\n\n\u4ee5\u4e0a\u547d\u4ee4\u5c06\u81ea\u52a8\u5b89\u88c5\u7b26\u5408\u81ea\u5df1\u7535\u8111\u73af\u5883\u7684\u6700\u65b0ddddocr\n\n## \u62d3\u5c55 \u4e00\u952e\u90e8\u7f72ddddocr api\uff0c\u652f\u6301docker\u90e8\u7f72\n\n[github](https://github.com/sml2h3/ocr_api_server) \n\n[gitee](https://gitee.com/fkgeek/ocr_api_server)\n\n## \u722c\u866b\u6846\u67b6\u63a8\u8350\n\n[feapder](https://github.com/Boris-code/feapder) \n\n[crawlab](https://github.com/crawlab-team/crawlab)\n\n# \u4ea4\u6d41\u7fa4 \uff08\u52a0\u6211\u597d\u53cb\u62c9\u4f60\u8fdb\u7fa4\uff09\n \n ![\u4e94\u7fa4\u94fe\u63a5](https://cdn.wenanzhe.com/img/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20220929101325.jpg!/scale/50)\n ![Test](https://cdn.wenanzhe.com/img/mmqrcode1640418911274.png!/scale/50) \n\n## Star \u5386\u53f2\n\n[![Star History Chart](https://api.star-history.com/svg?repos=sml2h3/ddddocr&type=Date)](https://star-history.com/#sml2h3/ddddocr&Date)\n",
"bugtrack_url": null,
"license": "",
"summary": "\u5e26\u5e26\u5f1f\u5f1fOCR",
"version": "1.4.8",
"project_urls": {
"Homepage": "https://github.com/sml2h3/ddddocr"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e617f30cbe7c1266bc1a95373bfbb433d8bcd99ed02981c3e64f32ea9b9105ae",
"md5": "4d02e05f5f88685cc1854443f2b670f5",
"sha256": "18f131e7769240cd295a61ac0d7a9de0435302836ed58d89829c2c84a561aab8"
},
"downloads": -1,
"filename": "ddddocrfix-1.4.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4d02e05f5f88685cc1854443f2b670f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.11",
"size": 75863791,
"upload_time": "2023-10-24T19:30:15",
"upload_time_iso_8601": "2023-10-24T19:30:15.816289Z",
"url": "https://files.pythonhosted.org/packages/e6/17/f30cbe7c1266bc1a95373bfbb433d8bcd99ed02981c3e64f32ea9b9105ae/ddddocrfix-1.4.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7302048e6b712ca786c05cf1764bfd8d3dddd045b2264d0fe5d7e4f4262c3a94",
"md5": "debb844be357f56a5c703e1bc913ddeb",
"sha256": "873e473c54aef945722157a5dc996d4228cba1742b80ba60560857228437b5a2"
},
"downloads": -1,
"filename": "ddddocrfix-1.4.8.tar.gz",
"has_sig": false,
"md5_digest": "debb844be357f56a5c703e1bc913ddeb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.11",
"size": 75816379,
"upload_time": "2023-10-24T19:30:41",
"upload_time_iso_8601": "2023-10-24T19:30:41.893303Z",
"url": "https://files.pythonhosted.org/packages/73/02/048e6b712ca786c05cf1764bfd8d3dddd045b2264d0fe5d7e4f4262c3a94/ddddocrfix-1.4.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-24 19:30:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sml2h3",
"github_project": "ddddocr",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ddddocrfix"
}