Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

中文OCR准确率很低 #18

Open
linchuanXu opened this issue Nov 4, 2023 · 8 comments
Open

中文OCR准确率很低 #18

linchuanXu opened this issue Nov 4, 2023 · 8 comments
Labels
enhancement New feature or request P2 one day it will be done

Comments

@linchuanXu
Copy link

我单独调用了Windows.Media.Ocr.Cli.exe来进行OCR测试,但效果非常差。这也导致了分词和搜索的效果较差,在我看来,这是整个软件的一个明显短板。

在源码中,还有第二种OCR方式:OCR文本-chineseOCRlite。我想知道为什么不再使用这个配置?

我希望能够自由切换OCR引擎,并增加一个OCR测试页面,有更好的ocr效果。

如果ocr不准确的话,现在我搜索的效果都很差,后面的LLM等创意都没有意义了

@jpswing jpswing added enhancement New feature or request help wanted Extra attention is needed labels Nov 4, 2023
@linchuanXu
Copy link
Author

https://sspai.com/prime/story/rewind-diy

这个哥们也在复现rewind,用的ocr技术是

识别文字和压缩截图尺寸:使用 OCRmyPDF
少数派过去曾有一篇文章介绍如何通过 OCRmyPDF 在扫描版 PDF 中检索文字。本文沿用那篇文章所介绍的用法,唯一多用到的选项是 --optimize 3;根据文档,这是指对图片进行比较激进的有损压缩,特别适合截图留档这种「能看清就行」的场景。

@Antonoko
Copy link
Collaborator

Antonoko commented Nov 4, 2023

目前禁用了 chineseOCRlite 的主要原因是效能比较糟糕(需要消耗更多的计算资源、时间也相对慢一些)、且同输入图像准确率和系统自带相比也接近。在同15分钟视频切片下,chineseOCRliteOCR 耗时约为8分钟,Windows.Media.Ocr.Cli大概为3分钟不到。

准确率较低的原因可能是由于录制的规格分辨率比较低,导致基于此画面的OCR结果准确率也低,可以参见这个讨论:
#9 (comment)

(因为我屏幕的缩放开得比较大,所以没有太注意到准确率的问题……下个版本中我们会加上关闭压缩分辨率策略的选项🤯,通过录制原始的分辨率画面,应该可以对 OCR 准确度有较大的提升

OCRmyPDF 我们也瞅瞅看!未来也可能会加上 paddleOCR 等方式选项进行 benchmark 供选择🤔

@Antonoko
Copy link
Collaborator

Antonoko commented Nov 4, 2023

todo:
[x] 添加取消屏幕录制时缩放的策略选项,允许高分屏用户录制完整分辨率的视频文件;
[ ] 暴露 OCR 接口,添加更多 OCR 选型、允许用户添加自定义的 OCR 引擎,添加与完善 benchmark 测试对比工具;

@linchuanXu
Copy link
Author

我改本地代码调用了chineseOCRlite,删除数据库全部ocr,效果好了很多! 字小的,模糊的可以考虑这个。

用chineseOCRlite的时候,在crnn.py的25行加入,可以避免输出大量onnx的警告:
rt.set_default_logger_severity(3)

@linchuanXu
Copy link
Author

https://cnocr.readthedocs.io/zh/latest/models/

cnocr 我看了一下,很灵活,cpu、gpu、模型都可以配置,效果很好。但是配环境很麻烦。

最好还是能暴露接口

@Antonoko Antonoko added P2 one day it will be done and removed help wanted Extra attention is needed labels Nov 19, 2023
@ASC8384
Copy link
Collaborator

ASC8384 commented Dec 7, 2023

业内(做OCR的)朋友推荐了PaddleOCREasyOCR
实测chineseOCRlite的准确率比Windows的高多了。
感觉可以考虑加入GPU推理。

@B1lli
Copy link

B1lli commented Jan 2, 2024

image
尝试了一下调用微信自带的OCR来替换Windows.Media.Ocr.Cli,精度提升非常大,性能还没测试,也没在前端做按钮,更新刚刚推送到我fork的一个分支(https://github.com/B1lli/Windrecorder/tree/dev ),如果 @Antonoko 愿意的话,可以加在前端页面作为可选的替换OCR选择

@Antonoko
Copy link
Collaborator

Antonoko commented Jan 3, 2024

image 尝试了一下调用微信自带的OCR来替换Windows.Media.Ocr.Cli,精度提升非常大,性能还没测试,也没在前端做按钮,更新刚刚推送到我fork的一个分支(https://github.com/B1lli/Windrecorder/tree/dev ),如果 @Antonoko 愿意的话,可以加在前端页面作为可选的替换OCR选择

棒!大概 0.2.0 版本前会添加自定义 ocr 接口的配置,这个 ocr 方式可以作为一个备选项加入~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 one day it will be done
Projects
None yet
Development

No branches or pull requests

5 participants