CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
AudioIO: add dnn speech recognition sample on C++ #21458
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
Conversation
samples/dnn/speech_recognition.cpp
Outdated
return res; | ||
} | ||
|
||
std::vector<std::vector<double>> mel(int n_mels, double fmin, double fmax) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::vector<std::vector<double>> mel(int n_mels, double fmin, double fmax) | |
vector<vector<double>> mel(int n_mels, double fmin, double fmax) |
samples/dnn/speech_recognition.cpp
Outdated
} | ||
|
||
// STFT preperation | ||
std::vector<double> pad_window_center(std::vector<double>&data, int size) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::vector<double> pad_window_center(std::vector<double>&data, int size) | |
vector<double> pad_window_center(vector<double>&data, int size) |
samples/dnn/speech_recognition.cpp
Outdated
// Pad the window out to n_fft size | ||
int n = static_cast<int>(data.size()); | ||
int lpad = static_cast<int>((size - n) / 2); | ||
std::vector<double> pad_array; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::vector<double> pad_array; | |
vector<double> pad_array; |
samples/dnn/speech_recognition.cpp
Outdated
return pad_array; | ||
} | ||
|
||
std::vector<std::vector<double>> frame(std::vector<double>& x) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::vector<std::vector<double>> frame(std::vector<double>& x) | |
vector<vector<double>> frame(vector<double>& x) |
samples/dnn/speech_recognition.cpp
Outdated
{ | ||
// Slices a data array into overlapping frames. | ||
int n_frames = static_cast<int>(1 + (x.size() - n_fft) / hop_length); | ||
std::vector<std::vector<double>> new_x(n_fft, std::vector<double>(n_frames)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::vector<std::vector<double>> new_x(n_fft, std::vector<double>(n_frames)); | |
vector<vector<double>> new_x(n_fft, vector<double>(n_frames)); |
samples/dnn/speech_recognition.cpp
Outdated
std::vector<double> hanning() | ||
{ | ||
// https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows | ||
std::vector<double> window_tensor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::vector<double> window_tensor; | |
vector<double> window_tensor; |
samples/dnn/speech_recognition.cpp
Outdated
return window_tensor; | ||
} | ||
|
||
std::vector<std::vector<double>> stft_power(std::vector<double>& y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::vector<std::vector<double>> stft_power(std::vector<double>& y) | |
vector<vector<double>> stft_power(vector<double>& y) |
samples/dnn/speech_recognition.cpp
Outdated
// https://en.wikipedia.org/wiki/Short-time_Fourier_transform | ||
|
||
// Pad the time series so that frames are centered | ||
std::vector<double> new_y; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::vector<double> new_y; | |
vector<double> new_y; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for update!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done 👍
AudioIO: add dnn speech recognition sample on C++ * add speech recognition cpp * fix warnings * fixes * fix warning * microphone fix
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.