Skip to content

Commit

Permalink
ddddocr模型升级
Browse files Browse the repository at this point in the history
  • Loading branch information
sml2h3 committed Dec 21, 2021
1 parent 6b3d131 commit 6f8d5b1
Show file tree
Hide file tree
Showing 7 changed files with 540 additions and 447 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@

`pip install ddddocr`

```
```python
import ddddocr
ocr = ddddocr.DdddOcr()
with open('test.png', 'rb') as f:
img_bytes = f.read()
res = ocr.classification(img_bytes)
res = ocr.classification(img_bytes=img_bytes)
print(res)
```
或者传入图片 base64 编码值(不包含图片头)
```python
import ddddocr
ocr = ddddocr.DdddOcr()
img_base64 = 'img_base64' # 示例
res = ocr.classification(img_base64=img_base64)
print(res)
```

Expand All @@ -44,4 +47,7 @@ print(res)

| 参数名 | 默认值 | 说明 |
| ---- | ---- | ---- |
| img | 0 | bytes 图片的bytes格式 |
| img_bytes | None | bytes 图片的bytes格式 |
| img_base64 | None | 图片的 base64 编码值(不包含图片头) |

> 说明,当 `img_bytes``img_base64` 都存在时,优先使用 `img_bytes`
11 changes: 9 additions & 2 deletions ddddocr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

# 带带弟弟OCR通用验证码识别SDK免费开源版

## 交流群(找对象,在苏州,dd群主)


![qrcode.png](http://cdn.wenanzhe.com/Dingtalk_20211220105723.jpg!/scale/50)

## 环境要求

`python >= 3.8`

`Windows/Linux/Macox..`
`Windows/Linux..`

## 调用方法

Expand Down Expand Up @@ -45,4 +50,6 @@ print(res)
| img_bytes | None | bytes 图片的bytes格式 |
| img_base64 | None | 图片的 base64 编码值(不包含图片头) |

> 说明,当 `img_bytes``img_base64` 都存在时,优先使用 `img_bytes`
> 说明,当 `img_bytes``img_base64` 都存在时,优先使用 `img_bytes`
> 如果使用GPU,需要自行安装cuda和cudnn,并在安装完ddddocr时执行 <br>`pip uninstall onnxrumtime`<br>然后手动执行<br>`pip install onnxruntime-gpu`
947 changes: 514 additions & 433 deletions ddddocr/__init__.py

Large diffs are not rendered by default.

Binary file modified ddddocr/common.onnx
Binary file not shown.
1 change: 0 additions & 1 deletion ddddocr/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
torchvision
onnxruntime
Pillow
numpy
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setup(
name="ddddocr",
version="1.0.6",
version="1.2.0",
author="sml2h3",
description="带带弟弟OCR",
long_description=long_description,
Expand All @@ -27,7 +27,7 @@
"Operating System :: OS Independent",
],
install_requires=['numpy', 'onnxruntime', 'Pillow'],
python_requires='>=3.8',
python_requires='<3.10',
include_package_data=True,
install_package_data=True,
)
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ocr = ddddocr.DdddOcr()

with open('test.png', 'rb') as f:
with open('test.jpg', 'rb') as f:
img_bytes = f.read()

res = ocr.classification(img_bytes)
Expand Down

0 comments on commit 6f8d5b1

Please sign in to comment.