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

是否可以加载自己用PaddleOCR训练的recognition模型? #103

Open
Rich-Burn opened this issue Jul 19, 2024 · 5 comments
Open

是否可以加载自己用PaddleOCR训练的recognition模型? #103

Rich-Burn opened this issue Jul 19, 2024 · 5 comments

Comments

@Rich-Burn
Copy link

Feature request type

sample request

Is your feature request related to a problem? Please describe

请问本库是否支持加载自己用PaddleOCR训练的recognition模型?

Describe the solution you'd like

请问是否有调用自己用PaddleOCR训练的recognition模型的示例?

Describe alternatives you've considered

No response

Additional context

No response

@sdcb
Copy link
Owner

sdcb commented Jul 25, 2024

use this:

public static RecognizationModel FromDirectory(string directoryPath, string labelPath, ModelVersion version) => new FileRecognizationModel(directoryPath, labelPath, version);

@deyinliwork
Copy link

deyinliwork commented Oct 21, 2024

@sdcb 你好:

想请教一下参数labelPath如何确定?PP-OCR模型库中下载到的推理模型中并不存在label/dict文件,训练模型同样如此

根据我目前了解的信息,label/dict文件生成并存在于训练阶段,且模型与label/dict文件成对应关系。

是否意味着:如果要使用自定义的OCR推理模型,则必须找到该模型最后一次被训练/微调时使用的label/dict文件?

use this:

public static RecognizationModel FromDirectory(string directoryPath, string labelPath, ModelVersion version) => new FileRecognizationModel(directoryPath, labelPath, version);

@sdcb
Copy link
Owner

sdcb commented Oct 21, 2024

@n0099
Copy link
Contributor

n0099 commented Oct 21, 2024

#82 (comment)

@deyinliwork
Copy link

https://github.com/PaddlePaddle/PaddleOCR/tree/main/ppocr/utils/dict

@sdcb 感谢,我在它的上级目录找到的en_dict.txt可以用于运行en_PP-OCRv4_rec模型。

本仓库en_dict.txt内容相同,且与LocalRecognizationMode.EnglishV4方案相同

此目录下的en_dict.txt 没有标点符号,识别时报错:System.Exception:“Unable to GetLabelByIndex: index 93 out of range 63, OCR model or labels not matched?”

@n0099 感谢你的解答,模型在训练时及训练后与字典文件强绑定,推理时输出的是字符在训练时字典文件中的索引,因此需要正确的字典文件帮助将索引转为字符。

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

4 participants