PaddleSharp icon indicating copy to clipboard operation
PaddleSharp copied to clipboard

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

Open Rich-Burn opened this issue 1 year ago • 5 comments

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

Rich-Burn avatar Jul 19 '24 03:07 Rich-Burn

use this: https://github.com/sdcb/PaddleSharp/blob/475ed956cf4da1b4bbfb09c6f0b8246e6703f6fb/src/Sdcb.PaddleOCR/Models/RecognizationModel.cs#L88

sdcb avatar Jul 25 '24 08:07 sdcb

@sdcb 你好:

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

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

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

use this:

https://github.com/sdcb/PaddleSharp/blob/475ed956cf4da1b4bbfb09c6f0b8246e6703f6fb/src/Sdcb.PaddleOCR/Models/RecognizationModel.cs#L88

deyinliwork avatar Oct 21 '24 05:10 deyinliwork

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

sdcb avatar Oct 21 '24 05:10 sdcb

https://github.com/sdcb/PaddleSharp/issues/82#issuecomment-1902263902

n0099 avatar Oct 21 '24 05:10 n0099

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

deyinliwork avatar Oct 21 '24 06:10 deyinliwork