laplacian score for blocks of image

1 Ansicht (letzte 30 Tage)
Im@
Im@ am 11 Mai 2015
I am working on feature extraction of faces image. I have to select the most relevant features by assigning a score for each feature then rearrange them according to their importance. I am trying to adapt the code in order to give a laplacian score for each block of image. and then rearrage these blocks according to their importance and select the most relevant blocks. So how can I adapt this code?!
here is the code:
% ====================================================== % % Feature selection based on supervised Laplacian scores % % Framework numero 1 % ====================================================== %
x=TrainDBN; y=TestDBN; % % %%==========parametrage==========%% AvecPCA=1; % Si 1 alors Appliquer PCA sur la base d'apprentissage PCA_Ratio=95; ClassifClassique=1; % Si 1 faire la classification classique % % qui prend en compte tous les dimensions % PourcentagePixels=20;
K_KNN=1; K_heterogenes=3; K_homogenes=5;
%%============PCA(Princomp)===============%%
if AvecPCA==1 [x,y]=mypca(x,y,PCA_Ratio); end
% Calculer le Kernel Heat disp('Computing the distances ...') [N M]=size(x.mat); % DXiXj est une matrice contenant les distances entre XI et Xj DXiXj=zeros(N);
SommedXi_Xj=0; for i=1:N for j=1:N dXi_Xj=(norm(x.mat(i,:)-x.mat(j,:)))^2; DXiXj(i,j)=dXi_Xj; SommedXi_Xj=SommedXi_Xj+dXi_Xj; end end
% sigma determines the bandwidth of the Gaussian kernel. sigma2=SommedXi_Xj/N^2; T=2*sigma2;
% Compute the Laplacian matrix Lb (heterogenous samples) disp('Compute the Laplacian matrix Lb ...') [Wb Db Lb] = LbMaker(x.mat', x.Classes', K_heterogenes, sigma2);
% Compute the Laplacian matrix Lw (homogenous samples) disp('Compute the Laplacian matrix Lw ...') [Ww Dw Lw] = LwMaker(x.mat', x.Classes', K_homogenes, sigma2);
% Compute the importance score L disp('Compute the importance score L ...') L=[]; for r=1:M f_r=x.mat(:,r); L=[L;(f_r'*Lb*f_r)/(f_r'*Lw*f_r)]; end
[L_sorted idx]=sort(L,'descend'); x.mat=x.mat(:,idx); y.mat=y.mat(:,idx);
if ClassifClassique ==1 To=myclassify(x,y,K_KNN); else To=myclassify1(x,y,K_KNN,PourcentagePixels); end % [maxi indx]=max(To(:,2)); % [To(indx,1) maxi]
% clear x y;

Antworten (0)

Kategorien

Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by