speech recognition sample#20291
Conversation
|
Please add description at the beginning of sample as in opencv/samples/dnn/human_parsing.py Lines 2 to 40 in b74aae6
|
samples/dnn/speech_recognition.py
Outdated
| if __name__ == '__main__': | ||
|
|
||
| # Computation backends supported by layers | ||
| backends = (cv.dnn.DNN_BACKEND_DEFAULT, cv.dnn.DNN_BACKEND_OPENCV) |
There was a problem hiding this comment.
Could you try forward net with OpenVINO (cv.dnn.DNN_BACKEND_INFERENCE_ENGINE)?
There was a problem hiding this comment.
I tried. It gave this error: error: (-213:The function/feature is not implemented) Unknown backend identifier in function 'cv::dnn::dnn4_v20210301::wrapMat'
samples/dnn/speech_recognition.py
Outdated
|
|
||
| parser = argparse.ArgumentParser(description='This script runs Jasper Speech recognition model', | ||
| formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
| parser.add_argument('--input_audio', type=str, help='Path to input audio file.') |
There was a problem hiding this comment.
Do we need to specify supported audio formats?
There was a problem hiding this comment.
I think we need to add required=True
There was a problem hiding this comment.
Finally, we need to use AudioIO. So, should I add the formats supported there? I suppose mp3, wav and mp4 are supported.
|
@spazewalker Could you please check if approach from #20558 works for this case? |
@alalek Just tested it. It works for this case. |
support for multiple files at once
Co-authored-by: Liubov Batanina <piccione-mail@yandex.ru> fix whitespaces
|
Lets merge it with @spazewalker Please make PR to "Ready for review" if it is ready for merging. |
@spazewalker Ping. Or let us know if you want to improve something else. |
speech recognition sample * speech recognition sample added.(initial commit) * fixed typos, removed plt * trailing whitespaces removed * masking removed and using opencv for displaying spectrogram * description added * requested changes and add opencl fp16 target * parenthesis and halide removed * workaround 3d matrix issue * handle multi channel audio support for multiple files at once * suggested changes fix whitespaces
GSoC 2021: Speech Recognition using OpenCV AudioIO
Project details
PR details
Creating ONNX model
NVIDIA trained jasper using FP16 precision. OpenCV needs FP32. We need to change onnx model's graph. This is done using this script : convert_jasper_to_FP32.py. Pre-trained converted onnx can be found here. Original pre-trained model by NVIDIA can be found here.
Usage
usage: speech_recognition.py [-h] --input_audio INPUT_AUDIO [--show_spectrogram] [--model MODEL] [--output OUTPUT] [--backend {0,2,3}] [--target {0,1,2}] This script runs Jasper Speech recognition model optional arguments: -h, --help show this help message and exit --input_audio INPUT_AUDIO Path to input audio file. OR Path to a txt file with relative path to multiple audio files in different lines (default: None) --show_spectrogram Whether to show a spectrogram of the input audio. (default: False) --model MODEL Path to the onnx file of Jasper. default="jasper.onnx" (default: jasper.onnx) --output OUTPUT Path to file where recognized audio transcript must be saved. Leave this to print on console. (default: None) --backend {0,2,3} Select a computation backend: 0: automatically (by default) 2: OpenVINO Inference Engine 3: OpenCV Implementation (default: 0) --target {0,1,2} Select a target device: 0: CPU target (by default) 1: OpenCL 2: OpenCL FP16 (default: 0)Todo
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.