alumae / kaldi-gstreamer-server

Real-time full-duplex speech recognition server, based on the Kaldi toolkit and the GStreamer framwork.
BSD 2-Clause "Simplified" License
1.07k stars 341 forks source link

Gstreamer appsrc #55

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi,

I'm currently using modified librispeech models and I wanted to do some online experiments with kaldinnet2onlinedecoder but when starting the worker, Gstreamer appsrc end up with an error I can't figure out how to fix :

File "kaldigstserver/worker.py", line 368, in <module>
    main()
  File "kaldigstserver/worker.py", line 348, in main
    decoder_pipeline = DecoderPipeline2(conf)
  File "/vol/experiments/fboye/kaldi-gstreamer-server/kaldigstserver/decoder2.py", line 24, in __init__
    self.create_pipeline(conf)
  File "/vol/experiments/fboye/kaldi-gstreamer-server/kaldigstserver/decoder2.py", line 60, in create_pipeline
    self.appsrc.set_property("is-live", True)
AttributeError: 'NoneType' object has no attribute 'set_property'

I thought it was a problem with Gstreamer plugins or with the online tools from Kaldi but it doesn't seem to be the case. All the tests worked and all decoder properties were set. Do you have any idea how to fix that?

Thank you in advance.

P.S : post-precessor and full-post-processor properties are only used with the GMM-model decoder, am I right?

alumae commented 8 years ago

This usually happens when the plugin is not found. You can set the path by something like:

export GST_PLUGIN_PATH=~/tools/gst-kaldi-nnet2-online/src
alumae commented 8 years ago

P.S. post-processor and full-post-processor properties can be used with nnet2 models.

ghost commented 8 years ago

Thank your for your answer!

I already set KALDI_ROOT et GST_PLUGIN_PATH and gst-inspect-1.0 kaldinnet2onlinedecoder printed me the properties properly. I tried different approaches to set manually is-live to TRUE but it didn't work.

For 'post-processor' and 'full-processor' (logging also), the properties aren't found nor when looking at the list properties for kaldinnet2onlinedecode..

I used sample_english_nnet2.yaml with modified parameters by the way!

alumae commented 8 years ago

Can you post your yaml file?

ghost commented 8 years ago

Sure, here it is (in plain text file I couldn't post a yaml file?) : sample_librispeech.txt. I only changed the models and values from sample_english_nnet2.yaml

The commented lines gave me AttributeError

alumae commented 8 years ago

Can you post the file that causes the problem, without commenting out lines? There are many commented lines in the file you gave.

alumae commented 8 years ago

BTW, post-processor and full-post-processor are not properties of the decoder, but rather global properties. The corresponding lines should not be intented, just like in the original sample_english_nnet2.yaml. But it's hard to tell from your commented file is this what you did.

ghost commented 8 years ago

The only file I modified is sample_english_nnet2.yaml. Each commented line gave me an TypeError (and not an AttributeError sorry), basically :

TypeError: object of type Gstkaldinnet2onlinedecoder' does not have property 'x'

If I comment them I end up with the error I mentioned in my first post. All the errors are from kaldigstserver/decoder2.py, line 62 for the first error mentioned and line 59 for the others!

alumae commented 8 years ago

I need to see the exact file that causes you the problem.

ghost commented 8 years ago

Hi,

I sent you an email.

I've redone all the install (kaldi, gst-kaldi-nnet2-online and kaldi-gstreamer-server), checked the packages dependencies and launched the command line (without modifications of any files) :

python kaldigstserver/worker.py -u ws://localhost:8888/worker/ws/speech -c sample_english_nnet2.yaml

I end up with the same error I described in my first post. The master is okay, kaldinnet2onlinedecoder is found but the worker doesn't start.

alumae commented 8 years ago

Turned out it was caused by the 'appsrc' GStreamer element not being found. Probably caused by broken install of GStreamer or something similar.

HoneywellDemo0623 commented 5 years ago

I run into a similar problem with running Kaldi "worker". Here is the error message:

AttributeError: 'NoneType' object has no attribute 'set_property'

=================================================== sudo python kaldigstserver/worker.py -u ws://localhost:8888/worker/ws/speech -c sample_worker.yaml DEBUG 2019-01-22 08:35:06,207 Starting up worker 2019-01-22 08:35:06 - INFO: decoder: Creating decoder using conf: {'timeout-decoder': 10, 'post-processor': "perl -npe 'BEGIN {use IO::Handle; STDOUT->autoflush(1);} s/(.*)/\1./;'", 'logging': {'version': 1, 'root': {'level': 'DEBUG', 'handlers': ['console']}, 'formatters': {'simpleFormater': {'datefmt': '%Y-%m-%d %H:%M:%S', 'format': '%(asctime)s - %(levelname)7s: %(name)10s: %(message)s'}}, 'disable_existing_loggers': False, 'handlers': {'console': {'formatter': 'simpleFormater', 'class': 'logging.StreamHandler', 'level': 'DEBUG'}}}, 'decoder': {'word-syms': 'test/models/english/voxforge/tri2b_mmi_b0.05/words.txt', 'model': 'test/models/english/voxforge/tri2b_mmi_b0.05/final.mdl', 'lda-mat': 'test/models/english/voxforge/tri2b_mmi_b0.05/final.mat', 'fst': 'test/models/english/voxforge/tri2b_mmi_b0.05/HCLG.fst', 'silence-phones': '1:2:3:4:5'}, 'silence-timeout': 60, 'out-dir': 'tmp', 'use-vad': False} 2019-01-22 08:35:06 - INFO: decoder: Setting decoder property: word-syms = test/models/english/voxforge/tri2b_mmi_b0.05/words.txt Traceback (most recent call last): File "kaldigstserver/worker.py", line 419, in main() File "kaldigstserver/worker.py", line 411, in main decoder_pipeline = DecoderPipeline(conf) File "/home/haudio/ai/tools/kaldi/tools/kaldi-gstreamer-server/kaldigstserver/decoder.py", line 25, in init self.create_pipeline(conf) File "/home/haudio/ai/tools/kaldi/tools/kaldi-gstreamer-server/kaldigstserver/decoder.py", line 55, in create_pipeline self.asr.set_property(key, val) AttributeError: 'NoneType' object has no attribute 'set_property'

gilamsalem commented 5 years ago

@HoneywellDemo0623 The issue is that the decoder failed to load the gstreamer plugin onlinegmmdecodefaster. If you compiled it successfully, you should be able to run (from ~/kaldi/src/gst-plugin): gst-inspect-1.0 onlinegmmdecodefaster If the command run successfully, check that you set GST_PLUGIN_PATH env to the right path. You can check it with running: GST_PLUGIN_PATH=~/kaldi/src/gst-plugin gst-inspect-1.0 onlinegmmdecodefaster (set kaldi root directory to the right path)