带带弟弟OCR
Project description
带带弟弟OCR通用验证码识别SDK免费开源版
2021/12/24重大更新,ddddocr现在支持通用目标检测啦
交流群(找对象,在苏州,dd群主)
环境要求
python <= 3.9
Windows/Linux/Macos..
暂时不支持Macbook M1(X),M1(X)用户需要自己编译onnxruntime才可以使用
调用方法
pip install ddddocr
1、文字识别模式
import ddddocr
ocr = ddddocr.DdddOcr()
with open('test.png', 'rb') as f:
img_bytes = f.read()
res = ocr.classification(img_bytes=img_bytes)
print(res)
或者传入图片 base64 编码值(不包含图片头)
import ddddocr
ocr = ddddocr.DdddOcr()
img_base64 = 'img_base64' # 示例
res = ocr.classification(img_base64=img_base64)
print(res)
2、目标检测模式
import ddddocr
det = ddddocr.DdddOcr(det=True)
with open('test.jpg', 'rb') as f:
img_bytes = f.read()
res = det.detection(img_bytes)
print(res)
3、参数说明
DdddOcr 接受三个参数
| 参数名 | 默认值 | 说明 |
|---|---|---|
| det | False | Bool 默认为识别文字模式,为True则开启目标检测模式 |
| use_gpu | False | Bool 是否使用gpu进行推理,如果该值为False则device_id不生效 |
| device_id | 0 | int cuda设备号,目前仅支持单张显卡 |
classification
必须det参数为False后才可使用
| 参数名 | 默认值 | 说明 |
|---|---|---|
| img_bytes | None | bytes 图片的bytes格式 |
| img_base64 | None | 图片的 base64 编码值(不包含图片头) |
detection
必须det参数为False后才可使用
| 参数名 | 默认值 | 说明 |
|---|---|---|
| img_bytes | None | bytes 图片的bytes格式 |
| img_base64 | None | 图片的 base64 编码值(不包含图片头) |
说明,当
img_bytes和img_base64都存在时,优先使用img_bytes
如果使用GPU,需要自行安装cuda和cudnn,并在安装完ddddocr时执行
pip uninstall onnxrumtime
然后手动执行pip install onnxruntime-gpu
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ddddocr-1.3.0.tar.gz.
File metadata
- Download URL: ddddocr-1.3.0.tar.gz
- Upload date:
- Size: 69.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
709ab1f220cd3358fa69069310c2135831fdb6cd39782bb415c645bce9e169f8
|
|
| MD5 |
d04ce27e668a9e0ece9f6941d4c0fd15
|
|
| BLAKE2b-256 |
88a4fe4414f2094019d91f94ce0586775c92e88d62285b2f321dcf86c35d6af4
|
File details
Details for the file ddddocr-1.3.0-py3-none-any.whl.
File metadata
- Download URL: ddddocr-1.3.0-py3-none-any.whl
- Upload date:
- Size: 69.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4d84ca89614234392e25ef407a0f2841560977e172bc6ebfa7e391e3330df42
|
|
| MD5 |
f5af0aa7d18657cb3b6c83b49b7e6e57
|
|
| BLAKE2b-256 |
cfd5c9e6bc5d1eae06190734e92804837eaed1dc3c04def4413fdd6e2ec089bd
|