function asdHmmPlot(au, taskOpt) % hmmEval4audio: HMM evaluation for vibrato detection % % Usage: % asdHmmPlot(au, taskOpt) % % Example: % auFile='dataSet/abnormal-cue.wav'; % %auFile='dataSet/normal-cue.wav'; % asdOpt=asdOptSet; % load asdHmmModel.mat % Obtain asdHmmModel % au=hmmEval4audio(auFile, asdOpt, asdHmmModel, 1); % Category: HMM plot for vibrato detection % Roger Jang, 20130106 if nargin<1, selfdemo; return; end frameTime=au.other.frameTime; feaMat=au.feature; asdFeaPlot(au); % Plot the features and groundtruths [feaDim, frameCount]=size(feaMat); % Plot the predicted output using different colors markerColor=['k', 'm', 'r']; for i=1:frameCount h=line(frameTime(i), 0, 'marker', 'o', 'color', markerColor(au.cOutput(i))); end %% Confusing matrix confMat=confMatGet(au.tOutput, au.cOutput); opt=confMatPlot('defaultOpt'); opt.className=taskOpt.outputName; opt.mode='both'; opt.format='8.2f'; figure; confMatPlot(confMat,opt); %fprintf('Accuracy=%g%%\n', au.rr*100); %% Plot groundtruth and prediction figure; subplot(211); plot(frameTime, au.tOutput, frameTime, au.cOutput, 'marker', '.'); grid on classCount=max(max(au.tOutput), max(au.cOutput)); set(gca, 'ytick', 1:classCount); set(gca, 'xlim', [min(frameTime), max(frameTime)]); xlabel('Time (sec)'); ylabel('Classes'); title('Groundtruth and prediction'); legend('Groundtruth', 'Prediction by HMM', 'location', 'northOutside', 'orientation', 'horizontal'); subplot(212); notEqual=double(au.tOutput~=au.cOutput); notEqual(notEqual==0)=nan; plot(frameTime, notEqual, 'marker', 'x'); grid on set(gca, 'ytick', []); set(gca, 'xlim', [min(frameTime), max(frameTime)]); xlabel('Time (sec)'); ylabel('Misclassification indicator'); title('Misclassification positions'); snapnow; %% ====== Self demo function selfdemo mObj=mFileParse(which(mfilename)); strEval(mObj.example);