フィルターのクリア

How does a trained classifier label a picture by its own?

2 ビュー (過去 30 日間)
Lester Lim
Lester Lim 2013 年 1 月 28 日
How does a trained classifier label a picture by its own? Let's say I have a training set, train it using the LDA classifier and it shows me the accuracy/similarities. How do I use this to apply on the picture I want to label?

採用された回答

Image Analyst
Image Analyst 2013 年 1 月 28 日
You have to do that in separate steps afterwards. Your classifier should give you some kinds of instructions for classifying pixels, for example, pixels darker than 130 are background, and pixels brighter than 130 are foreground.
  8 件のコメント
Lester Lim
Lester Lim 2013 年 1 月 29 日
Thanks for the guidance, Im trying it now and might get back to you later.
Lester Lim
Lester Lim 2013 年 1 月 29 日
編集済み: Lester Lim 2013 年 1 月 29 日
Yup, calculated it to be 100+ GB. Pardon for being a newbie at this, but by running separately, do you mean this? Or should I put in as another GUI button?
data = importdata('Trial data4.mat');
features=data(:,1:end-1); %split data without labels
lable=data(:,end); %get the labels
trainSamples = im2double(features);%training samples
trainClasses = im2double(lable);%training labels
testSamples = im2double(features);%test samples
lableimage = reshape(handles.lableimage,[],1);
testClasses = im2double(handles.lableimage);%test labels
disp('GUI: trainSamples is')
class(trainSamples)
disp('GUI: testSamples is')
class(testSamples)
mLDA = LDA(trainSamples, trainClasses');
mLDA.Compute();
clear data
transformedTrainSamples = mLDA.Transform(trainSamples, 1);
transformedTestSamples = mLDA.Transform(testSamples, 1);
calculatedClasses = knnclassify(transformedTestSamples, transformedTrainSamples, trainClasses);
simmilarity = [];
for i = 1 : 1 : length(testClasses)
similarity(i) = (testClasses(i)==calculatedClasses(i));
end
accuracy = sum(similarity) / length(testClasses);
fprintf('Testing: Accuracy is: %f %%\n', accuracy*100);
data = importdata('Trial data5.mat');
features=data(:,1:end-1); %split data without labels
lable=data(:,end); %get the labels
trainSamples = im2double(features);%training samples
trainClasses = im2double(lable);%training labels
testSamples = im2double(features);%test samples
lableimage = reshape(handles.lableimage,[],1);
testClasses = im2double(handles.lableimage);%test labels
disp('GUI: trainSamples is')
class(trainSamples)
disp('GUI: testSamples is')
class(testSamples)
mLDA = LDA(trainSamples, trainClasses');
mLDA.Compute();
clear data
transformedTrainSamples = mLDA.Transform(trainSamples, 1);
transformedTestSamples = mLDA.Transform(testSamples, 1);
calculatedClasses = knnclassify(transformedTestSamples, transformedTrainSamples, trainClasses);
simmilarity = [];
for i = 1 : 1 : length(testClasses)
similarity(i) = (testClasses(i)==calculatedClasses(i));
end
accuracy = sum(similarity) / length(testClasses);
fprintf('Testing: Accuracy is: %f %%\n', accuracy*100);
guidata(hObject, handles);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by