I have developed a proof of concept system for sound recognition using mfcc and hidden markov models. It gives promising results when I test the system on known sounds. Although the system, when an unknown sound is inputted returns the result with the closest match and the score is not that distinct to devise it is an unknown sound e.g.:

I have trained 3 hidden markov models one for speech, one for water coming out of water tap and one for knocking on the desk. Then I test them on unseen data and get following results:

input: speech
HMM\knocking:  -1213.8911146444477
HMM\speech:  -617.8735676792728
HMM\watertap:  -1504.4735097322673

So highest score speech which is correct

input: watertap
HMM\knocking:  -3715.7246152783955
HMM\speech:  -4302.67960438553
HMM\watertap:  -1965.6149147201534

So highest score watertap which is correct

input: knocking
HMM\filler  -806.7248912250212
HMM\knocking:  -756.4428782636676
HMM\speech:  -1201.686687761133
HMM\watertap:  -3025.181144273698

So highest score knocking which is correct

input: unknown
HMM\knocking:  -4369.1702184688975
HMM\speech:  -5090.37122832872
HMM\watertap:  -7717.501505674925
Here the input is an unknown sound but it still returns the closest match as there is no system for thresholding/garbage filtering.

I know that in keyword spotting an OOV (out of vocabulary) sound can be filtered out using a garbage or filler model but it says it is trained using a finite set of unknown words where this can't be applied to my system as I don't know all the sounds that the system may record.

How is a similar problem solved in speech recognition system? And how can I solve my problem to avoid false positives?


Very good question!

As you mention, the only way to get the HMM to give you an "I don't know" (let's call it OOV) answer is to give it a special state because it always outputs the states with the highest likelihood under your model. So you have to ensure that OOV has higher likelihood under every input that is not speech, watertap or knocking.

The short answer is that this is not possible. Because an HMM is not an absolute pattern recognizer. It only compares the likelihood of the outputs under your model, and in the context it was trained.

Think about an input that would be speech and knocking at the same time. Most likely the HMM will "hesitate" between these two states because this input has features of each. In the end it would output one of those, but it is quite unlikely that it would output OOV. In the case of keyword spotting, my guess is that you could find clever inputs that would consistently fool their HMM. However, the authors probably know what input to expect and they have chosen their finite list of unknown words so that these poisonous inputs are uncommon.

I advise that you do the same. Think about the situations that you will use the HMM and train an OOV state on the most common inputs you wish to eliminate. You can even think of having several OOV states.

  • 2
    $\begingroup$ But how about an hmm based threshold model for gesture recognition described here : herin.kaist.ac.kr/Publication/PS/hklee_PAMI_i09611.pdf . They create a threshold model which is an ergodic hmm that has states of each hmm combined together. "The threshold model acts as a base-line. A candidate gesture is found when a specific gesture model rises above the threshold" But my problem is that I am using java and jahmm library and I don't think it has the option for ergodic hmm. $\endgroup$ – Radek Jun 25 '12 at 8:49
  • $\begingroup$ Like it says in the title, this is an HMM-based algorithm, so it is not an HMM. It seems to me that a pure HMM does not fit your needs, and that a threshold-based classifier is indeed better suited. $\endgroup$ – gui11aume Jun 25 '12 at 9:34

This is somewhat common in the field of gesture recognition. The answer is to create a threshold model as described in the paper by Lee and Kim (1999)

It plays the same role as a filler or garbage model, but it doesn't need to be trained separately as you says. You can create a threshold model by connecting all self-transition states from your other models and initializing the transition with uniform probabilities, fully connecting those states. Please take a look on the paper to see how it can actually be done.

Even if your library does not support ergodic models, it shouldn't prevent you from manually creating a model of the required size and setting the states accordingly. If you would really want a library for that, then implementations for hidden Markov model classifiers including support for threshold models are available in the Accord.NET Framework, for example.

Disclaimer: I am the author of this library.

  • $\begingroup$ Right I can manually create a threshold model. So lets say for example I have two hmm models named: sound1 and sound2. Both have 2 states. Then I create a threshold model with 4 states. Each state has the same initial value which is 0.25. Then I set uniform distribution for all possible transitions so all possible state transitions (0,0), (0,1), (1,0), (1,1), (1,2), (2,1), (2,2), etc. get an uniform distribution of 0.0625. Then for state 1 and 2 of the threshold model I set the opdf of state 1 and 2 from sound1 and for state 3 and 4 of the threshold I set the opdf of state 1 and 2 from sound2. $\endgroup$ – Radek Jun 26 '12 at 14:21
  • $\begingroup$ Is the approach described above correct? $\endgroup$ – Radek Jun 26 '12 at 14:21
  • 1
    $\begingroup$ Not quite... perhaps I was a bit loose on my description. The diagonal elements of your transition matrix for the threshold model receives the original self-transition probabilities from your other models. The transitions from a state to other states are initialized with uniform probabilities. I know it may seems lazy to point it out to the code, but sometimes code is easier to understand than formulas. $\endgroup$ – Cesar Jun 27 '12 at 14:18
  • $\begingroup$ By the way, if you have read the paper by Lee and Kim and have interpreted it differently, or believes my implementation is incorrect, please let me know. $\endgroup$ – Cesar Jun 27 '12 at 14:22

So what I have done is: I created my simplified version of a filler model. Each hmm representing watertap sound, knocking sound and speech sound is a seperate 6 state hmm trained by sounds from training set of 30, 50, 90 sounds respectively of various lengths 0.3 sec to 10 seconds. Then I created a filler model which is a 1 state hmm consisting od all the training set sounds for knocking, watertap and speech. So if the hmm model score is greater for a given sound than the filler's score - sound is recognized otherwise it is an unknown sound. I don't really have large data but I have perfoormed a following test for false positives rejection and true positives rejection on unseen sounds.

true positives rejection
knocking 1/11 = 90% accuracy
watertap 1/9 = 89% accuracy
speech 0/14 = 100% accuracy

false positives rejection
Tested 7 unknown sounds
6/7 = 86% accuracy

So from this quick test I can conclude that this approach gives reasonable results although I have a strange feeling it may not be enough.

  • $\begingroup$ +1 This is very interesting. If you have not forgotten about this work already, did this approach work in the end? Was it enough as a 'filler / other' model? If not, did you implement something else eventually? $\endgroup$ – Zhubarb Mar 24 '15 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.