Error with"HelperGenerateSpeechDenoisingFeatures"
조회 수: 5 (최근 30일)
이전 댓글 표시
To use Deep learning to denoise.
It told me that i use Tall array in wrong way. Now , i am afraid that there is nothing i can do about it .
I was trying out the Denoise Speech Using Deep Learning Networks example with some modifications. I just set the noise and dataset as local path, and deleted the very first part. Because i didn't need to play the sound that i had already known and i thought it was not as important as the next step.
the part that i changed is here
%changed
noisedataset = "D:\matlab_network\zh-CN\cv-corpus-5.1-2020-06-22\zh-CN\nosie\common_voice_zh-CN_18527375.mp3";
[noise,fs] = audioread(noisedataset);
dataset = "D:\matlab_network\zh-CN\cv-corpus-5.1-2020-06-22\zh-CN";
adsTrain = audioDatastore(fullfile(dataset,"clips"),IncludeSubfolders=true);
speedupExample = true;
if speedupExample
adsTrain = shuffle(adsTrain);
adsTrain = subset(adsTrain,1:1000);
end
----------------------------------------------------------------------
%STFT
windowLength = 256;
win = hamming(windowLength,"periodic");
.......
Where the error was reported
%tall数组
%-------error
reset(adsTrain)
T = tall(adsTrain);
[targets,predictors] = cellfun(@(x)HelperGenerateSpeechDenoisingFeatures(x,noise,src),T,UniformOutput=false);
[targets,predictors] = gather(targets,predictors);
%----- error
predictors = cat(3,predictors{:});
noisyMean = mean(predictors(:));
noisyStd = std(predictors(:));
predictors(:) = (predictors(:) - noisyMean)/noisyStd;
targets = cat(2,targets{:});
cleanMean = mean(targets(:));
cleanStd = std(targets(:));
targets(:) = (targets(:) - cleanMean)/cleanStd;
predictors = reshape(predictors,size(predictors,1),size(predictors,2),1,size(predictors,3));
targets = reshape(targets,1,1,size(targets,1),size(targets,2));
However, i met the problem like this. I get this error all the time and i am stuck in this problem for a long time. I get no idea to deal with it. I was wondering if anyone could give me a hand? Thank you in advance.
错误使用 tall
无法根据默认并行集群创建 mapreduce 执行环境。
出错 restart (第 93 行)
T = tall(adsTrain);
原因:
错误使用 gcp
Parallel pool failed to start with the following error. For more detailed information, validate
the profile 'Processes' in the Cluster Profile Manager.
错误使用 parallel.internal.pool.AbstractInteractiveClient>iThrowWithCause
Failed to initialize the interactive session.
错误使用 parallel.internal.pool.AbstractInteractiveClient>iThrowIfBadParallelJobStatus
The interactive communicating job failed with no message.
댓글 수: 0
답변 (1개)
Brian Hemmat
2024년 3월 30일
Based on the error message, it looks like a problem with the parallel setup. Did you try validating the profile "Processes" in the "Cluster Profile Manager"?
Another option is to bypass the usage of tall. The following modification can help:
Replace this code:
T = tall(adsTrain);
[targets,predictors] = cellfun(@(x)HelperGenerateSpeechDenoisingFeatures(x,noise,src),T,UniformOutput=false);
[targets,predictors] = gather(targets,predictors);
With this:
tadsTrain = transform(adsTrain,@(x)HelperGenerateSpeechDenoisingFeatures(x,noise,src));
allresults = readall(tadsTrain); % Possibly use the UseParallel flag to speed up--probably not necessary if you're patient
targets = allresults(:,1);
predictors = allresults(:,2);
You must also make the following change to the supporting function, HelperGenerateSpeechDenoisingFeatures.m. This change might require other modifications in the example--I haven't didn't run it all the way through.
function out = HelperGenerateSpeechDenoisingFeatures(audio,noise,src) %<<<<<<< Modify the signature to return "out"
% HelperGenerateSpeechDenoisingFeatures: Get target and predictor STFT
% signals for speech denoising.
% audio: Input audio signal
% noise: Input noise signal
% src: Sample rate converter
% Copyright 2018 The MathWorks, Inc.
WindowLength = 256;
win = hamming(WindowLength,'periodic');
Overlap = round(0.75 * WindowLength);
FFTLength = WindowLength;
NumFeatures = FFTLength/2 + 1;
NumSegments = 8;
D = 48/8; % Decimation factor
L = floor( numel(audio)/D);
audio = audio(1:D*L);
audio = src(audio);
reset(src)
randind = randi(numel(noise) - numel(audio) , [1 1]);
noiseSegment = noise(randind : randind + numel(audio) - 1);
noisePower = sum(noiseSegment.^2);
cleanPower = sum(audio.^2);
noiseSegment = noiseSegment .* sqrt(cleanPower/noisePower);
noisyAudio = audio + noiseSegment;
cleanSTFT = stft(audio, 'Window',win, 'OverlapLength', Overlap, 'FFTLength',FFTLength);
cleanSTFT = abs(cleanSTFT(NumFeatures-1:end,:));
noisySTFT = stft(noisyAudio, 'Window',win, 'OverlapLength', Overlap, 'FFTLength',FFTLength);
noisySTFT = abs(noisySTFT(NumFeatures-1:end,:));
noisySTFTAugmented = [noisySTFT(:,1:NumSegments-1) noisySTFT];
STFTSegments = zeros(NumFeatures, NumSegments , size(noisySTFTAugmented,2) - NumSegments + 1);
for index = 1 : size(noisySTFTAugmented,2) - NumSegments + 1
STFTSegments(:,:,index) = noisySTFTAugmented(:,index:index+NumSegments-1);
end
targets = cleanSTFT;
predictors = STFTSegments;
out = {targets,predictors}; % <<<<<<<<< Add this line. It combines the targets and predictors into a single output
참고 항목
카테고리
Help Center 및 File Exchange에서 AI for Audio에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!