Speech Recognition by Baidu AI (online)

From RobotForAll
Jump to: navigation, search

To run the code in this tutorial, you need first download the package. https://github.com/hutslib/rchome_tutorial Put robocup_speech_tutorial package in your catkin_ws.

$ cd ~/catkin_ws
$ catkin_make

In order to run vision detection via baidu AI, what you need to do is first register in baidu AI. After you have register and log in, you need to register a application based on your need (eg. gender detect) and your need to remember your AK and SK.

$ cd ~/catkin_ws/src/robocup_speech_tutorial

In this folder you can find a scripts named baidu_text_detect.py Change the AK and SK with your own ones and the path of the record. Follow the examples in the code.

$ python baidu_recognition_text.py

You can see the result in the result_path

If you want to use this function in your task, annotate the main function and import this function. you can call this function in your code just as the example in main now. The function will return the result as a string.

If you want to use baidu to do other speech perception, you may need to change the url with the correct ones and you may also need to modify the scripts a little bit according to the specific API.