⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nearestfeaturelineclassifier.m

📁 用于空中目标识别的最近特征线分类器子程序。
💻 M
字号:
% Nearest Feature Line Classifier-NFL
function [NFLCrate]=NFLclassifier(features,test_features,trnum,tenum,classnum)

% features       the matrix that training samples projected on feature subspace(特征维数*训练样本数,列矢量)
% test_features  the matrix that test samples projected on feature subspace(特征维数*测试样本数,列矢量) 
% trnum          the number of training samples of each class
% tenum          the number of test samples of each class
% classnum       the number of classes

% NFLCrate       the output correct classification rate of each class and the total
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% decompose the features and test_features according to the class flag
for i=1:classnum
    subd(:,:,i)=features(:,(i-1)*trnum+1:i*trnum);
    subdd(:,:,i)=test_features(:,(i-1)*tenum+1:i*tenum);
end

% number of NFL of each class
total=(trnum/2)*(trnum-1);
% compute the parameter U (斜率) and the position P (垂点)
for m=1:classnum                 % 类别数
    for t=1:tenum                % 测试样本数/类
        k=1;        
        for c=1:classnum         % 类别数
            for i=1:trnum        % 训练样本数/类
                for j=i+1:trnum  % 训练样本数/类
                    U=((subdd(:,t,m)-subd(:,i,c))'*(subd(:,j,c)-subd(:,i,c)))/...
                      ((subd(:,j,c)-subd(:,i,c))'*(subd(:,j,c)-subd(:,i,c))+1e-3);
                    P=subd(:,i,c)+U*(subd(:,j,c)-subd(:,i,c));  % 垂足
                    dis(t,k,m)=norm(subdd(:,t,m)-P);            % 计算测试点到垂足的距离
                    k=k+1;       % 计算k条特征线(NFL)
                end
            end
        end       
    end    
end

% compute the correct recognition rate and the according mean value
CCrate=zeros(1,classnum);
for c=1:classnum
    dist=dis(:,:,c)';
    [Y,I]=min(dist);
    k=0;
    for i=1:tenum
        if ceil(I(i)/total)==c
            k=k+1;
        end
    end
    CCrate(c)=k/tenum;            
end
rtmean=sum(CCrate)/classnum;

% output
NFLCrate=zeros(1,classnum+1);
NFLCrate=[CCrate,rtmean];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -