Help with speech recognition command

1 Ansicht (letzte 30 Tage)
Barb
Barb am 22 Jan. 2020
If i try to write :
h = figure('Units','normalized','Position',[0.2 0.1 0.6 0.8]);
filterBank = designAuditoryFilterBank(fs,'FrequencyScale','bark',...
'FFTLength',1024,...
'NumBands',numBands,...
'FrequencyRange',[50,7000]);
while ishandle(h)
% Extract audio samples from the audio device and add the samples to
% the buffer.
x = audioIn();
waveBuffer(1:end-numel(x)) = waveBuffer(numel(x)+1:end);
waveBuffer(end-numel(x)+1:end) = x;
% Compute the spectrogram of the latest audio samples.
[~,~,~,spec] = spectrogram(waveBuffer,hann(frameLength,'periodic'),frameLength - hopLength,512,'onesided');
spec = filterBank * spec;
spec = log10(spec + epsil);
% Classify the current spectrogram, save the label to the label buffer,
% and save the predicted probabilities to the probability buffer.
[YPredicted,probs] = classify(trainedNet,spec,'ExecutionEnvironment','cpu');
YBuffer(1:end-1)= YBuffer(2:end);
YBuffer(end) = YPredicted;
probBuffer(:,1:end-1) = probBuffer(:,2:end);
probBuffer(:,end) = probs';
% Plot the current waveform and spectrogram.
subplot(2,1,1);
plot(waveBuffer)
axis tight
ylim([-0.2,0.2])
subplot(2,1,2)
pcolor(spec)
caxis([specMin+2 specMax])
shading flat
% Now do the actual command detection by performing a very simple
% thresholding operation. Declare a detection and display it in the
% figure title if all of the following hold:
% 1) The most common label is not |background|.
% 2) At least |countThreshold| of the latest frame labels agree.
% 3) The maximum predicted probability of the predicted label is at
% least |probThreshold|. Otherwise, do not declare a detection.
[YMode,count] = mode(YBuffer);
countThreshold = ceil(classificationRate*0.2);
maxProb = max(probBuffer(labels == YMode,:));
probThreshold = 0.7;
subplot(2,1,1);
if YMode == "background" || count<countThreshold || maxProb < probThreshold
title(" ")
else
title(string(YMode),'FontSize',20)
end
drawnow
end
it gives me error :
> In designAuditoryFilterBank (line 104)
Error using DAGNetwork/calculatePredict>predictBatch (line 151)
Incorrect input size. The input images must have a size of [100 198 1].
Error in DAGNetwork/calculatePredict (line 17)
Y = predictBatch( ...
Error in DAGNetwork/classify (line 134)
scores = this.calculatePredict( ...
Error in SeriesNetwork/classify (line 502)
[labels, scores] = this.UnderlyingDAGNetwork.classify(X,
varargin{:});
After training i didnt change anything so i dont know how to fix it.

Antworten (0)

Kategorien

Mehr zu Speech Recognition finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by