Can I train a symbol as special character with ocr?

조회 수: 1 (최근 30일)
Pedro Marques
Pedro Marques 2021년 1월 27일
편집: Walter Roberson 2024년 11월 25일
Hi there,
I'm trying to recognize a dial symbol as a special character so I can locate it when I use the ocr function.
However, is not recognizing that symbol at all.
This is my image after training the model. I wanted to locate the green symbol.
Is there another way to do this?
Do you have any suggestion @Image Analyst?
Best

답변 (1개)

Shashank Gupta
Shashank Gupta 2021년 2월 3일
Hi Pedro,
I think you need to train an ocr to compensate for the symbol. you can refer to ocrTrain App in MATLAB. you manually have to collect enough data and train a classifier. After training you can export the file and use it in typical ocr workflow.
I hope this helps.
Cheers.
  댓글 수: 1
Frank
Frank 2024년 11월 25일
편집: Walter Roberson 2024년 11월 25일
Hi Shashank,
I am new on matlab ocr ... I need the character "§" in base model "german" ...
I tried to extend model "german" by "§" (which is included in the "english" model, but not in german model).
I have labeled one image with two character symbols and another one with three symbols of "§", each is 25 x 37 pixels black on wthite background with good contrast.
I tried to train base model "german" (often called cdsTrain) with the 3-symbol image and "cdsValidation" with the 2-symbol image by using trainOCR-function. See gTruth-object attached ...
But the result is matlab stops (emdless loop) and must be killed ... See atached screenshot.
Do I need more training data perhaps? What went wrong with my approach?
Is there a possibility to merge "german" and "english" models to have the "§" from "english" also for german text ...?
Here is the simple code, I tried:
labelName = "Paragraph";
attributeName = "Paragr";
[imds,boxds,txtds] = ocrTrainingData(gTruth,labelName,attributeName);
cds = combine(imds,boxds,txtds);
outputDir = "C:\Data\Fuzzylogic\Mathlab\Projekte\OCR\OCR-Test\Train_Paragraph\OCRModel";
if ~exist(outputDir, "dir")
mkdir(outputDir);
end
checkpointsDir = "C:\Data\Fuzzylogic\Mathlab\Projekte\OCR\OCR-Test\Train_Paragraph\Checkpoints";
if ~exist(checkpointsDir, "dir")
mkdir(checkpointsDir);
end
cdsTrain = subset(cds, 1); % 3 symbols at one image
cdsValidation = subset(cds, 2); % 2 symbols at another image
ocrOptions = ocrTrainingOptions(GradientDecayFactor=0.9, ...
MaxEpochs=20, VerboseFrequency=160, CharacterSetSource="base-model", ...
CheckpointPath=checkpointsDir, ValidationData=cdsValidation, ...
OutputLocation=outputDir);
outputModelName = "paragraph";
baseModel = "german";
outputModel = trainOCR(cdsTrain, outputModelName, baseModel, ocrOptions);
Thank you very much!
Frank from Berlin

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Language Support에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by