Please help me to understand the PCA usage.
1 回表示 (過去 30 日間)
古いコメントを表示
I want to use HOG for feature extraction and want to apply PCA for dimension reduction ,I found this code but did not understand the PCA function usage. Please make me understand how PCA function is used and what results its providing or Is it used in the code in correct way, If not please help me to make it correct.
% Features Extraction of Face based on HOG
clear;
training=imageSet('Dataset\','recursive'); % folder name of the database
K=1;
for i=1:size(training,2 )
for j=1:training(i).Count
Face=read(training(i),j);
Face=imresize(Face, [48 48]);
%Face=rgb2gray(Face); %If color images
Face = pca(double(Face));
HOG_Features= extractHOGFeatures(Face);
trainingFeatures(K,:)=single([HOG_Features]);
traininglabel{K}=training(i).Description;
K=K+1;
end
persons{i}=training(i).Description;
end
traininglabel=traininglabel';
csvwrite('Test.csv', trainingFeatures)
3 件のコメント
Adam
2018 年 6 月 8 日
I have never worked with HOG features, but if the PCA is being done before the HOG then in this case it is because whoever wrote the code wishes to reduce the dimensionality of their original data before extracting features from the resultant dimension-reduced data. This will remove redundancy that may be present in the original data and can cause feature extraction to either be inefficient or simply not work as well.
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!