Clear Filters
Clear Filters

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

3 views (last 30 days)
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?

Accepted Answer

Greg Heath
Greg Heath on 3 Jun 2016
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 Comments
Greg Heath
Greg Heath on 3 Jun 2016
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 on 4 Jun 2016
Edited: nada fady on 4 Jun 2016
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

Sign in to comment.

More Answers (1)

Greg Heath
Greg Heath on 3 Jun 2016
[ I N ] = size(input) % [180, 51]
[ O N ] = size(target) % [408, 51]
Hope this helps.
Greg
  2 Comments
nada fady
nada fady on 3 Jun 2016
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 on 5 Jun 2016
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

Sign in to comment.

Categories

Find more on Time-Frequency Analysis 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!