hiroi-sora/Umi-OCR

v1.2.6初始化失败(系统语言不兼容问题)

andongya95 opened this issue · 11 comments

image

e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m
e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m
0 : Active code page: 65001

1 : OCR init completed.

初始化成功!
e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m
e[37m---    fused 0 elementwise_add with relu activatione[0m
e[37m---    fused 0 elementwise_add with tanh activatione[0m
e[37m---    fused 0 elementwise_add with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_add with swish activatione[0m
e[37m---    fused 0 elementwise_add with hardswish activatione[0m
e[37m---    fused 0 elementwise_add with sqrt activatione[0m
e[37m---    fused 0 elementwise_add with abs activatione[0m
e[37m---    fused 0 elementwise_add with clip activatione[0m
e[37m---    fused 0 elementwise_add with gelu activatione[0m
e[37m---    fused 0 elementwise_add with relu6 activatione[0m
e[37m---    fused 0 elementwise_add with sigmoid activatione[0m
e[37m---    fused 0 elementwise_sub with relu activatione[0m
e[37m---    fused 0 elementwise_sub with tanh activatione[0m
e[37m---    fused 0 elementwise_sub with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_sub with swish activatione[0m
e[37m---    fused 0 elementwise_sub with hardswish activatione[0m
e[37m---    fused 0 elementwise_sub with sqrt activatione[0m
e[37m---    fused 0 elementwise_sub with abs activatione[0m
e[37m---    fused 0 elementwise_sub with clip activatione[0m
e[37m---    fused 0 elementwise_sub with gelu activatione[0m
e[37m---    fused 0 elementwise_sub with relu6 activatione[0m
e[37m---    fused 0 elementwise_sub with sigmoid activatione[0m
e[37m---    fused 0 elementwise_mul with relu activatione[0m
e[37m---    fused 0 elementwise_mul with tanh activatione[0m
e[37m---    fused 0 elementwise_mul with leaky_relu activatione[0m
e[37m---    fused 0 elementwise_mul with swish activatione[0m
e[37m---    fused 0 elementwise_mul with hardswish activatione[0m
e[37m---    fused 0 elementwise_mul with sqrt activatione[0m
e[37m---    fused 0 elementwise_mul with abs activatione[0m
e[37m---    fused 0 elementwise_mul with clip activatione[0m
e[37m---    fused 0 elementwise_mul with gelu activatione[0m
e[37m---    fused 0 elementwise_mul with relu6 activatione[0m
e[37m---    fused 0 elementwise_mul with sigmoid activatione[0m
Active code page: 65001

OCR init completed.

初始化OCR成功,进程号为12148

Originally posted by @andongya95 in #9 (comment)

@hiroi-sora
您可以把之前的issue先close了 我们转到这个来解决

请试试:打开cmd,

cd /d PaddleOCR-json所在文件夹
PaddleOCR_json.exe

输出 OCR init completed.则正常,按ctrl+c终止它。接下来检查下是否配置文件的问题:

PaddleOCR_json.exe --config_path=PaddleOCR_json_config_简体中文.txt

如果这个也没问题,那就把调用 callingOCR.py
ocr = CallingOCR('填入PaddleOCR_json.exe的路径') 改成:
ocr = CallingOCR('填入PaddleOCR_json.exe的路径' , 'PaddleOCR_json_config_简体中文.txt')

@hiroi-sora 请问有没有可能是因为我用的系统语言是英文 所以没有读取config成功?我在cmd里粘贴config后得到的是
image
PaddleOCR_json.exe --config_path=PaddleOCR_json_config_简体中 文.txt [ERROR] config path not exist! config_dir: PaddleOCR_json_config_????.txt [ERROR] Use det, need {--det_model_dir}. OCR exit.
‘中’ ‘文’ 之间有空格 我不确定是为什么但是我试了几次都是这样

是的,路径错误,导致配置文件txt未注入。tools.cpp#L208 。估计跟系统语言有关。

尝试:将 PaddleOCR_json_config_简体中文.txt 文件名中的汉字去除,比如改成 PaddleOCR_json_config_zh-CN.txt
cmd运行 PaddleOCR_json.exe --config_path=PaddleOCR_json_config_zh-CN.txt

如果这个OK,则:
打开上一层文件夹的 Umi-OCR_config.json ,将其中 ocrConfig 下的 "path" 也改成这个。
打开Umi-OCR,看看能否正常工作

@hiroi-sora 现在可以正常工作了,谢谢大大!

那么,Umi-OCR导入中文路径的图片能识别出结果吗?

@hiroi-sora 哈哈哈 确实不可以
拖拽无法读取文件
通过浏览读取后可以进行任务,但是输出结果是

任务开始时间:2022-09-08 22:23:42


≦ 中文测试.png ≧
识别失败,错误码:200
错误信息:Image path not exist. Path:"...\Umi-OCR.v1.2.6\ÖÐÎIJâÊÔ.png"


---
任务结束时间:2022-09-08 22:23:43

试下测试版

https://wwn.lanzoul.com/b037embad
密码:1111

下载exe,替换掉原来的

有新的报错
image

其他问题还是一样 错误信息变成了

≦ 中文测试.png ≧
识别失败,错误码:200
错误信息:Image path not exist. Path:"C:\\...\\Umi-OCR.v1.2.6\\????.png"

嗯,目前OCR引擎的cv::imread只能读入与系统地区对应编码的路径。而你的系统地区编码是 西欧cp1252 ,这套编码本身不含中文,所以引擎无法在这种系统环境下读取中文路径。

开启windows的UTF-8全球语言支持应该可以解决这个问题,允许读入 含超出cp1252编码的字符 的路径。
image

未来我也许会继续优化引擎,改用 cv::imdecode 等方式载入图片,从根源上解决这个问题,允许原生cp1252等多种系统语言设置。

楼主你好,经过修改引擎,这个问题应该已经从根源上解决了。

测试环境为cp1252西欧语言,未开启UTF-8全球语言支持。如下图,左为旧版引擎,无法识别中文路径。右为新版,可以识别。

chcp 中文路径OKK2!
chcp 中文路径OKK!

(但含emoji表情的路径依然无法识别,软件的拖入功能也用不了,只能通过浏览按钮导入图片。)

可以下载这个exe文件,替换原来的。PaddleOCR_json v1.2.1 alpha 1.zip 。或者在楼上的蓝奏云链接下载。