How can I display the predicted labels in command window or in a text file.

조회 수: 3 (최근 30일)
I have trained two models: Model A is trained on 34 classes of words, and Model B is Trained on 14 classes of alphanumeric characters. I should load both models at the same time in order to recognize the word and alphanumeric characters series from vehicle license plate, and then display the predicted lables into command window or write the results to text file. Everthing work well until classification of each word and characters, but I don't know how to dispaly the classification result into text file or display the results into command window. Therefore, I am in dire need of your help. Thank you very much all of you.
  댓글 수: 7
Walter Roberson
Walter Roberson 2021년 8월 10일
The part of the code that caused 'HRT 875326 %' to be displayed: show us that.
The part of the code that cause 'SEVEN 99.9979 %' to be displayed: show us that.
Javid Hamdard
Javid Hamdard 2021년 8월 11일
편집: Javid Hamdard 2021년 8월 11일
load model_A
filePattern = fullfile(myFolder, '*.jpg');
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
%reading it in as an image array
imageArray = imread(fullFileName);
I2= imresize(imageArray,[51 21],'nearest');
[YPredA,scoresA] = classify(netA,I2);
scoresA = max(double(scoresA*100));
for j = 1 : length(theFiles)
end
figure(),imshow(imageArray);
title(join([string(YPredA),'' ,scoresA ,'%']))
%----------------------------------------------------
%this part reading province (HRT).
load model_B
I2= imresize(im,[29 64],'nearest');
[YPred,scores] = classify(net,I2);
scores = max(double(scores*100));
figure (10),imshow(im);
title(join([string(YPred),'' ,scores ,'%']))
%-----------------------------------------------------------------------------------------
I would like to display the result to a text file or command window like "HRT77188SH"

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 8월 10일
fprintf() or fwrite() to save the information into a file.
For display purposes, you will may need sprintf() or compose() or strjoin() or the [] (horzcat) operator.
  댓글 수: 3
Javid Hamdard
Javid Hamdard 2021년 8월 11일
Dear @Walter Roberson, could you please recheck the code? I tried the code but I got error message as seen in picture. I tried my best but unable to resolve that. I appreciate your help so much.
Walter Roberson
Walter Roberson 2021년 8월 11일
I looked back through my code and it looks okay.
Notice that I have the assignment statment
predictions_A = cell(1,nfiles);
so even if the number of files turns out to be 0, the variable should be defined.
Please post your current version of the code.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by