sml2h3 / ddddocr

带带弟弟 通用验证码识别OCR pypi版
https://ddddocr.com
MIT License
8.96k stars 1.64k forks source link

图片字母清晰且无干扰线的情况下识别率还是非常低 #104

Open onlyJinx opened 1 year ago

onlyJinx commented 1 year ago

如图,图片来源于rarbg的人机验证,我获取了十张图,只有第0,7,8三张图识别正确,其余都错了,想问下这种怎么提高识别率?

image

1 2 3 4 5 6 7 8 9 0 1 2

pheman commented 1 year ago

mark, 这些看起来很清晰的图片内有玄机,识别不了

marutichintan commented 1 year ago

Train model with at least 50K captcha, you will get 99% Acc.

onlyJinx commented 1 year ago

@pheman @marutichintan 用pytesseract的话正确率非常高,可能仅仅需要对验证码进行简单的OCR,但是ddddocr却做不到,或者说是ddddocr是对图片做了其他预处理再OCR反而产生了干扰?

jellyqwq commented 2 months ago

这个图片好像就是黑色作为目标字体, 可以给图像做下处理

import matplotlib.pyplot as plt
import numpy as np

image_path = '215980454-7bca3a8f-ba8d-4cd2-9343-ced18ded98be.png'
mat = plt.imread(image_path)
ax1 = plt.subplot(121)
ax1.imshow(mat)
display(mat.shape)
# display(mat2)
# 过滤非字符黑色像素
mat3 = np.where(mat[:, :, 1] > 0.6, 1, 0)
display(mat3.shape)
# display(mat3)
ax2 = plt.subplot(122)
ax2.imshow(mat3, cmap='gray')

可以得到如下的效果 image