Building an ASR using HTK CS 4706 Fadi
Building an ASR using HTK CS 4706 Fadi Biadsy Mar 24 th, 2010
Outline l Speech Recognition l Feature Extraction l Modeling l Hidden Markov Models (HMM): 3 basic problems l HMM l 2 Speech Toolkit (HTK) Steps for building an ASR using HTK
Automatic Speech Recognition (ASR) l Speech signal to text ASR 3 There’s something happening when Americans…
It’s hard to recognize speech l Contextual effects l l l Speech sounds vary within contexts l “How do you do? ” l Half and half l /t/ in butter vs. bat Within-speaker variability l Speaking rate, Intensity, F 0 contour l Voice quality l Speaking Style l Formal vs. spontaneous register l Speaker State: Emotion, Sleepy, Drunk, … Between-speaker variability l Gender and age l Accents, Dialects, native vs. non-native l l 4 Scottish vs. American /r/ in some contexts Environment variability l Background noise l Microphone type
Outline l Speech Recognition l Feature Extraction l Modeling l Hidden Markov Models (HMM): 3 basic problems l HMM l 5 Speech Toolkit (HTK) Steps for building an ASR using HTK
Feature Extraction 6 l Wave form? l Spectrogram? l Need representation of speech signal that is robust to acoustic variation but sensitive to linguistic content
Feature Extraction l 7 Extract features from short frames (frame period 10 ms, 25 ms frame size) – a sequence of features
Feature Extraction - MFCC 8 l Mel Scale: Approximate the unequal sensitivity of human hearing at different frequencies l Based on pitch perception
Feature Extraction - MFCC l MFCC (Mel frequency cepstral coefficient) l Widely used in speech recognition 1. Take the Fourier transform of the signal spectrum 2. Map the powers of the spectrum to the mel scale and take the log 3. 4. 9 Discrete cosine transform of the mel log-amplitudes The MFCCs are the amplitudes of the resulting spectrum
Feature Extraction - MFCC l Extract a feature vector from each frame l l 10 l 12 MFCC coefficients + 1 normalized energy = 13 features l Delta MFCC = 13 l Delta-Delta MCC = 13 Total: 39 features Inverted MFCCs: 39 D Feature vector
Outline l Speech Recognition l Feature Extraction l Modeling l Hidden Markov Models (HMM): 3 basic problems l HMM l 11 Speech Toolkit (HTK) Steps for building an ASR using HTK
Markov Chain l 12 Weighted finite state acceptor: Future is independent of the past given the present
Hidden Markov Model (HMM) l HMM is a Markov chain + emission probability function for each state l Markov l HMM Chain M=(A, B, Pi) l A = Transition Matrix l B = Observation Distributions l Pi = Initial state probabilities 13
HMM Example /d/ 14 /aa/ /n/ /aa/
HMM – 3 Basic Problems I. Evaluation II. Decoding III. Training 15
HMM – I. Evaluation l Given an observation sequence O and a model M, how can we efficiently compute: P(O | M) = the likelihood of O given the model? argmaxi P(λi|O) λ 1 argmaxi P(O|λi) P(λi) λN 16
HMM – II. Decoding l Given an observation sequence O and a model M: How can we obtain the most likely state sequence Q = {q 1, q 2, …, qt}? 17
Viterbi Algorithm l Efficient algorithm for decoding O(TN^2) /d/ /aa/ /n/ /aa/ Start End /uw/ /d/ /aa/ /n/ /aa/ => dana 18
HMM – III. Training l How do we estimate the model parameters M=(A, B, Pi) to maximize P(O|M)? l Baum-Welch algorithm /d/ /n/ /aa/ 1) Transition Matrix: A 2) Emission probability distribution: dana => /d/ /aa/ /n/ /aa/ Estimate 19 /aa/
Outline l Speech Recognition l Feature Extraction l Modeling l Hidden Markov Models (HMM): 3 basic problems l HMM l 20 Speech Toolkit (HTK) Steps for building an ASR using HTK
Hidden Markov Model Toolkit (HTK) l HTK is a research toolkit for building and manipulating HMMs l Primarily designed for building HMM-based ASR systems l Tools, for examples: 21 l Extracting MFCC features l HMM algorithms l Grammar networks l Speaker Adaptation l …
Steps for building ASR: Voice-operated interface for phone dialing l Examples: l Dial three two six five four l Phone Woodland l Call Steve Young l Grammar: 22 l $digit = ONE | TWO | THREE | FOUR | FIVE | SIX | SEVEN | EIGHT | NINE | OH | ZERO; l $name = [ JOOP ] JANSEN | [ JULIAN ] ODELL | [ DAVE ] OLLASON | [ PHIL ] WOODLAN l ( SENT-START ( DIAL <$digit> | (PHONE|CALL) $name) SENT-END )
Convert Grammar to Network (HParse) 23
Training the system Lab files: S 0001 ONE VALIDATED ACTS OF SCHOOL DISTRICTS S 0002 TWO OTHER CASES ALSO WERE UNDER ADVISEMENT S 0003 BOTH FIGURES WOULD GO HIGHER IN LATER YEARS 24 Wave files A A A CALL DIAL EIGHT PHONE … ah sp ax sp ey sp k ao l sp d ay ax l sp ey t sp f ow n sp
Words to Phones (using HLEd) l 25 HTK scripting language is used to generate phonetic transcription for all training data
Extracting MFCC (using HCopy) l For each wave file, extract MFCC features. l . wav . mfc files 26
Specifying Monophone HMM Topology l 5 states: 3 emitting states /r/ S 1 l Flat S 2 S 3 S 4 S 5 Start: Mean and Variance are initialized as the global mean and variance of all the data 27
Training (HERest) l For each training pair of files (mfc+lab): 1. Concatenate the corresponding monophone HMMs 2. Use the Baum-Welch Algorithm to train the HMMs given the MFC features One validated acts of school districts… /w/ S 1 28 S 2 S 3 /n/ /ah/ S 4 S 5 S 1 S 2 S 3 S 4 S 5
Training l So far, we have all monophone models trained l Train the short pause (sp) model 29
Handling Multiple Pronunciations (HVite) l The dictionary contains multiple pronunciations for some words. l Forced alignment /d/ /ey/ /t/ /ax/ Run Viterbi to get the best pronunciation that matches the acoustics /ae/ 30 /dx/
Handling Multiple Pronunciations l The dictionary contains multiple pronunciations for some words. l Forced alignment /ey/ Run Viterbi to get the best pronunciation that matches the acoustics /dx/ 31
Retrain l After getting the best pronunciation l 32 => Train again using Baum-Welch algorithm using the best pronunciations
Creating Triphone Models (using HLEd) l Phones may be realized differently in some contexts Build context-dependent acoustic models (HMMs) l Triphones: One preceding and succeeding phone l Make triphones from monophones l Generate a list of all the triphones for which there is at least one example in the training data l s-l+ow b-l+aa p-l+aa jh-oy+s f-iy+t … l l l 33
Tie Triphone (HDMan) l Clustering by growing decision trees l All states in the same leaf will be tied t+ih t+iy ao-r+ax t+oh ao-r+iy t+uh t+uw sh-n+t sh-n+z ch-ih+l ay-oh+r 34 t+ae r t+ae sh-n+t ay-oh+l L = Class-Stop ? L = Nasal ? n R = Glide? n y y n R = Nasal ? y
After Tying l Train the acoustic models again using Baum-Welch algorithm (HERest) l Increase the number of Gaussians for each state l 35 HHEd followed by HERest
Decoding (HVite) l Using the compiled grammar network (WNET) l Given a new speech file: 36 l Extract the mfcc features (. mfc file) l Run Viterbi on the WNET given the. (mfc file) to get the most likely word sequence
Summary l MFCC Features l HMM 3 basic problems l Steps for Building an ASR using HTK: 37 l Features and data preparation l Monophone topology l Flat Start l Training monophones l Handling multiple pronunciations l Context-dependent acoustic models (triphones) + Tying l Final Training l Decoding
Thanks! 38
HMM – III. Training l Pronunciation Dictionary A A CALL DIAL EIGHT PHONE TWO … 39 ah sp ax sp k ao l sp d ay ax l sp ey t sp f ow n sp t uw sp
- Slides: 39