finding accuracy for charector recognition using knn

2 次查看(过去 30 天)
faceClassifier = fitcknn(trainingFeatures,trainingLabel);
%testing
kk=1;
for charector=1:47
for j = 1:test(charector).Count
queryImage = read(test(charector),j);
queryFeatures = extractHOGFeatures(queryImage);
actualLabel = predict(faceClassifier,queryFeatures);
actualLabel=char(actualLabel);
predictedLabel=test(charector).Description;
al(kk)=actualLabel(2:length(actualLabel));//error:Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
pl(kk)=predictedLabel(2:length(predictedLabel)) ;
iam doing charector recognition using knn, i used the above code for extracting features and classification ,when i tried to find out the accuracy of the classification i got an error(Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.) in one of the statement like above mentioned.Actually i have used 47 charectors that includes 47 folders one for each charector that is named charector1......charector47.Each folder contains around 200 different forms of writting.Hope anybody can suggest optimal solution that can solve the error

回答(1 个)

Harsha Priya Daggubati
Hi,
The error you mentioned is due to assignment you are trying to make. To be clear:
kk=1;
a= 1:10
al(1) = a(2:end);
The above code gives the same error too!
Assuming you wish to store all the actual and predicted labels, you can use cell array and store the values by appending to al in each iteration.
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Pattern Recognition and Classification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by