Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensorflow #296

Merged
merged 10 commits into from
Dec 11, 2017
Merged

Tensorflow #296

merged 10 commits into from
Dec 11, 2017

Conversation

chriamue
Copy link
Contributor

@chriamue chriamue commented Dec 1, 2017

Tensorflow audio commands recognition as shown here: https://www.tensorflow.org/versions/master/tutorials/audio_recognition
Model and Label file can be downloaded here: http://download.tensorflow.org/models/speech_commands_v0.01.zip

An example can be like this:
import speech_recognition as sr
r = sr.Recognizer()
m = sr.Microphone()
def callback(recognizer, audio):
try:
spoken = recognizer.recognize_tensorflow(audio, tensor_graph='speech_recognition/tensorflow-data/conv_actions_frozen.pb', tensor_label='speech_recognition/tensorflow-data/conv_actions_labels.txt')
print(spoken)

with m as source:
r.adjust_for_ambient_noise(source)
stop_listening = r.listen_in_background(m, callback, phrase_time_limit=1)

@Uberi
Copy link
Owner

Uberi commented Dec 5, 2017

Hi @chriamue,

Looks good to me! If you're done with this PR, I'd be happy to merge it. I did notice you also have a deepspeech branch, so if you'd rather merge that one, just let me know.

@chriamue
Copy link
Contributor Author

chriamue commented Dec 6, 2017

I cannot fix following error, because without this import the given graph can not been used.

$ flake8 --ignore=E501,E701 speech_recognition tests examples setup.py
speech_recognition/init.py:1234:13: F401 'tensorflow.contrib.framework.python.ops.audio_ops as contrib_audio' imported but unused

@chriamue
Copy link
Contributor Author

You can merge now. The needed tensorflow import depends on the model. So the user has to import
it himself, like in the tensorflow commands example.

@Uberi
Copy link
Owner

Uberi commented Dec 11, 2017

LGTM 👍

@Uberi Uberi merged commit 19dc36e into Uberi:master Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants