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

图片请求识别接口,参数携带的是返回 text,实际返回的是 Unicode编码 #684

Open
1 task done
LiRongming321 opened this issue Oct 11, 2024 · 1 comment

Comments

@LiRongming321
Copy link

Issues

  • I have browsed through the Issues. 我已浏览过Issues,确定没有重复提问。

Umi-OCR version 程序版本

2.1.3

Windows version 系统版本

win10

OCR plugins Used 使用的OCR插件

PaddleOCR

Reproduction steps 复现步骤

接口:http://127.0.0.1:1224/api/ocr
"options": {
"ocr.language": "models/config_chinese.txt",
"ocr.cls": false,
"ocr.limit_side_len": 960,
"tbpu.parser": "multi_para",
"data.format": "text"
}
}
如果识别文本中有数字,返回的是数字,返回值中既有Umicode,也有数字,不是存文本

Problem screenshots or related files (optional) 问题截图或相关文件(可选)

No response

@hiroi-sora
Copy link
Owner

你好,可能你的理解稍有误差。

"data.format" 控制返回值的 数据类型 。如果为 dict ,那么返回值中 ["data"] 是字典。如果为 text ,那么 ["data"] 是字符串。

不管数据类型是text还是dict,它们都是 json中的一个元素 。而 json 本身是用 Unicode 编码的,即text或者dict中的文本都是Unicode编码。

实际上,文本编码对于你应该是透明的。只要你用任何编程语言中的json解析器去导入json,解析器都会自动将unicode转换为人类可读的编码。除非你直接阅读原始json结果,或者用自己开发的json解析器,才会见到unicode。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants