evalKmeansModel.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- % Resubstitution performance evaluation of GMM for speaker recognition
- addpath /users/jang/matlab/toolbox/dcpr
- addpath /users/jang/matlab/toolbox/cbmr
- more off
- if ~exist('speakerData'),
- fprintf('Loading speakerData.mat...n');
- load speakerData.mat
- end
- if ~exist('waveData'),
- fprintf('Loading waveData.mat...n');
- load waveData.mat
- end
- % Get the sample data
- sampleData = [];
- for i=1:length(speakerData),
- feature = speakerData(i).kmeansParam;
- out = i*ones(size(feature,1), 1);
- sampleData = [sampleData; [feature, out]];
- end
- %profile on -detail builtin
- toc
- for i=1:length(speakerData),
- speaker = speakerData(i).speaker;
- index = findcell({waveData.speaker}, speaker);
- speakerData(i).kmeansRank = zeros*index;
- for j = 1:length(index),
- fprintf('Evaluate wave file %g/%g of %s...n', j, length(index), speaker);
- feature = waveData(index(j)).feature;
- [eachClass, ensembleClass] = knn(sampleData, feature', 1);
- [a, b] = countele(eachClass);
- index2 = find(a==i);
- if isempty(index2),
- speakerData(i).kmeansRank(j) = 10000;
- else
- speakerData(i).kmeansRank(j) = sum(b>=b(index2));
- end
- end
- end
- fprintf('Total execution time = %gn', toc);
- %profile report
- figure;
- rank = cat(2, speakerData.kmeansRank);
- plotpie(rank);
- title('Performance of Kmeans');
- save speakerData speakerData