如何使Keras-Or默认模型仅识别数字?
我使用Python和Keras OCR。 我希望Keras只识别数字,所以在管道中我这样做。
recognizer = keras_ocr.recognition.Recognizer(alphabet="0123456789")
pipeline = keras_ocr.pipeline.Pipeline(recognizer=recognizer)
但是,它没有将字母转向数字并提高诸如Tesseract白名单之类的识别质量,而是发生了。
因此,这些数字根本无法识别。
使用默认字母,结果更好。但是有些数字与字母混淆。但是,将字母更改为“替换(“ O”,“ 0”)”之类的数字是一个坏主意。
识别功能简单而复制:)
_image = keras_ocr.tools.read(_path)
plt.figure(figsize=(10, 20))
plt.imshow(_image)
prediction = pipeline.recognize([_image])[0]
fig, axs = plt.subplots(1, figsize=(10, 20))
keras_ocr.tools.drawAnnotations(image=_image, predictions=prediction, ax=axs)
plt.show()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有发现比使用Keras OCR工具学习模型更多的简单方法。
但是,用于合成数据的文本生成器使用具有想法,含义的书籍,期刊或SMTH的文本(我不知道用英语说:))。因此,数字很少,有时如果您的字母为“ 0123456789”,生成器会返回空字符串。因此,我写了自己的发电机,只能用数字制作字符串。
https:////keras-ocr.readthedocs.io oredocs.ioo of示例/end_to_end_training.html
I haven't found more simple way, than learn model using keras ocr tools.
However text generator for synthetic data uses texts from books, journals or smth that has an idea, meaning (i don't know to say it in english:)). So there are few numbers and sometimes if your alphabet is "0123456789", generator returns empty string. So I've written my own generator, that makes string only with digits.
https://keras-ocr.readthedocs.io/en/latest/examples/end_to_end_training.html
https://colab.research.google.com/drive/1PxxXyH3XaBoTgxKIoC9dKIRo4wUo-QDg#scrollTo=I7SF5VeoLulc