how to train a 3D input matrix using back propagation neural network?

3 次查看(过去 30 天)
Hi, Iam working on speech restoration, I used MFCC to extract the features for original and distorted sound.I wont to train a neural network to restore the speech. I have 51 audio clip, so the output I get from MFCC is a 12*34*51 matrix for original sound (12 is the number of MFCC coefficients for each frame, 34 is the number of frames for each audio clip, and 51 is the number of audio clip). and I get a 12*15*51 matrix for distorted sound (the number of frames is differ from the number of frames in original sound because I used a time shrinking method for distort the audio speech). so i have a 12*15*51 as an input matrix for neural network,and a 12*34*51 as an output or target matrix. can you help me to write a back propagation neural network code to train my data? please I am vary need to help. my code for getting the MFCC coefficients is:
% Clean-up MATLAB's environment
close all;clear all;clc
% Define variables
fs=8000;
Tw = 0.032; % analysis frame duration in seconds
Ts = 0.01; % analysis frame shift in seconds
n = Tw*fs; % length of frame in samples
inc= Ts*fs; % frame increment in samples
w ='M'; % Hamming window in time domain
nc =12; % number of cepstral coefficients excluding 0'th coefficient
p = 70; % number of filters in filterbank
fl =0; % low end of the lowest filter as a fraction of fs
fh = 0.5; % high end of highest filter as a fraction of fs
mfcc =[];
d_mfcc=[];
%loud the audio files
[files path]=uigetfile('.wav','Please select files','multiselect','on');
for i=1:size(files,2)
[s,fs] = audioread([path files{i}]); % Read speech samples, sampling rate and precision from file
s=s(1:2900); %use the same no. of samples for all files
[c_origin,tc_origin]=melcepst(s,fs,w,nc,p,n,inc,fl,fh); %find the MFCC coefficients
mfcc_origin = c_origin'; %find the inverse of MFCC coefficients
mfcc(:,:,i)= mfcc_origin %this is a 12*34*51 target matrix
s_distorted= ifft(fft(s),length(s)/2); %distort the audio signal using time shrinking
[c_distorted,tc_distorted]=melcepst(s_distorted,fs,w,nc,p,n,inc,fl,fh);
mfcc_distorted = c_distorted';
d_mfcc(:,:,i)=mfcc_distorted %this is a 12*15*51 input matrix
end
%so how to train this data using a back propagation neural network?

采纳的回答

Greg Heath
Greg Heath 2016-6-3
1. Of course there is a problem.
EACH of the N I-dimensional input vectors creates ONE O-dimensional output vector.
So, think about what the target of each input column should be.
2. NEWFF is an obsolete function but is still available. However, well before it became obsolete, the syntax was changed.
3. Therefore use the HELP and DOC commands to find the syntax to use with your MATLAB version:
help newff
doc newff
Hope this helps.
Thank you for formally accepting my answer
Greg
  5 个评论
Greg Heath
Greg Heath 2016-6-3
I =15, N=612, and O = 34, N = 612
should not throw an error.
The question is: if you think in terms of vectors does I = 15 --> O = 34 make any kind of sense to you?
Greg
nada fady
nada fady 2016-6-4
编辑:nada fady 2016-6-4
can I use reshape instruction?
input =reshape(input ,[],51)
target =reshape(dtarget,[],51)
[I N ] = size(input) %=[180 51]
[O N ] = size(target) %=[408 51]
is that right?
than kyou very much for replay

请先登录,再进行评论。

更多回答(1 个)

Greg Heath
Greg Heath 2016-6-3
[ I N ] = size(input) % [180, 51]
[ O N ] = size(target) % [408, 51]
Hope this helps.
Greg
  2 个评论
nada fady
nada fady 2016-6-3
Than you for replaying, I used the two commends and I get I=12, N=765, O=12, and N = 1734 is there any problem in this results?
I write this code:
input = [d_mfcc];
target = [mfcc];
[ I N ] = size(input)
[O N ] = size(target)
net= newff(minmax(I), [10, 12], {'tansig', 'purelin'}, 'traingdm');
net= init(net)
[net tr]=train(net,input,target);
but I get this Warning:
Warning: NEWFF used in an obsolete way.
and this error:
Error using nntraining.setupPsetupPerWorker (line 61)
Inputs X is not two-dimensional.
how can I fixed this error?
Greg Heath
Greg Heath 2016-6-5
I am confused w.r.t. all of the posts in this thread:
Bottom line:
The 2nd dimension of the input and target matrices must be the same.
Greg

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Time-Frequency Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by