Image Segmentation and Classification: Application to Hyperspectral Data
-
Upload
wahyu-rahmaniar -
Category
Documents
-
view
22 -
download
0
description
Transcript of Image Segmentation and Classification: Application to Hyperspectral Data
Digital Image Processing – Remote Sensing
Group 3
Image Segmentation and Classification:
Application to Hyperspectral Data
馬妮雅Wahyu Rahmaniar 102521604
許俊傑 Chon-Kit Hoi 102022003
王禹翔Wang Yu Shiang 1020022006
林桓陞 Haun-Shang Lin102322088
連信豪 Hsin-Hlao Lein 102322091
施驊珊 100601518
INTRODUCTION
Important research efforts have been devoted to image classification and
segmentation. However, it’s still difficult to analysis hyperspectral images. In order to get
an acceptable accuracy, it needs lots of training samples, which may be difficult,
expensive, or sometimes impossible to get.
Thus, we could research on semi-supervised learning algorithms, which are trained
with both labeled and unlabeled samples. This project based on the new semi-supervised
segmentation algorithm, where the posterior class distributions are modeled by the
Markov Random Field (MLR) and learnt by a new semi-supervised generative
expectation minimization (GEM) algorithm, and the spatial contextual information is
modeled by a Markov random field multi-level logistic (MLL) prior, which enforces
segmentation results in which neighboring labels belongs to the same class.
METHODOLOGY
Fig 1. Flowchart
In this project, we used a new semi-supervised learning algorithm which exploits both
the spatial contextual information and the spectral information in the interpretation of
remotely sensed hyperspectral data.
The algorithm implements two main steps: (i) semi-supervised learning of the
posterior class distributions, implemented by an efficient version of semi-supervised
learning algorithm in, followed by (ii) segmentation, which infers an image of class
labels from a posterior distribution built on the learnt class distributions, and on an MLL
prior on the image of labels.
The posterior class distributions are modeled using MLR, where the regressors are
learnt using both labeled and through a graph-based technique unlabeled training samples.
For step (i), we use a block Gauss-Seidel iterative method which allows dealing with data
sets that, owing to their large size in terms of labeled samples, unlabeled samples, and
number of classes.
The spatial contextual information is modeled by means of a MLL prior. The final
output of the algorithm is based on an MAP segmentation process which is computed via
a very efficient min-cut based integer optimization technique.
AVIRIS Data
MLR GEM Algorithm
Multilevel Logistic
Model (MLL)
Maximum a posteriori
estimation (MAP)
Classified MAP
Accuracy Assessment
Semi-supervised
learning
The two real hyperspectral scenes considered in our experiments were obtained by the
simulated data AVIRIS over the regions of Indian Pines, Indiana, and Salinas Valley,
California. These scenes have been widely used in the literature and have high-quality
ground-truth measurements associated to them, thus allowing a detailed quantitative and
comparative evaluation of our proposed algorithm.
SEMI-SUPERVISED ALGORITHM
To address the data, we enhance our proposed semisupervised techniques (based on
labeled training samples) with semi-supervised learning capabilities, thus exploiting
unlabeled samples by means of an active learning paradigm.
The performance of hyperspectral image classification and segmentation techniques
can be further increased by taking advantage of semi-supervised learning, in which the
learning is generally conducted using very few labeled samples (available a priori ) and a
larger amount of so-called unlabeled training samples which are automatically generated
during the process and with no extra cost.
MATLAB code:
function [w,L] =
semi_segmentation_graph(x_L_U,class_L,alpha,beta,MMiter,w0)
----------------- Input Parameters ---------------------------------- x_L_U -> training set (each column represent a sample). x_L can be samples or functions of samples, i.e., kernels, basis, etc. class_L -> class (1,2,...,m) alpha - shape parameter of Gamma distribution, default setting: alpha = [1e-1 1e-3]
beta - inverse scale parameter of Gamma distribution default setting: beta = [1e-1 1e-3]
MMiter -> Number of iterations (default 100)
Copyright (Jul, 2009): José Bioucas-Dias ([email protected]) Jun li ([email protected]) --------------------------------------------------------------------- if nargin < 6 MMiter = 100; end if nargin < 5 beta(1) = 1e-1; beta(2) = 1e-3; end
if nargin <4 alpha(1) = 1e-1; alpha(2) = 1e-3; end
number of classes m = max(class_L); n = length(class_L); auxiliar matrix to compute a bound for the logistic hessian U = -1/2*(eye(m-1)-ones(m-1)/m); convert y into binary information Y = zeros(m,n); for i=1:n Y(class_L(i),i) = 1; end remove last line Y=Y(1:m-1,:);
labelled samples x_L = x_L_U(:,1:n); build Rx Rx = x_L*x_L';
[d,N] = size(x_L_U);
x = x_L_U; for i = 1:N for j = 1:N beta(i,j) = exp(-norm(x(:,i)-x(:,j),'fro')); end end
beta1 = beta*ones(N,1); delta1 = diag(beta1) - beta; Ra = x_L_U*delta1*x_L_U';
initialize w with ridge regression fitted to w'*x = 10 in the class and w'*x = -10 outside the class if (nargin < 7) alpha0 = 1e-5; w=(Rx+alpha0*eye(d))\(x_L*(20*Y'-10*ones(size(Y')))); else w=w0; end lambda=0.004;
Block GS iterative scheme to compute w for i=1:MMiter fprintf('\n i = d',i); compute the multinomial distributions (one per sample) aux1 = exp(w'*x_L); aux2 = 1+sum(aux1,1); p = aux1./repmat(aux2,m-1,1); compute log-likelihood
L(i) = sum( sum(Y.*(w'*x_L),1) -log(aux2)); compute derivative dg = Rx*w*U'- x_L*(Y-p)'; acumulate a = Rx*w*U'; bloc GS small = 1e-7; for t=1:1 for k=1:m-1 lamda0 = (2*alpha(1) + d)/(2*beta(1) + (w(:,k)'*Ra*w(:,k))); lamda1 = (2*alpha(2) + d)/(2*beta(2) + (w(:,k)'*Ra*w(:,k))); Rr = lamda0*Ra + lamda1*eye(d); Ak = U(k,k)*Rx - Rr; y = dg(:,k) - a(:,k) + Ak*w(:,k); w(:,k) = inv(Ak)*y; end end end
Active Learning
Active learning is a method of online learning, where a learner strategically selects
new training examples that provide maximal information about the unlabeled dataset,
resulting in higher classification accuracy for a given training set size as compared to
using randomly selected examples.
Active learning is most useful when there are sufficient a number of unlabeled
samples but it is expensive to obtain class labels.
MATLAB code:
function [indexes]=train_test_random_new(y,n,nall)
This function ramdonly selects training samples and testing samples
from the ground truth image.
------------------- input parameters --------------------------------- y -- ground truth n -- number of labeled samples per class nall -- number of labeled samples in total
---------------output parameters ----------------------------------- indexes -- index of labeled samples K = max(y); generate the training set indexes = []; for i = 1:K index1 = find(y == i); per_index1 = randperm(length(index1)); if length(index1)>n indexes = [indexes; index1(per_index1(1:n))']; else indexes = [indexes; index1']; end end
indexes_all = [1:length(y)]; indexes_all(indexes) = []; n_new = nall - length(indexes); per_indexall = randperm(length(indexes_all)); indexes_new = indexes_all(per_indexall(1:n_new)); indexes = [indexes;indexes_new'];
MULTILEVEL LOGISTIC MODEL (MLL)
In segmenting real world images, it is very likely that neighboring pixels belong to
the same class. The exploitation of this (seemingly naive) contextual information
improves, in some cases dramatically, the classification performance. In this work, we
integrate the contextual information with spectral information by using an isotropic MLL
prior to model the image of class labels y. This prior, which belongs to the MRF class,
encourages piecewise smooth segmentations and thus promotes solutions in which
adjacent pixels are likely to belong the same class.
Multilevel models are statistical models of parameters that vary at more than one
level. It means that the new level is based on the previous one, and can add more
information to this model. And, this models provide an alternative type of analysis for
univariate or multivariate analysis of repeated measures.
Level 1 regression equation
(1)
Each β can be added more information in level two.
Level 2 regression equation
{
(2)
Then, level 1 and level 2 can be combined as:
(3)
Therefore, the better coefficients can be obtained from this processing, and they will be
used in next method.
MATLAB code:
function y=mll(m,beta,K,neigh) mll(n,beta) Generates a sample a multi level logistic distribution Uses 1st or 2nd order neighborhoods
Method: Gibbs sampler Input parameters --------------------------------------- m -> image size b -> MLL parameter K -> number of labels neigh -> neighborhood {1,2}
Author: Jose M. Bioucas-Dias, 2005
n= m+2; y=zeros(n); histogram of the neighbors h = zeros(K,1); if neigh == 1 1 st order neighborhood index=[0 1; -1 0; 0 -1; 1 0]; else 2nd order neighborhood index=[0 1; -1 1; -1 0; -1 -1; 0 -1; 1 -1; 1 0; 1 1]; end
iter = 100; start with a uniform distribution and set boundary to zeros y(2:n-1,2:n-1) = floor(rand(m)*K)+1; image sweep randonmly for t=1:iter/2 for i=2:n-1 for j=2:n-1 i= floor(rand()*m)+2; j= floor(rand()*m)+2; comute neighbor histogram h=0*h; for v =1:size(index,1) label = y(i+index(v,1),j+index(v,2)); if not on the boudary if label ~= 0 h(label) = h(label)+1; end end compute conditional probabilities p = exp(beta*h); p=p/sum(p); generate label cp = cumsum(p); cp = [0; cp]; w = rand(); for u=1:K if (cp(u)<= w) & (cp(u+1)>= w)
y(i,j) = u; break; end end
end end end sweep image linewise for t=1:iter/2 for i=2:n-1 for j=2:n-1 comute neighbor histogram h=0*h; for v =1:size(index,1) label = y(i+index(v,1),j+index(v,2)); if not on the boudary if label ~= 0 h(label) = h(label)+1; end end compute conditional probabilities p = exp(beta*h); p=p/sum(p); generate label cp = cumsum(p); cp = [0; cp]; w = rand(); for u=1:K if (cp(u)<= w) & (cp(u+1)>= w) y(i,j) = u; break; end end
end end end
y=y(2:n-1,2:n-1);
MULTINOMIAL LOGISTIC REGRESSION (MLR)
Multinomial Logistic Regression is useful for situations in which you want to be able to
classify subjects based on values of a set of predictor variables. It is a model that is used
to predict the probabilities of the different possible outcomes of a categorically
distributed dependent variable, given a set of independent variables.
Linear predictor:
( ) ( ) ( ) ( ) ( ) ( )
Where ( ) is the set of regression coefficients associated with outcome k, and ( ) (a
row vector) is the set of explanatory variables associated with observation i
MLR model:
( | ) ( ( ) ( ))
∑ ( ( ) ( ))
( ) [ ( ) ( )] is a vector of fixed function of the input
( ) [ ( ) ( )
]
is the set of logistic regressors for class
MAXIMUM A POSTERIORI ESTIMATION (MAP)
MAP estimation is mode of the posterior distribution. The MAP can be used to obtain
a point estimate of an unobserved quantity on the basis of empirical data.
Maximum likelihood estimate of θ:
θ ML(x) = argθ max ƒ(x|θ)
θ: unobserved population parameter
X: basis of observations
ƒ: probability of x
Now assume that a prior distribution g over θ exists. Then the posterior distribution of
θ is as follows:
g: density function of θ
ϴ: domain of g
ƒ: probability of x
The method of maximum a posterior estimation then estimates θ as the mode of the
posterior distribution of this random variable:
Based on the posterior class densities p(yi|xi) and on the MLL prior p(y), assuming
equiprobable classes the MAP segmentation is finally given by:
Minimization of expression is a combinatorial optimization problem, involving unary
and pairwise interaction terms. The exact solution for K = 2 introduced by mapping the
problem into the computation of a min-cut on a suitable graph.
MATLAB code:
function [gch, varargout] = GraphCut(mode, varargin)
switch lower(mode) case {'o', 'open'} open a new graph cut if nargout ~= 1 error('GraphCut:Open: wrong number of output arguments'); end
gch = OpenGraph(varargin{:});
case {'c', 'close'} close the GraphCut handle - free memory. if nargin ~= 2 error('GraphCut:Close: Too many inputs'); end gch = varargin{1}; [gch] = GraphCutMex(gch, 'c');
case {'g', 'get'} get current labeling
if nargout ~= 2 error('GraphCut:GetLabels: wrong number of outputs'); end [gch labels] = GetLabels(varargin{:});
varargout{1} = labels;
case {'s', 'set'} set user defined labeling if nargout ~= 1 error('GraphCut:SetLabels: Too many outputs'); end
[gch] = SetLabels(varargin{:});
case {'en', 'n', 'energy'} get current energy values if nargin ~= 2 error('GraphCut:GetEnergy: too many input arguments'); end
gch = varargin{1}; [gch se de] = GraphCutMex(gch, 'n'); switch nargout case 2 varargout{1} = se+de; case 3 varargout{1} = se; varargout{2} = de; case 1 otherwise error('GraphCut:GetEnergy: wrong number of output
arguments') end
case {'e', 'ex', 'expand'} use expand steps to minimize energy if nargout > 2 error('GraphCut:Expand: too many output arguments'); end [gch labels] = Expand(varargin{:}); if nargout == 2 varargout{1} = labels; end
case {'sw', 'a', 'ab', 'swap'} use alpha beta swapping to minimize energy if nargout > 2 error('GraphCut:Expand: too many output arguments'); end [gch labels] = Swap(varargin{:}); if nargout == 2 varargout{1} = labels; end
otherwise error('GraphCut: Unrecognized mode s', mode); end
Aux functions: function gch = OpenGraph(varargin) Usage [gch] = OpenGraph(Dc, Sc, [vC, hC]) - 2D grid or [gch] = OpenGraph(Dc, Sc, [Contrast]) -3D grid or [gch] = GraphCut('open', DataCost, SmoothnessCost,
SparseSmoothness) - any graph nin = numel(varargin); if (nin~=2) && (nin ~= 3) && (nin~=4) error('GraphCut:Open: wrong number of inputs'); end
Data cost Dc = varargin{1}; if ndims(Dc) == 4 3D graph [R C Z L] = size(Dc); if ~strcmp(class(Dc),'single')
Dc = single(Dc); end Dc = permute(Dc,[4 1 2 3]); Dc = Dc(:)';
smoothness cost Sc = varargin{2}; if any( size(Sc) ~= [L L] ) error('GraphCut:Open: smoothness cost has incorrect size'); end if ~strcmp(class(Sc),'single') Sc = single(Sc); end Sc = Sc(:)'; if nin == 3 Contrast = varargin{3}; if any( size(Contrast) ~= [R C Z] ) error('GraphCut:Open: Contrast term is of wrong size'); end if ~strcmp(class(Contrast),'single') Contrast = single(Contrast); end Contrast = Contrast(:);
gch = GraphCut3dConstr(R, C, Z, L, Dc, Sc, Contrast); else gch = GraphCut3dConstr(R, C, Z, L, Dc, Sc); end elseif ndims(Dc) == 3 2D graph [h w l] = size(Dc); if ~strcmp(class(Dc),'single') Dc = single(Dc); end Dc = permute(Dc,[3 2 1]); Dc = Dc(:)';
smoothness cost Sc = varargin{2}; if any( size(Sc) ~= [l l] ) error('GraphCut:Open: smoothness cost has incorrect size'); end if ~strcmp(class(Sc),'single') Sc = single(Sc); end Sc = Sc(:)';
if nin==4 vC = varargin{3}; if any( size(vC) ~= [h w] ) error('GraphCut:Open: vertical cue size incorrect'); end if ~strcmp(class(vC),'single') vC = single(vC); end vC = vC';
hC = varargin{4}; if any( size(hC) ~= [h w] ) error('GraphCut:Open: horizontal cue size incorrect'); end if ~strcmp(class(hC),'single') hC = single(hC); end hC = hC'; gch = GraphCutConstr(w, h, l, Dc, Sc, vC(:), hC(:)); else gch = GraphCutConstr(w, h, l, Dc, Sc); end elseif ndims(Dc) == 2 arbitrary graph if nin ~= 3 error('GraphCut:Open', 'incorect number of inputs'); end
[nl np] = size(Dc); Sc = varargin{2}; if any(size(Sc) ~= [nl nl]) error('GraphCut:Open', 'Wrong size of Dc or Sc'); end
SparseSc = varargin{3}; if any(size(SparseSc) ~= [np np]) error('GraphCut:Open', 'Wrong size of SparseSc'); end
gch = GraphCutConstrSparse(single(Dc(:)), single(Sc(:)), SparseSc);
else Unknown dimensionality... error('GraphCut:Open: data cost has incorect dimensionality'); end
function [gch] = SetLabels(varargin) usgae [gch] = SetLabels(gch, labels)
if nargin ~= 2 error('GraphCut:SetLabels: wrong number of inputs'); end gch = varargin{1}; labels = varargin{2};
if ~strcmp(class(labels), 'int32') labels = int32(labels); end labels = labels'; [gch] = GraphCutMex(gch, 's', labels(:));
function [gch labels] = GetLabels(varargin)
if nargin ~= 1 error('GraphCut:GetLabels: wrong number of inputs'); end gch = varargin{1}; [gch labels] = GraphCutMex(gch, 'g'); labels = labels';
function [gch labels] = Expand(varargin) gch = varargin{1}; switch nargin case 1 [gch labels] = GraphCutMex(gch, 'e'); case 2 [gch labels] = GraphCutMex(gch, 'e', varargin{2}); case 3 [gch labels] = GraphCutMex(gch, 'e', varargin{2}, varargin{3}); case 4 ind = varargin{4}; ind = int32(ind(:)-1)'; convert to int32 [gch labels] = GraphCutMex(gch, 'e', varargin{2}, varargin{3},
ind); otherwise error('GraphCut:Expand: wrong number of inputs'); end labels = labels';
function [gch labels] = Swap(varargin) gch = varargin{1}; switch nargin case 1 [gch labels] = GraphCutMex(gch, 'a'); case 2 [gch labels] = GraphCutMex(gch, 'a', varargin{2}); case 3 [gch labels] = GraphCutMex(gch, 'a', varargin{2}, varargin{3}); otherwise error('GraphCut:Swap: wrong number of inputarguments'); end labels = labels';
PROGRAM ALGORITHM
Program algorithm:
• 1- Based on a training set containing spectral vectors and the respective labels, learn
the regressors of a multinomial logistic regression (MLR) GEM algorithm .
• 2- Based on a multi-level logistic (MLL) prior, to model the contextual spatial
information of the hyperspectral images, compute the MAP segmentation via the
alpha Graph-cut algorithm.
• 3- Based on maximum entropy (or random selection), actively (or randomly) select
new unlabeled samples into the training set.
• 4- Goto 1, until some stopping rule is met
FILES MATLAB
• function simulated_data.m - Matlab demo over simulated data corresponding to data
AVIRIS
• semi_segmentation_graph.m - Matlab function file for semi-supervised algorithm
• train_test_random_new.m - Matlab function to randomly select training and testing
set
• mll.m - Matlab functon to generate simulated image following a MLL distribution.
• splitimage.m - function to compute the compute class probalilities
• mlogistic.m - Matlab function to compute the multinomial distributions (one per
sample)
• GCmex1.2.tar.gz - Matlab Wrapper for Graph Cuts
Input Parameter
• alpha - shape parameter of Gamma distribution,
• beta - inverse scale parameter of Gamma distribution
• mu - the spatial prior regularization parameter, controlling the degree of spatial
smothness. Tune this parameter to obtain a good segmentation results.
Hyperspectral Data Parameter
• no_classes - number of classes
• dim - dimentionality of the hyperspectral data
• n - number of pixels in the image: n = dim*dim
• d - number of bands.
• sigma - noise standard deviation (std) of dataset
Demo Parameter
• GC_toolbox - this variable default = Bagon (Matlab Wrapper for Graph Cuts), to
implement the alpha-Expansion algorithm.
• hyperspectral_image - this variable default = existing_image. 'new_image' generates a
new class label image according to the MLL distribution. 'existing_image' uses an
existing binary image: demo1_classes.
• size_train_set - size of labeled samples
• MMiter - number of Monte Carlo runs to compute the overall accuracy (OA)
Output Parameter
• OA_class - classification accuracies with the GEM algorithm
• OA_seg - segmentation accuracies with the segmentation algorithm
MATLAB code: clear all close all clc
% set GC toolbox GC_toolbox = 'Bagon'; %GC_toolbox = 'Bioucas';
% set hyperspectral image hyperspectral_image = 'existing_image'; % hyperspectral_image = 'new_image';
% set active selection approach active_selection = 'maximum_entropy'; %active_selection = 'random';
dim=128; % dimentionality no_class = 10; % number of classes sigman = 0.4; % noise standard deviation (std) n_bands = 224; % number of bands
%---------------------------------------------------------------------- % generate an MLL image %----------------------------------------------------------------------
if strcmp(hyperspectral_image,'new_image') % generate a new label image classes = mll(dim,mu,no_class,2); else % use an existing label image load SimulationA2_class_demo1_class_A %load Indian_pines end
image = A(:,classes(:)) + sigman*randn(n_bands,dim*dim);
% ground truth image truth_image = classes;
train_perclass = 40; % number of labeled samples per class size_train_set = 400; % number of labeled samples no_u = 50; % number of unlabeled samples selected per iteration mu=2; % MLL soomthness parameter tot_sim = 10; % number of iterations used in the active selection
procedure MMiter = 1; % number of simulations xz_length=zeros(MMiter,tot_sim); % number of training samples
% compute the union bound for no_i = 1:no_class for no_j = 1:no_class dis_ij(no_i,no_j) = norm(A(:,no_i)-A(:,no_j),'fro'); end end dis_ij = sort(dis_ij(:)); dis_ij0 = dis_ij == 0; dis_ij(dis_ij0) = []; mindis = min(dis_ij); ub = (no_class-1)/2*erfc(sqrt(mindis)/(2*sigman));
trainall(:,1) = 1:(dim*dim); trainall(:,2) = classes(:);
%--------------------------------------------------------------------- % Start MC runs %--------------------------------------------------------------------- fprintf('\nStarting Monte Carlo runs \n\n');
for iter = 1:MMiter fprintf('MC run %d \n', iter); % randomly select the initial training set from the ground truth % image
indexes=train_test_random_new(trainall(:,2)',train_perclass,size_train_
set); train = image(:,indexes); test = trainall; test(indexes,:) = []; y1 = test(:,2); indx1 = 1:(dim*dim); indx1(indexes) = []; indexesall = indx1; y=classes(indexes);
% unlabeled set xu = []; % reindex to natural indeces x = [train xu]; xtest = x;
%------------------------------------------------------------------ % start active section iterations %------------------------------------------------------------------ for n_sim = 1:tot_sim fprintf('Active selection iteration %d \n', n_sim); x = xtest; % space dimension [d,n] =size(x); % build |x_i-x_j| matrix nx = sum(x.^2); [X,Y] = meshgrid(nx); dist=X+Y-2*x'*x;
scale = mean(dist(:)); clear X Y nx
sigma = 0.6; % build design matrix (kernel) K=exp(-dist/2/scale/sigma^2); % set first line to one K = [ones(1,n); K];
lambda=0.004; tic [w,L1] = semi_segmentation_graph(K,y); t1 = toc; p = splitimage(image,xtest,w,scale,sigma);
[maxp,class] = max(p); class_map = reshape(class,dim,dim); % classification overall accuracy OA_class(iter,n_sim) = sum(class(indx1)==y1')/length(y1);
if strcmp(GC_toolbox,'Bagon') %------------------------------------------------------------- % graphcut by Matlab wrapper; % http://www.wisdom.weizmann.ac.il/~bagon/matlab.html %-------------------------------------------------------------- Dc = reshape((log(p+eps))',[dim dim no_class]);%(log(p+eps)-H) % energy for each class0 Sc = ones(no_class) - eye(no_class); % spatialy varying part gch = GraphCut('open', -Dc, mu*Sc); [gch seg] = GraphCut('expand',gch); gch = GraphCut('close', gch); else %-------------------------------------------------------------- % graphcut by another toolbox; Jose Bioucas Dias %--------------------------------------------------------------
% energy for each class e=-log(p+eps);% log(p12); for i=1:no_class eLabel(:,:,i)=reshape(e(i,:),dim,dim); end cliques = [ 0 1; 1 0];
[cliquesm,cliquesn] = size(cliques); [em,en,nrLabels] = size(eLabel); labels = [1:nrLabels]; labels = labels-1; % Expantion Algorithm initLabelling = ones(dim,dim); seg = alfaExpansion(eLabel,labels,initLabelling,mu,cliques); end
% segmentation overall accuracy OA_seg(iter,n_sim) = sum(seg(indx1) + 1 ==y1')/length(y1);
%-------------------------------------------------------------- % active selection: maximum entropy %-------------------------------------------------------------- if strcmp(active_selection,'maximum_entropy') pindexall = p(:,indexesall); [maxpall,classall] = max(pindexall); [sortmaxpp, indexsortmaxpp] = sort(maxpall); xp = indexesall(indexsortmaxpp((1:no_u))); % eliminate the [xp] unlabeld samples from the background unlabeled % set, see line 8 in Algorithm 2 of reference [2] indexesall(indexsortmaxpp((1:no_u))) = []; else %------------------------------------------------------------------ % active selection: random %------------------------------------------------------------------ per_index1 = randperm(length(indexesall)); xp = indexesall(per_index1(1:no_u)); % eliminate the [xp] unlabeld samples from the background unlabeled % set, see line 8 in Algorithm 2 of reference [2] indexesall(per_index1(1:no_u)) = []; end xu = image(:,xp); z = [xtest xu]; [d1,n2] =size(z); % number of training samples xz_length(iter,n_sim) = n2; xtest = z; end end
%---------------------------------------------------------------------- % evaluation of the algorithm performance %---------------------------------------------------------------------- % % compute the mean OAs over MMiter MC runs mean_classification = mean(OA_class,1); mean_segmentation = mean(OA_seg,1);
L_total = mean(xz_length,1);
% the training set size L = max(size_train_set, no_class*train_perclass) ; U = L_total(end) - L; fprintf('The number of labeled training samples: L = %d \n',L );
fprintf('The number of unlabeled training samples: U = %d \n', U); fprintf('The final number of training samples: L_total = L + U = %d
\n', L_total(end)); fprintf('The classification results: OA = %2.2f (U = 0), OA = %2.2f
(U = %d) \n',... mean_classification(1),mean_classification(end),U); fprintf('The segmentation results: OA = %2.2f (U = 0), OA = %2.2f (U
= %d) \n',... mean_segmentation(1),mean_segmentation(end),U);
% ground truth image figure(1), imagesc(truth_image) title('\bf{Ground truth map}','Fontsize', 14)
% classification map figure(2), imagesc(class_map) st = sprintf('classification map: OA = %2.2f, (L = %d, U = %d)',... mean_classification(end),L, U); title(st,'Fontsize', 12)
% segmentation map figure(3), imagesc(seg) st = sprintf('segmentation map: OA = %2.2f, (L = %d, U = %d)', ... mean_segmentation(end),L, U); title(st,'Fontsize', 12)
RESULT
After training 10 iterations we got the result:
GROUND TRUTH
• Ground truth from AVIRIS data containing 16 mutually exclusive land-cover classes.
• This AVIRIS data was acquired over a mixed agricultural/forest area early in the
growing season. These scene comprises 224 spectral channels in the wavelength
range from 0.4 to 2.5 μm, nominal spectral resolution of 10 nm, and spatial resolution
of 20 m by pixel.
• This scene a widely used benchmark for testing the accuracy of hyperspectral data
classification and segmentation algorithm.
Fig 2. Ground Truth
SEGMENTATION
• The segmentation MAP using graph-cut algorithm result: Overall Accuracy = 0.92,
labeled trained data = 400, and unlabeled samples = 500.
• The goal of hyperspectral image segmentation is to partition the set image pixel into a
collection of sets image region, such that the image pixels in each set image region be
close in some sense.
• In this project the term of segmenatation is used when the spatial prior is being
considered.
Fig 3. Segmentation
CLASSIFICATION
• The classification result: Overall Accuracy = 0.76, labeled trained data = 400, and
unlabeled samples = 500.
• The goal of hyperspectral image classification is for every image pixel infer the class
labels from the feature vectors or spectra vectors. In this project the term
classification is used when there is no spatial information.
Fig 4. Classification
CONCLUSIONS
• A new semisupervised classification/segmentation approach for remotely sensed
hyperspectral data interpretation.
• Considering not only spectral but also spatial information in remotely sensed
hyperspectral data interpretation.
• The goal of both image segmentation and image classification is to estimate image of
class labels having observed image in which the pixel are d-dimensional feature
vectors, a hyperspectral image made up of d-dimensional pixel vectors.
REFERENCES
• J. Li , J. M. Bioucas-Dias and A. Plaza. Semisupervised Hyperspectral Image
Segmentation Using Multinomial Logistic Regression With Active Learning. IEEE
Transactions on Geoscience and Remote Sensing, 35:4085-4098, 2010.