denoise speech in deep learning-trainNetwork
1 view (last 30 days)
Show older comments
I have a question in the example--Denoise Speech Using Deep Learning Networks(https://ww2.mathworks.cn/help/audio/ug/denoise-speech-using-deep-learning-networks.html?s_tid=srchtitle_denoise%20deep_1).
My question is in deep learning part , before deep learning ,we need reshape predictors and targets to the dimensions expected by the deep learning networks.
Code: predictors=reshape(predictors,size(predictors,1),size(predictors,2),1,size(predictors,3));
targets = reshape(targets,1,1,size(targets,1),size(targets,2));
If size(predictors)=[129 8 544] size(predictors)=[129 544],So after reshape , size(predictors)=[129 8 1 544] size(predictors)=[1 1 129 544].
The first deep learning method is Fully Connected Layers.
Code:layers = [
imageInputLayer([numFeatures,numSegments])
fullyConnectedLayer(1024)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(1024)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(numFeatures)
regressionLayer
];
denoiseNetFullyConnected = trainNetwork(trainPredictors,trainTargets,layers,options);
The second deep learning method is Fully Convolutional Layers.
Code:
layers = [imageInputLayer([numFeatures,numSegments])
convolution2dLayer([9 8],18,"Stride",[1 100],"Padding","same")
batchNormalizationLayer
reluLayer
repmat( ...
[convolution2dLayer([5 1],30,"Stride",[1 100],"Padding","same")
batchNormalizationLayer
reluLayer
convolution2dLayer([9 1],8,"Stride",[1 100],"Padding","same")
batchNormalizationLayer
reluLayer
convolution2dLayer([9 1],18,"Stride",[1 100],"Padding","same")
batchNormalizationLayer
reluLayer],4,1)
convolution2dLayer([5 1],30,"Stride",[1 100],"Padding","same")
batchNormalizationLayer
reluLayer
convolution2dLayer([9 1],8,"Stride",[1 100],"Padding","same")
batchNormalizationLayer
reluLayer
convolution2dLayer([129 1],1,"Stride",[1 100],"Padding","same")
regressionLayer
];
denoiseNetFullyConvolutional = trainNetwork(trainPredictors,permute(trainTargets,[3 1 2 4]),layers,options);
my question is about trainNetwork ,one is trainTargets(1 1 129 544),the other is permute(trainTargets,[3 1 2 4]) ,which is [129 1 1 544].I can not understand the different.
0 Comments
Accepted Answer
Shivam Singh
on 2 Sep 2021
The shape of the predicted output by this training network and the target should be same for computing loss and other learnable parameters. So, here in this case (suppose the training examples be n):
Shape of trainPredictors is [129, 8, 1, n]
Shape of trainTargets is [1, 1, 129, n]
The shape of the predicted output and other intermediate layer activations can be seen using the “analyzeNetwork(layers)”. In this, you can check the “Activations” of the “regressionoutput’, to know the shape of the predicted output.
Shape of predicted output in case of fully connected network is [1, 1, 129, n]. Thus, the "trainTargets" are used as it is.
denoiseNetFullyConnected = trainNetwork(trainPredictors,trainTargets,layers,options);
Shape of predicted output in case of fully convolutional network is [129, 1, 1, n]. Thus, the shape of "trainTargets" is permuted as:
denoiseNetFullyConvolutional = trainNetwork(trainPredictors,permute(trainTargets,[3 1 2 4]),layers,options);
More Answers (0)
See Also
Categories
Find more on AI for Audio in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!