% Evaluate utterance-based recognition rate for speaker identification tInit=clock; addMyPath; eval(sprintf('load %s\gmmParam.mat', sidOpt.outputDir)); % ====== Outside test for speakerSet3 sidOpt=sidOptSet; sidOpt.waveDir='\dataSet\【鈦映科技】語者確認錄音2'; % ====== Generate speakerSet if ~exist([sidOpt.outputDir, '/speakerSet3.mat']) fprintf('Get info of all wave files from %s\n', sidOpt.waveDir); speakerSet3=speakerSetRead(sidOpt.waveDir, sidOpt.sentenceNumPerSpeaker); speakerSet3=speakerSet3(1:min(sidOpt.maxSpeakerNum, length(speakerSet3))); % ====== Add mfcc to speakerSet fprintf('Read wave files and do feature extraction...\n'); speakerSet3=speakerSetAddFea(speakerSet3, sidOpt); save output\mat\speakerSet3 speakerSet3 else load output\mat\speakerSet3.mat end % ====== Remove individuals not in the training data load output\mat\speakerSet.mat name1={speakerSet1.name}; name3={speakerSet3.name}; missingName=setdiff(name3, name1); deleteIndex=[]; for i=1:length(missingName) deleteIndex=[deleteIndex, find(strcmp(missingName{i}, name3))]; end speakerSet3(deleteIndex)=[]; % ====== Compute RR for speakerSet3 fprintf('Outside test for speakerSet3:\n'); [overallRecogRate3, confMat3, speakerSet3]=speakerIdentify(speakerSet3, gmm, sidOpt.useIntGmm); fprintf('Overall outside-test recognition rate is %.2f%%.\n', overallRecogRate3*100); listPersonRr(speakerSet3, confMat3); % ====== Plot confusion matrix className={speakerSet3.name}; figure; confMatPlot(confMat3, className); eval(['print -dpng output\png\', mfilename]); fprintf('%s ===> %g seconds\n', mfilename, etime(clock, tInit));