%%%%%%%%%%%%%%%%%%%% %% test and score %% %%%%%%%%%%%%%%%%%%%% clear; %addpath /amd/birch/export/research24/landmines/users/bfeng/temp/; %addpath /amd/birch/export/research24/landmines/users/bfeng/temp/mfcc; %addpath /amd/birch/export/research24/landmines/users/bfeng/temp/h2m/; addpath Z:\research24\landmines\users\bfeng\temp\; addpath Z:\research24\landmines\users\bfeng\temp\mfcc; addpath Z:\research24\landmines\users\bfeng\temp\h2m; %testData = load('trainTemplate.mat'); %testData = load('testTemplate.mat'); testData = load('oovTemplate.mat'); %testNames=fieldnames(testData); %speakernum = length(testNames)/10; %testData = load('oovTest.mat'); testNames=fieldnames(testData); load trainModel; N=30; pi0=zeros(1,N); pi0(1) = 1; c = [0.952 0.905, 0.941 0.835 0.863 0.716]; %% perturb = c .* original for j=1:1 name = testNames{j}; test = getfield(testData,name); number = size(test,1); for i = 1 : number testing = test(i,:); x = conv2(testing, [0.333 0.667 0 -0.667 -0.333], 'same'); x = filter([1 -0.97], 1, x); %x = wiener2(x); %% calculate mfcc of each input data, x, which needs to be tested testX = mfcc(x, 16000); meantestX = mean(testX); %% OOV detection preparation testX1 = c(1) * testX; %[a b]=size(testX); %for pp = 1:a % testX1(pp,:) = testX(pp,:)-0.14* meantestX; %% testX1 is for OOV %end %% passing each test data and its perturb version through 6 models for model = 1: 6 %% using hmm_vit.m score(j,i,model) = hmm_vit(testX', squeeze(A_(model,:,:)),...%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 pi0, squeeze(mu_(model,:,:)), squeeze(sigma_(model,:,:)), 1); score1(j,i,model) = hmm_vit(testX1', squeeze(A_(model,:,:)),... pi0, squeeze(mu_(model,:,:)), squeeze(sigma_(model,:,:)), 1); end [result rank]= sort(squeeze(score(j,i,:))');%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [result1 rank1] = sort(squeeze(score1(j,i,:))'); result = fliplr(result); rank = fliplr(rank); diff(j,i) = result(1) - result(2); ratio_diff(j,i) = diff(j,i)/result(1); result1 = fliplr(result1); rank1=fliplr(rank1); diff1(j,i) = result1(1) - result1(2); ratio_diff1(j,i) = diff1(j,i)/result1(1); if rank(1)==rank1(1) diffa(j,i) = diff(j,i) + 500; ratio_diffa(j,i) = diffa(j,i)/result(1); wop(j,i) = 1; fprintf('same \n'); else diffa(j,i) = diff(j,i); fprintf('difference \n'); wop(j,i) = 0; end original(j,i)=rank(1); perturb(j,i)=rank1(1); end end