Gaussian Mixture Model for image classification using wavelet coefficients
Show older comments
I am trying to generate the Gaussian Mixture Model for a subband from the distribution of wavelet coefficients. But i think there is some mistake in my code regarding initialization of the Gaussian Mixture Model
X = mat_cell;num_dim=2;num_clus = 2; % number of mixtures/clusters
[counts,binLocations] = imhist(X);
stem(binLocations, counts, 'MarkerSize', 1 );
xlim([-1 1]);
% inital kmeans step used to initialize EM
rng('default');
data=reshape(X,[],num_dim);
[kmeanscid,cInd.mu] = kmeans(data, num_clus,'MaxIter', 75536);
data_k_1=data(kmeanscid==1);
data_k_2=data(kmeanscid==2);
a = diag(cov(data_k_1'));
b=diag(cov(data_k_2'));
if a==0
a=0.1;
elseif b==0
b=0.1;
end
initialsigma = cat(3,[a,a],[b,b]);
%disp(initialsigma);
cInd.Sigma=initialsigma;
% fit a GMM model
options = statset('MaxIter', 75536);
gmm = fitgmdist(data, num_clus,'Start',cInd,'CovarianceType','diagonal','Regularize',1e-5,'Options',options);
Answers (0)
Categories
Find more on Gaussian Mixture Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!