Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help required related to feature extraction methods and training data in matlab

Status
Not open for further replies.

mzoh

Newbie level 4
Joined
Nov 2, 2017
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
63
Hello,

I am doing research on Drones identification using audio recognition to detect drones. For this i am using feature extraction methods like MFCC, HLA and for calssification using SVM and HMM. I want to know about training procedure. When training step will occur before feature extraction or after this. And how we train our data in Matlab. Can anybody shares good tutorial related to this or matlab code related to this.

Anybody who has worked on Harmonic line association algorithm then please share tutorial related to this.

It would be very helpful if you can share MFCC and SVM matlab codes which can identify the sounds things. If anybody has worked on this then please help me in this regard.

Waiting for your help.

Thanks
 

It would make no sense do not the training after the feature extraction, the main purpose of this process is to highlight the information of interest, and for the training stage, how much less unnecessary information, the better. Anyway, as far as I know, SVM does not necessarily require this to be done, because that algorithm does not go into the details of the information being processed, but computes the raw data completely; it is intended to use with classification, not pattern recognition, therefore being not suitable to that application. There are other mothods, such as SIFT that you could have a look.
 

Thanks for your response.
So we do training before feature extraction. Can you share good tutorial on training data in matlab. Like i have different sounds of drones, birds and cars. How can i train this data in matlab.

And i need some help in MFCC feature extraction in matlab, can you please share matlab code for this.

Wait for your response.
 

I may have been not clear, but the sequence is: Extracting feature and then training. Anyway, I do not have any code, and the source of research I would take for that is the MathWorks website that has a lot of information, besides codes.
 

Thanks for your reply.

I got the MFCC code below but its not running giving errors. I am running it on matlab2010. Can you help me out regarding this code.

MFCC Code for speech regonition:
Code:
AI=analoginput('winsound',1);
addchannel(AI,1);
set(AI,'samplerate',16000);
set(AI,'samplespertrigger',2*16000);
set(AI,'triggertype','immediate');
start(AI);
data=getdata(AI);
fs=16000;
%file = sprintf('%s%d.wav','database_new kar',i);
%%wavwrite(data,16000,file);

%% Computing MFCC Co-efficients..
    %% (1) Frame Blocking..
    N = 256;   % N point FFT
    M = 100;   % Overlapping

    NN = floor(N/2+1); %N/2
    nbFrames = ceil((length(data)-N)/M);
    Frames = zeros(nbFrames+1,N);
    for i = 0:nbFrames-1
        temp = data(i*M+1:i*M+N);
        Frames(i+1,1:N) = temp; 
    end

    % Last Frame..
    temp = zeros(1,N); 
    lastLength = length(data)- nbFrames*M;
    temp(1:lastLength) = data(nbFrames*M+1:(nbFrames*M +1 + lastLength-1));  
    Frames(nbFrames+1, 1:N) = temp;
    %% (2) Windowing..
    frameSize = size(Frames); 
    nbFrames = frameSize(1); 
    nbSamples = frameSize(2); 
 
    % Hamming window.. 
    w = hamming(nbSamples); 
    Windows = zeros(nbFrames,nbSamples);
    for i = 1:nbFrames
        temp = Frames(i,1:nbSamples); 
        Windows(i, 1:nbSamples) = w'.*temp; 
    end
    %% (3) Fourier Transform..
    ffts = fft(Windows');
    %% (4) Mel-frequency Wrapping..
    % (a) Calculate Power spectrum..
    PowSpecs = abs(ffts).^2;
    PowSpecs = PowSpecs(1:NN-1,:);
    % (b) Mel filter generation
    nof_c = 20; % Number of channels..
    df = fs/N;
    Nmax = N/2;
    fmax = fs/2;

    % Convert to mel scale..
    melmax = 2595*log10(1+fmax/700);

    melinc = melmax/(nof_c+1);

    melcenters = (1:nof_c).*melinc;

    % Convert to frequency scale.. 
    fcenters = 700*((10.^(melcenters./2595))-1);

    centerf = round(fcenters./df);

    startf = [1,centerf(1:nof_c-1)];
    stopf = [centerf(2:nof_c),Nmax];

    W = zeros(nof_c,Nmax);

    % Making filter..
    for i = 1:nof_c
        increment = 1.0/(centerf(i)-startf(i));
        for j = startf(i):centerf(i)
            W(i,j) = (j-startf(i))*increment;
        end
   
        decrement = 1.0/(stopf(i)-centerf(i));
        for j = centerf(i):stopf(i)
            W(i,j) = (j-centerf(i))*decrement;
        end 
    end
    % Normalising..
    for i = 1:nof_c
        W(i,:) = W(i,:)/sum(W(i,:));
    end
    
    % (c) Apply mel filters to Power spectrum coeffs..
    melPowSpecs = W*PowSpecs;
    % (d) MFCC calculations..
    melCeps = dct(log(melPowSpecs));
    melCeps(1,:) = [];
    
    load CodeBook
	dist_min = inf;
	spkr = 0;
	for ind = 1:length(codebook)
		single_cb =  codebook{ind};
		[M1, N1] = size(melCeps);
		[M2, N2] = size(single_cb);  
		dist_temp = zeros(N1,N2);
		if N1<N2
            repli = zeros(1,N2);
            for n1 = 1:N1
                dist_temp(n1,:) = sum((melCeps(:,n1+repli) - single_cb).^2,1);
            end
        else
            repli = zeros(1,N1);
            for n2 = 1:N2
                dist_temp(:,n2) = sum((melCeps - single_cb(:,n2+repli)).^2,1);
            end
        end
        dist_temp = sqrt(dist_temp);
		dist_val(ind) = sum(min(dist_temp,[],2))/size(dist_temp,1);
		if dist_val(ind) < dist_min
            dist_min = dist_val(ind);
			spkr = ind;
		end
	end
	msg = sprintf('The Speaker is found);
    	disp(msg);
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top