cmusphinx / sphinx4

Pure Java speech recognition library
cmusphinx.sourceforge.net
Other
1.41k stars 586 forks source link

Running the speakerid demo throws a "matrix is singular" exception. #30

Closed yuraneb closed 9 years ago

yuraneb commented 9 years ago

Have been using Sphinx4 in my projects for a while now, mainly for basic continuous transcription. Decided to play around with the speakerid features, took a look at the speakerid demo. It seems that I can't run the (unmodified) code without getting the above exception.

My process:

  1. Cloned freshly from git.
  2. Fresh build (mvn clean install -X)
  3. Running with java -jar sphinx4-samples-1.0-SNAPSHOT-jar-with-dependencies.jar speakerid

It seems to go through a few iterations (I believe it gets down to the actual "statss collection" step in the inner loop that decodes each segment for a particular speaker), but always crashes before it gets to the second pass loop (the one that actually transcribes and dumps out text).

Here's the exception I'm getting (repeatable 100%):

Exception in thread "main" org.apache.commons.math3.linear.SingularMatrixException: matrix is singular at org.apache.commons.math3.linear.LUDecomposition$Solver.solve(LUDecomposition.java:297) at edu.cmu.sphinx.decoder.adaptation.Transform.computeMllrTransforms(Transform.java:112) at edu.cmu.sphinx.decoder.adaptation.Transform.update(Transform.java:177) at edu.cmu.sphinx.decoder.adaptation.Stats.createTransform(Stats.java:231) at edu.cmu.sphinx.demo.speakerid.SpeakerIdentificationDemo.speakerAdaptiveDecoding(SpeakerIdentificationDemo.java:96) at edu.cmu.sphinx.demo.speakerid.SpeakerIdentificationDemo.main(SpeakerIdentificationDemo.java:121) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at edu.cmu.sphinx.demo.DemoRunner.main(DemoRunner.java:44)

Please take a look at it when you have the time. My very rusty linear algebra remnants tell me that it's probably trying to solve (by inversion) and getting stuck at a singular matrix (divide by 0 determinant), so I'm hoping that it might be a small regression bug that you'd be able to quickly spot. Or it could be something with my setup, either way please have a loot.

edit : A few more details about my setup.

java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

OSX 10.10.3 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64

yuraneb commented 9 years ago

Tried some trivial wrapping of the ABloc solver in a try/catch block within Transform.computeMllrTransforms() and discarding the exception just to see how far it would get - the result is that each segment has a junk timeframe and thus the transcription never happens. No low-hanging fruit here :)

nshmyrev commented 9 years ago

This bug must be fixed now. Please update