1 / 44

Isolated Digit Recognizer using GMM’s

Isolated Digit Recognizer using GMM’s. ECE5526 FINAL PROJECT SPRING 2011 JIM BRYAN. Abstract. Provide an in depth look at how GMM’s can be used for word recognition based on Matlab’s statistical toolbox.

julio
Download Presentation

Isolated Digit Recognizer using GMM’s

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Isolated Digit Recognizer using GMM’s ECE5526 FINAL PROJECT SPRING 2011 JIM BRYAN

  2. Abstract • Provide an in depth look at how GMM’s can be used for word recognition based on Matlab’s statistical toolbox. • The isolated digit recognizer is based on a voice activity detector using energy thresholding and zero crossing detection. Moveover, the recognizer uses MFCC’s as the basis for acoustic speech representation. These are standard voice processing techniques which it is assumed the reader is familiar with. The focus of this presentation is on the details the GMM implementation in Matlab, with the idea that a good understanding of the Matlab approach will yield insight to other system implementations such as Sphinx and HTK. • Word recognition is comprised of two components, Model training and Model testing. • The statistical toolbox functionGmmdistribution.fit is used for training • The statistical toolbox Postprioriis used for testing • The purpose of this effort is to train and run the recognizer, and to understand the basic functionality of functionGmmdistribution.fit andPostpriorifuncioncalls.

  3. Introduction • Based on MATLAB Digest - January 2010Developing an Isolated Word Recognition System in MATLABBy Daryl Ning • Describe the Matlab GUI base recognizer application • Provide introductory material on GMM’s using a simple 2 Mixture example with 2 models • Discuss in detail the algorithms used to determine the best model match • Show examples of Matlabs statistical toolbox representation of GMM’s • Run the simulation • Discuss simulaton results and show possible improvements • Summary • Conclusions • Areas for further study

  4. Isolated digit recognizer overview • Uses 8 GMM’s per digit to train and recognize an individual users voice • Matlab GUI based digit recognizer uses the following toolboxes • Signal Processing toolbox provides a filtering and signal processing functions • Statistics toolbox is used to implement a GMM Expectation Maximization algorithm to build the GMM’s and to compute the Mahalnobis distance during recognition • Data acquisition toolbox is used to stream the microphone input to Matlab for continous recognition • Single digit recognizer implemented using dictionary of digits 0 – 9 • Training is done with 30 second captures of repeated utterance of the given digit using the wavread function in Matlab • Data is input continuously to Matlab via the data acquisition toolbox while the GUI recognizer is running • The recognized digit is displayed on the GUI

  5. Overview Continued • Uses laptop’s internal microphone • Sample rate is 8ksps • Uses 20msec frames with a 10 msec overlap with a frame size of 160 samples per frame • Uses a simple voice activity detector based on energy threshold and zero crossings per second for both training and the recognizer • Voice activity energy and zero crossing thresholds are programmable and must be the same for training and recognition • No model for silence or missed digit, so the recognizer displays the closest digit

  6. GMM training and recognizer Matlab function calls • The recognizer compute the posterior probabilities using the Statistics Toolbox function ‘posterior’ • ‘Posterior’ accepts a gmm object/model as its input, along with an input data set, and returns a log-likelihood number that represents the data set match to the model • The smallest log-likelihood has the highest posterior probability • The recognizer computes the probability of the current “word” to each model in the dictionary. The model that has the lowest posterior probability is the recognized digit. • A gmm object is created during training for each dictionary entry, in this case digits 0-9, using the function call gmdistribution.fit.

  7. Example using 2 GMM’s with 2 mixtures

  8. Posterior • Posterior extracts gmdistributionobject parameters necessary to call Wdensity • Wdensityperforms the actual log-likely-hood calculation for the GMM, given the data set • Wdensityreturns two arrays • log_lh is an array of size length(data)x order(GMM) • mahalaD is an array of size length(data)x order(GMM), this is not the actual Mahalnoblis distance • mahalaD = (x -Ω)Σ-1 (x -Ω)T • Estep calculates the loglikelihood based on the log_lh array and returns ll which is the loglikelihood of data x given the model

  9. Wdensity function description Example funtioncall [log_lh,mahalaD]=wdensity(X, mu, Sigma, p, sharedCov, CovType) • Where X is input data • Mu is an array of means with(j,:) corresponding to jth mean vector • Sigma is an array of arrays with (:,:,j) corresponding to the jth sigma in the model • P are the mixture weights • sharedCov indicates the covariance matrices may be common to all mixtures • CovType may be either diagonal or full

  10. Wdensity log-likelihood calculation ,

  11. Wdensity log-likelihood implementation details L = sqrt(Sigma(:,:,j)); % a vector xRinv = bsxfun(@times,Xcentered , (1./ L)); mahalaD(:,j) = sum(xRinv.^2, 2); log_lh(:,j) = -0.5 * mahalaD(:,j) +... (-0.5 *logDetSigma + log_prior(j)) - *log(2*pi)/2; Xcentered = bsxfun(@minus, X, mu(j,:));

  12. estep • [ll, post, logpdf]=estep(log_lh) • Find the max of each row of log_lh matrix • This represents the closest distance to the jth mixture for this data point. • Convert log_ih distance probabilities by usingpost = exp(bsxfun(@minus, log_lh, maxll)), there will always be a 1 in the column of the maximum value, therefore this number is always >=1 • Sum across the rows to normalize the relative probabilities density = sum(post,2); • normalize posteriors post = bsxfun(@rdivide, post, density) • Calculate thelogpdf = log(density) + maxll; • ll = sum(logpdf)

  13. Estep example showing log_lhinputsfor two Gaussian Mixtures and the Maximum value of the log_lh P11 data from model

  14. Estep example showing Post and density,density is used to normalize post P11 data from model

  15. Estep example showing post after normalizationand logpdf P11 data from model

  16. Estep example showing log_lh inputsfor two Gaussian Mixtures and the Maximum value of the log_lh P12 Data not from Model

  17. Estep example showing Post and density,density is used to normalize post Data not from model P12

  18. Estep example showing post after normalizationand logpdfP12 data not from model

  19. Log-likelihood for 2 mixture example P =Nlogl = -ll 55.3416 109.3820 184.7868 42.8043 The diagonal term are the case where the data came from the model The off diagonal terms represent when the data came from the other model

  20. Gaussian Models in Matlab

  21. Model for ‘one’

  22. Gaussian Mixture Distribution Structure ‘one’

  23. 8 Gaussian model means 8x39 ‘one’

  24. Diagonal Covariance Matrix

  25. Training the GMM’s • Before recording can begin it is necessary to set the laptops internal microphone • Training involves finding a quiet environment and recording 30 seconds of utterance for each digit • These are captured using Matlabswavrecord • y = wavrecord(30*8000,8000); • There is a utility supplied that allows viewing the Voice Activity detection algorithm in order to determine correct captures of the training data • speechdetect(y);

  26. Trainmodels overview • Generates Frames of speech base on 160 samples/frame with an 80 sample overlap • Uses the same energy detect and zero crossing thresholds as the recognizer • Determines portions of voiced speech based on these thresholds as well as a minimum of 250msec duration for each word • A minimum of 100msec is required between each word • Frames are marked as VA, voice active, and stored in a buffer call ALLdata. • ALLdata is arranged so that the frames are in columns, the dimensions are 160xnumFRAMES • Once all the words are captured, MFCC is called which is passed the ALLdata buffer for Mel cepstral coefficient processing • MFCC returns MFCC vectors that are 39 coefficients per frame • Gmmdistribution.fit is passed the MFCC vectors which runs an EM algorithm on the MFCC vectors to generate an 8 Mixture GMM for each digit

  27. MFCC credits Derived from the original function 'mfcc.m' in the Auditory Toolbox % written by: % % Malcolm Slaney % Interval Research Corporation % malcolm@interval.com % http://cobweb.ecn.purdue.edu/~malcolm/interval/1998-010/ % % Also uses the 'deltacoeff.m' function written by: % % OlutopeFolusoOmogbenigun % London Metropolitan University % http://www.mathworks.com/matlabcentral/fileexchange/19298

  28. MFCC overview • Pre-filter the data using a pre-emphasis filter • preEmphasized = filter([1 -.97], 1, input); • Window the data with a Hamming window • preEmphasized = preEmphasized.*repmat(hamWindow(:),1,frames); • fftMag = abs(fft(preEmphasized,fftSize)); • earMag = log10(mfccFilterWeights * fftMag); • ceps = mfccDCTMatrix * earMag; • meanceps = mean(ceps,2); • ceps = ceps - repmat(meanceps,1,frames); • d = (deltacoeff(ceps')).*0.6; %Computes delta-mfcc • d1 = (deltacoeff(d)).*0.4; %as above for delta-delta-mfcc • ceps = [ceps; d'; d1']; %concatenates all together • Return vector of 13 cep, 13 diff and 13 diff diff coefficients

  29. Sound Settings for Microphone on Windows 7 laptop

  30. Voice Activity Detector Overview • Voice activity detection based on energy detection and zero crossing rate • std_zxings: is the zero crossing threshold, default = .5 • std_energy: is the energy detect threshold, default = .5 • Energy and zero crossings thresholds are determined during the first 500msec of training to determine the background silence energy and zero crossing rate • The same threshold settings must be used for all digit recordings • Once a good recording has been made, save it to the hard drive using; • wavwrite(y,8000,‟one.wav‟); • Repeat for all the digits • Run “transcript” and this will train the GMM’s

  31. Authors Ideal Voice Activity detector

  32. Voice Detect using default thresholdsdigit = ‘one’

  33. Voice Detect using default thresholds 1,1 digit = ‘one’

  34. Voice Detect using default thresholds 1.5,1.5 digit = ‘one’

  35. Transcript reads each model and calls trainmodels y = wavread('one.wav'); trainmodels(y,'one'); y = wavread('two.wav'); trainmodels(y,'two'); y = wavread('three.wav'); trainmodels(y,'three'); y = wavread('four.wav'); trainmodels(y,'four'); y = wavread('five.wav'); trainmodels(y,'five'); y = wavread('six.wav'); trainmodels(y,'six'); y = wavread('seven.wav'); trainmodels(y,'seven'); y = wavread('eight.wav'); trainmodels(y,'eight'); y = wavread('nine.wav'); trainmodels(y,'nine'); y = wavread('zero.wav'); trainmodels(y,'zero');

  36. GMM dimensions for typical utterance • Assume average digit length is 300 mSec • Fs = 8000Hz • 1/Fs = 125μsec • 160 samples/Fs = 20msec • Since overlap and add using 50 % Hamming widow, 1 Frame occurs every 10msec • Average number of frames per word 300/10 = 30 • MFCC takes in 30x160 samples and produces 30x39 MFCC vectors on average • Average size of log_lhvector per word for 8 Gaussian mixtures = 30x8 • Log-likelihood based on average 30x8 matrix

  37. Voice Activity detect filter implemented as a 128 tap FIR filter based on a Chebyschev window with 40 dB sidelobeattenation

  38. Voice detector using 125-750 Hz 128 tap Chebyshevbandpass filter with 40 dB side lobe suppression and 20mse pre oneshot with 40msec post oneshot digit = ‘one’

  39. Training Vector for digit ‘one’ after modified VA detection

  40. Scoring • Difficult to score based on the real time recognizer. • Recognizer “fires” on ambient noise • Recognizer is slow as it has to perform GMM calculation for all dictionary entries • Recorded test set of test set, counting from 1-9,0 produced 70% accuracy two and seven and eight did not correctly classify • Had to lower zerocrossing threshold for test to collect all the utterances • Accuracy might be due to insufficient training data • Could have bad models for some of the “classes” • Hand scoring difficult because must correctly label each utterance for the classifier. Seven had a null portion in the middle • Lap top computers fan kicked on during training, this caused ambient noise during training so data set was not perfect

  41. Test Set counting 1-9,0 and repeatframe based with silence removed

  42. Summary • An 8 mixture GMM’s for speech recognition were demonstrated. Using only a small training set and an laptop microphone, digit recognition was demonstrated using only 8000Hz sample rate • Care and feeding of the GMM’s is very important for successful implementation. • Garbage in, garbage out is especially true for speech recognition • Background noise is a very big problem in accurate speech recognition. Adaptive noise cancellation using a second microphone for just the background noise should improve accuracy • The voice activity detector is a critical component of the recognizer • Scoring is also a difficult problem as the acoustic data must be synchronized with the dictionary to provide accurate results • Marking the speech pattern and word isolation is not without difficulties as pauses between syllables occur during a single utterance

  43. Conclusion • GMM’s are very powerful models for speech recognition. • Scoring the models is difficult. The EM algorithm will produce different models based on the random seeding of the starting conditions. • Simple utterances of ~15 repetitions is not sufficient for good GMM accuracy • The voice activity detector plays a significant part in the training and testing of the data • A new voice activity detector did not magically produce 100 percent scoring accuracy with a recorded test wav file • Noise cancellation techniques and sophisticated voice detection algorithms are necessary for good performance as well as model optimization

  44. Areas for further investigation • Automate the scoring process • Improve the Voice activity detector in the real time recognizer • Add a second microphone for adaptive noise cancellation • Convert GMM’s to combination GMM’s and HMM’s so dictionary search isn’t so computationally intensive • Modify the number of mixtures of the GMM’s with HMM phonetic implementation • HMM’s will allow for continuous digit recognition

More Related