Speech recognition method and device, computer device and storage medium
By adaptively adjusting the search area for speech recognition, the problem of high computational cost in the dynamic time warping algorithm is solved, resulting in more efficient speech recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN GRANDSTREAM NETWORKS TECH
- Filing Date
- 2023-06-26
- Publication Date
- 2026-06-12
AI Technical Summary
In existing technologies, dynamic time warping algorithms involve a large amount of computation during speech recognition due to the empirical determination of the search area, which affects recognition efficiency.
By acquiring the duration of the effective and invalid parts of the test and reference speech feature data, the target search region is determined, and the speech recognition result is determined based on the speech matching degree and preset threshold. The search region is adaptively adjusted to reduce unnecessary computation.
It improves the efficiency and accuracy of speech recognition, reduces unnecessary computation, and enhances search performance.
Smart Images

Figure CN116721655B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, specifically to a speech recognition method, apparatus, computer device, and storage medium. Background Technology
[0002] In speaker-specific isolated word speech recognition, dynamic time warping (DTW) is often used. This algorithm is a template matching algorithm that uses dynamic programming (DP) to effectively solve the problem of inconsistent frame lengths of speech signal feature parameters (which manifests as varying pronunciation times due to changes in speech rate in the field of speech recognition). It calculates the minimum distance between the test speech signal and the reference speech signal, which requires searching for the minimum path within the entire area formed by the test speech signal and the reference speech signal.
[0003] In related technologies, limiting the search range reduces the computational load of DTW (Data Decomposition and Written Language). A common method is the parallelogram region constraint method (e.g., ...). Figure 1 The algorithm uses both the shaded area in the middle and the strip region constraint method set by human experience. However, when using the strip region constraint method to search for the minimum path, there are technical problems such as excessive computation, excessive memory consumption, and excessive computation time, which affect the recognition efficiency of the dynamic time warping algorithm in the speech recognition process. Summary of the Invention
[0004] This application provides a speech recognition method, apparatus, computer device, and storage medium to solve the technical problem that the dynamic warping algorithm involves unnecessary calculations due to the empirical determination of the search area, resulting in a large amount of computation and affecting the speech recognition efficiency.
[0005] On the one hand, this application provides a speech recognition method, including:
[0006] A test template for obtaining test speech data to be recognized is provided. The test template includes test speech feature data and test duration. The test speech feature data is valid speech feature data extracted from the original test speech feature data.
[0007] A reference template for obtaining reference speech data of the target object is provided. The reference template includes reference speech feature data and reference duration. The reference speech feature data is valid speech feature data extracted from the original reference speech feature data.
[0008] Obtain the first duration of invalid speech feature data in the original test speech feature data, and the initial value of the test duration of the first duration;
[0009] Obtain the second duration of invalid speech feature data in the original reference speech feature data, and the initial value of the reference duration of the second duration;
[0010] The target search area formed by the test template and the reference template is determined based on the test duration, the reference duration, the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration;
[0011] Determine the speech matching degree between the test template and the reference template in the target search area, and determine the speech recognition result of the test template based on the speech matching degree and the preset matching degree threshold.
[0012] On the one hand, this application provides a voice recognition device, including:
[0013] The first acquisition module is used to acquire a test template for the test speech data to be recognized. The test template includes test speech feature data and test duration. The test speech feature data is valid speech feature data extracted from the original test speech feature data.
[0014] The second acquisition module is used to acquire a reference template for reference speech data of the target object. The reference template includes reference speech feature data and reference duration. The reference speech feature data is valid speech feature data extracted from the original reference speech feature data.
[0015] The third acquisition module is used to acquire the first duration of invalid speech feature data in the original test speech feature data, and the initial value of the test duration of the first duration;
[0016] The fourth acquisition module is used to acquire the second duration of invalid speech feature data in the original reference speech feature data, and the initial value of the reference duration of the second duration;
[0017] The determination module is used to determine the target search area formed by the test template and the reference template based on the test duration, the reference duration, the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration;
[0018] The recognition module is used to determine the speech matching degree between the test template and the reference template in the target search area, and to determine the speech recognition result of the test template based on the speech matching degree and a preset matching degree threshold.
[0019] On the one hand, this application provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps in the above-described speech recognition method.
[0020] On the one hand, this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the above-described speech recognition method.
[0021] This application provides a speech recognition method, apparatus, computer device, and storage medium. The method involves: acquiring a test template of test speech data to be recognized, the test template including test speech feature data and a test duration, wherein the test speech feature data is valid speech feature data extracted from the original test speech feature data; acquiring a reference template of reference speech data for a target object, the reference template including reference speech feature data and a reference duration, wherein the reference speech feature data is valid speech feature data extracted from the original reference speech feature data; acquiring a first duration of invalid speech feature data in the original test speech feature data, and an initial value for the test duration of the first duration; acquiring a second duration of invalid speech feature data in the original reference speech feature data, and an initial value for the reference duration of the second duration; and then, based on the test duration, the reference duration, and the... The first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration determine the target search region formed by the test template and the reference template; the speech matching degree between the test template and the reference template in the target search region is determined, and the speech recognition result of the test template is determined according to the speech matching degree and the preset matching degree threshold. This achieves adaptive adjustment of the target search region, making the target search region more compatible with the test template and the reference template, improving the completeness and accuracy of the target search region, and reducing unnecessary computation. The determination of the speech matching degree between the test template and the reference template in the target search region, and the determination of the speech recognition result of the test template according to the speech matching degree and the preset matching degree threshold, realizes the speech recognition of the test template. Due to the determination of the target search region, the search performance is improved, unnecessary computation is reduced, and thus the efficiency of speech recognition is improved. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] in:
[0024] Figure 1 This is a schematic diagram of the parallelogram region in the parallelogram region constraint method of the background art;
[0025] Figure 2 Here is a flowchart of a speech recognition method in one embodiment;
[0026] Figure 3 This is a schematic diagram of a rectangular constraint region in one embodiment;
[0027] Figure 4 This is a schematic diagram of the strip region in a strip region constraint method in one embodiment;
[0028] Figure 5 This is a structural block diagram of a speech recognition device in one embodiment;
[0029] Figure 6 This is a structural block diagram of a computer device in one embodiment. Detailed Implementation
[0030] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0031] like Figure 2 As shown, in one embodiment, a speech recognition method is provided. This speech recognition method can be applied to both terminals and servers; this embodiment illustrates its application to a server. The speech recognition method specifically includes the following steps:
[0032] Step 102: Obtain a test template for the test speech data to be recognized. The test template includes test speech feature data and test duration. The test speech feature data is valid speech feature data extracted from the original test speech feature data.
[0033] In this context, test speech feature data refers to the feature vector of the test speech data. This test speech feature data is the valid speech feature data extracted from the original test speech feature data. Specifically, in this embodiment, the test speech feature data is the original test speech feature data after removing invalid speech feature data. For example, in a scenario of isolated word speech recognition by a specific person, invalid speech feature data could be speech feature data of silent segments or non-human voices, while valid speech feature data could be speech feature data of isolated words. The test speech feature data can be obtained by preprocessing the test speech data (such as filtering, pre-emphasis, frame-segmentation and windowing) and performing Voice Activity Detection (VAD). This process enables feature encoding and extraction of valid speech feature data from the test speech data.
[0034] The test duration refers to the sequence length of the test speech feature data, which can be determined based on the number of frames of the feature vector of the test speech data. For example, if there are 100 frames and the duration of each frame is T, then the test duration can be 100T. In this embodiment, the test duration is used to determine the boundary of the search region in the subsequent dynamic warping algorithm.
[0035] Test voice data refers to voice data that needs to be used for speech recognition. The sources of test voice data include, but are not limited to, collecting a piece of voice data, receiving a piece of voice data sent by a client to a server, or obtaining it from a voice database pre-stored in the server.
[0036] Specifically, by obtaining a test template, the search area for DTW can be determined based on the test speech feature data and test duration in the test template.
[0037] Step 104: Obtain a reference template for the reference speech data of the target object. The reference template includes reference speech feature data and reference duration. The reference speech feature data is valid speech feature data extracted from the original reference speech feature data.
[0038] The reference speech feature data refers to the feature vector of the reference speech data of the target object, i.e., a specific speaker. The reference speech feature data is the effective speech feature data extracted from the original reference speech feature data. In this embodiment, the reference speech feature data is determined in the same way as the test speech feature data so as to facilitate efficient comparison in the future.
[0039] Reference duration refers to the sequence length of the reference speech feature data, which is used to determine the boundary of the search region in the subsequent dynamic warping algorithm.
[0040] Reference voice data refers to the voice data of the target object collected for matching with the test template. The sources of reference voice data include, but are not limited to, a segment of voice data of the target object collected, a segment of voice data of the target object sent by the client to the server, or a segment of voice data of the target object pre-stored in the server's voice database.
[0041] Specifically, by obtaining a reference template, the search area for DTW can be determined based on the reference speech feature data and reference duration in the reference template.
[0042] Step 106: Obtain the first duration of invalid speech feature data in the original test speech feature data, and the initial value of the test duration of the first duration.
[0043] The first duration refers to the sequence length of invalid speech feature data in the original test speech feature data, that is, the sequence length of at least one invalid semantic feature data segment removed from the original speech feature data, which is also the alignment error of the test template. Taking the scenario of isolated word speech recognition by a specific person as an example, the algorithm for judging isolated word data and non-human voice data is VAD detection, which cannot achieve completely correct detection, especially when isolated word data is adjacent, detection errors often occur, such as non-human voice data being judged as isolated word data, and isolated word data being judged as non-human voice data, etc. Thus, alignment error is generated. In order to ensure that isolated word data can be completely extracted and improve the subsequent DTW judgment, the alignment error, i.e., the first duration, can be set according to the performance of VAD detection accuracy. Since invalid speech feature data usually appears at the beginning and / or end of a speech segment, the first duration can be one or more.
[0044] Specifically, VAD detection can be performed on the collected raw test speech data to extract feature data. N1 frames of data are retained before this feature data, and M1 frames of data are retained after it. If the duration of each frame is T, the reserved alignment error at the beginning of the test template is T·N1, and the reserved alignment error at the end of the test template is T·M1. Therefore, the first duration is T·N1 and T·M1. The values of N1 and M1 are selected based on the performance of VAD. If the VAD's misclassification rate is high, the values of N1 and M1 are larger; if the VAD's misclassification rate is low, the values of N1 and M1 are smaller, making the first duration more reasonable and improving the accuracy of subsequent DTW calculations.
[0045] The initial value of the first test duration refers to a pre-set initial value for the first duration, which is reflected in the search region of the DTW algorithm. It is the boundary value of the search region, such as the intercept of the parallel lines in the band constraint region. Due to the characteristics of speech signals, when a person repeats the same words, the speech signals will not be exactly the same due to differences in speech rate, loudness, etc. Therefore, even if the test template and the reference template are aligned end-to-end, the optimal path will not be diagonal, but near the diagonal. Therefore, an initial value is set for the first duration (corresponding to the intercept of the parallel lines in the band constraint region). When the test template and the reference template are aligned end-to-end, the intercept of the parallel lines in the band constraint region takes the initial value; when the test template and the reference template are not aligned end-to-end, the intercept of the parallel lines in the band constraint region is adjusted according to the initial value of the test duration, so that the intercept of the parallel lines in the band constraint region can be adjusted subsequently according to the initial value of the first test duration, ensuring the accuracy of the adjusted band constraint region.
[0046] Step 108: Obtain the second duration of invalid speech feature data in the original reference speech feature data, and the initial value of the reference duration of the second duration.
[0047] The second duration refers to the sequence length of invalid speech feature data in the original reference speech feature data. Its determination method is the same as that of the first duration in step 106. The initial value of the reference duration of the second duration is determined in the same way as that of the first duration in step 106.
[0048] Specifically, VAD detection can be performed on the original reference speech data of the target object to extract feature data. N0 frames of data are retained before the feature data, and M0 frames of data are retained after the feature data. If the duration of each frame is T, the reserved alignment error at the beginning of the reference template is T·N0, and the reserved alignment error at the end of the reference template is T·M0. Therefore, the second duration is T·N0 and T·M0. Similar to step 106, the values of N0 and M0 are selected based on the performance of VAD. If the misclassification rate of VAD is high, the values of N0 and M0 are larger; if the misclassification rate of VAD is low, the values of N0 and M0 are smaller, making the selection of the second duration more reasonable and improving the accuracy of subsequent DTW calculations.
[0049] Step 110: Determine the target search area formed by the test template and the reference template based on the test duration, the reference duration, the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration.
[0050] The target search region refers to the region where the test template and reference template are matched using the DTW algorithm.
[0051] Specifically, the boundary parameters of the search region of the preset shape can be adaptively adjusted based on the test duration, reference duration, first duration, initial value of test duration, second duration, and initial value of reference duration. For example, the intercepts of parallel lines in the strip constraint region can be reasonably adjusted to make the target search region more accurate, thereby improving search performance while minimizing computational load. Understandably, this embodiment fully considers the impact of the first and second durations of the test template and reference template, i.e., the alignment error between the test template and reference template, on the accuracy of the search region. The precise search range of the search region is calculated based on the alignment error, reducing unnecessary calculations and significantly decreasing computational load.
[0052] In one example, such as Figure 3The diagram shows a rectangular constraint region. Let OA be the reference template (its length is the second duration), OB be the test template (its length is the first duration), and the rectangle OACB be the complete search region of the DTW algorithm. Let the duration of one frame be T, and the band constraint region be ODECGF. The target search region ODECGF is determined based on the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration.
[0053] It is worth noting that, because the parallelogram region constraint method assumes that the shortest path exists within a parallelogram, and based on the characteristics of a parallelogram, it has high requirements for the alignment of the beginning and end of the test speech feature data and the reference speech feature data. In contrast, the strip region constraint method has lower requirements for the alignment of the beginning and end of the test speech feature data and the reference speech feature data. In this embodiment, a strip constraint region is constructed, such as... Figure 4 The shaded area shown is designed to reduce the limitations on the alignment of test speech feature data and reference speech feature data, thereby improving the applicability of speech recognition.
[0054] In one specific embodiment, invalid speech feature data in the original test speech feature data includes the initial test speech data located at the beginning of the original test speech feature data and the final test speech data located at the end of the original test speech feature data. The first duration includes the first beginning duration of the initial test speech data and the first end duration of the final test speech data. The initial test duration value of the first duration is a preset initial value of the first beginning duration. Invalid speech feature data in the original reference speech feature data includes the initial reference speech data located at the beginning of the original reference speech feature data. The data includes the tail reference speech data located at the end of the original reference speech feature data. The second duration includes the second beginning duration of the beginning reference speech data and the second end duration of the tail reference speech data. The initial value of the reference duration of the second duration is a preset initial value of the second beginning duration. Step 110, which involves determining the target search area formed by the test template and the reference template based on the test duration, the reference duration, the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration, may include the following steps 110A to 110G, as follows:
[0055] Step 110A: Construct a strip-shaped constraint region based on the reference duration, the test duration, the preset initial value of the first head duration, and the preset initial value of the second head duration. The strip-shaped constraint region includes two parallel lines parallel to the diagonal, and the two parallel lines are divided into an upper parallel line and a lower parallel line.
[0056] Step 110B: Calculate the slope of the two parallel lines based on the reference duration and the test duration;
[0057] Step 110C: Calculate the first intercept of the lower parallel line based on the slope, the second head duration, and the first tail duration.
[0058] Step 110D: Calculate the second intercept of the upper parallel line based on the slope, the first head duration, and the second tail duration.
[0059] Step 110E: Perform verification and adjustment based on the preset initial values of the first intercept and the second head duration to obtain the adjusted first intercept;
[0060] Step 110F: Perform verification and adjustment based on the preset initial values of the second intercept and the first head duration to obtain the adjusted second intercept;
[0061] Step 110G: Determine the target search area based on the adjusted first intercept and the adjusted second intercept.
[0062] The first duration includes the first beginning duration and the first ending duration, i.e., the first beginning duration is T·N1 in step 106 and the first ending duration is T·M1 in step 106. The second duration includes the second beginning duration and the second ending duration, i.e., the second beginning duration is T·N0 in step 108 and the second ending duration is T·M0 in step 108.
[0063] Please see Figure 3 The first intercept is the intercept of the lower parallel line, that is, the corresponding... Figure 3 In the middle OD and CE, the second intercept is the intercept of the upper parallel line, that is, the corresponding Figure 3 The adjusted first intercept is the adjusted OD (denoted by OD') and the adjusted CE (denoted by CE'), and the adjusted second intercept is the adjusted OF (denoted by OF') and the adjusted GC (denoted by GC').
[0064] Specifically, such as Figure 3 As shown, based on the preset initial values of the reference duration, test duration, first header duration, and second header duration, a banded constraint region ODECGF can be constructed. This banded constraint region includes two parallel lines parallel to the diagonal OC, namely the upper parallel line FG and the lower parallel line DE. Then, the slopes of the upper parallel line FG and the lower parallel line DE are calculated based on the reference duration and test duration. Since the slopes of the upper parallel line FG and the lower parallel line DE are parallel to the diagonal OC, their slope k is equal to that of the diagonal OC. The formula for calculating the slope k is as follows:
[0065] k = AC / OA = OB / OA (1)
[0066] Therefore, the slopes of the upper parallel line DE and the lower parallel line FG are also k = OB / OA.
[0067] The OD and EC of the first intercept can be calculated using the following formula:
[0068] Depend on Figure 3 It can be seen that the relationship between OD and EC is as follows:
[0069] EC=OD·tan ∠COA=OD·AC / OA=OD·OB / OA (2)
[0070] Also obtain
[0071] OD = EC·OA / OB (3)
[0072] The second intercepts OF and GC can be calculated using the following formula:
[0073] Depend on Figure 3 It can be seen that the relationship between OF and GC is as follows:
[0074] GC=OF·ctan∠OCB=OF·BC / OB=OF·OA / OB (4)
[0075] Also obtain
[0076] OF = GC·OB / OA (5)
[0077] After calculating the first intercept and the second intercept, the first intercept and the second head duration are checked and adjusted according to the preset initial values. The second intercept and the first head duration are checked and adjusted according to the preset initial values. In order to ensure the integrity of the search in the band constraint region, the preset initial values of the first intercept and the second head duration, and the second intercept and the first head duration are compared. The larger value is selected as the adjusted first intercept and the adjusted second intercept. The target search region is obtained based on the adjusted first intercept and the adjusted second intercept.
[0078] In one specific embodiment, the first intercept includes a first horizontal intercept and a first vertical intercept; the step 110B, which calculates the first intercept of the lower parallel line based on the slope, the second beginning duration, and the first end duration, may include the following steps 110B1 to 110B3, as follows:
[0079] Step 110B1: Calculate the vertical intercept value of the lower parallel line based on the slope and the second head duration.
[0080] Step 110B2, if the calculated value of the vertical axis intercept of the lower parallel line is greater than or equal to the first tail duration, determine the second head duration as the first horizontal axis intercept, and calculate the first vertical axis intercept based on the first horizontal axis intercept and the slope;
[0081] Step 110B3, if the calculated value of the vertical axis intercept of the lower parallel line is less than the first tail duration, determine the first tail duration as the first vertical axis intercept, and calculate the first horizontal axis intercept based on the first vertical axis intercept and the slope.
[0082] Among them, the first intercept includes the first horizontal axis intercept and the first vertical axis intercept. The first horizontal axis intercept corresponds to OD, denoted as OD1, and the first vertical axis intercept corresponds to EC, denoted as EC1.
[0083] Specifically, according to the slope k and the second head duration T·N0, calculate the calculated value of the vertical axis intercept of the lower parallel line, that is, the calculated value of the vertical axis intercept of the lower parallel line = T·N0·OB / OA. Since the calculated value of the vertical axis intercept of the lower parallel line must not be less than the first tail duration T·M1, the following discussions are made in different cases:
[0084] When the calculated value of the vertical axis intercept of the lower parallel line is greater than or equal to the first tail duration T·M1, determine the second head duration T·N0 as the first horizontal axis intercept OD1, and calculate the first vertical axis intercept EC1 based on the first horizontal axis intercept OD1 and the slope k(OB / OA). That is, when T·N0·OB / OA >= T·M1, at this time, determine the values of OD and EC according to the minimum length T·N0 of OD, that is: OD1 = T·N0, EC1 = T·N0·OB / OA.
[0085] When the calculated value of the vertical axis intercept of the lower parallel line is less than the first tail duration, determine the first tail duration T·N1 as the first vertical axis intercept EC1, and calculate the first horizontal axis intercept OD1 based on the first vertical axis intercept EC1 and the slope k(OB / OA).
[0086] When T·N0·OB / OA < T·M1, at this time, determine the values of OD and EC according to the minimum length T·M1 of EC, that is: OD1 = T·M1·OA / OB, EC1 = T·M1.
[0087] In a specific embodiment, the second intercept includes a second horizontal axis intercept and a second vertical axis intercept; steps 110C for calculating the second intercept of the upper parallel line according to the slope, the first head duration, and the second tail duration may include the following steps 110C1 to 110C3, specifically as follows:
[0088] Step 110C1: Calculate the calculated value of the vertical axis intercept of the upper parallel line according to the slope and the first header duration.
[0089] Step 110C2: If the calculated value of the vertical axis intercept of the upper parallel line is greater than or equal to the second tail duration, determine the first header duration as the second vertical axis intercept, and calculate the second horizontal axis intercept according to the second vertical axis intercept and the slope.
[0090] Step 110C3: If the calculated value of the vertical axis intercept of the upper parallel line is less than the second tail duration, determine the second tail duration as the second horizontal axis intercept, and calculate the second vertical axis intercept according to the second horizontal axis intercept and the slope.
[0091] Among them, the second intercept includes the second horizontal axis intercept and the second vertical axis intercept. The second horizontal axis intercept corresponds to GC, denoted as GC1, and the second vertical axis intercept corresponds to OF, denoted as OF1.
[0092] Specifically, according to the slope k and the first header duration T·N1, calculate the calculated value of the vertical axis intercept of the upper parallel line, that is, the calculated value of the vertical axis intercept of the upper parallel line = T·N1·OA / OB. Since the calculated value of the vertical axis intercept of the upper parallel line shall not be less than the first header duration T·M0, the following discussions are made according to different situations:
[0093] When the calculated value of the vertical axis intercept of the upper parallel line is greater than or equal to the second tail duration T·M0, determine the first header duration T·N1 as the second vertical axis intercept OF1, and calculate the second horizontal axis intercept GC1 according to the second vertical axis intercept OF1 and the slope k(OB / OA). That is, when T·N1·OA / OB >= T·M0, at this time, determine the values of OF and GC according to the minimum length T·N1 of OF, that is: OF1 = T·N1, GC1 = T·N1·OA / OB.
[0094] When the calculated value of the vertical axis intercept of the upper parallel line is less than the second tail duration T·M0, determine the second tail duration T·M0 as the second horizontal axis intercept GC1, and calculate the second vertical axis intercept OF1 according to the second horizontal axis intercept GC1 and the slope k(OB / OA). That is, when T·N1·OA / OB < T·M0, at this time, determine the values of OF and GC according to the minimum length T·M0 of GC, that is: OF1 = T·M0·OB / OA, GC1 = T·M0.
[0095] In a specific embodiment, the adjusted first intercept includes the adjusted first horizontal axis intercept and the adjusted first vertical axis intercept; the verification and adjustment according to the first intercept and the preset initial value of the second header duration in step 110D to obtain the adjusted first intercept may include the following steps 110D1 to 110D2, specifically as follows:
[0096] Step 110D1, if the first horizontal axis intercept is less than or equal to the preset initial value of the second header duration, determine the preset initial value of the second header duration as the adjusted first horizontal axis intercept, and calculate the adjusted first vertical axis intercept according to the adjusted first horizontal axis intercept and the slope;
[0097] Step 110D2, if the first horizontal axis intercept is greater than the preset initial value of the second header duration, determine the first horizontal axis intercept as the adjusted first horizontal axis intercept, and calculate the adjusted first vertical axis intercept according to the adjusted first horizontal axis intercept and the slope.
[0098] Among them, the preset initial value of the second header duration corresponds to OD, denoted as OD0, and the first horizontal axis intercept is OD1. When the first horizontal axis intercept OD1 is less than or equal to the preset initial value OD0 of the second header duration, determine the preset initial value OD0 of the second header duration as the adjusted first horizontal axis intercept OD', and calculate the adjusted first vertical axis intercept EC' according to the adjusted first horizontal axis intercept OD' and the slope k (OB / OA). When the first horizontal axis intercept OD1 is greater than the preset initial value OD0 of the second header duration, determine the first horizontal axis intercept OD1 as the adjusted first horizontal axis intercept OD', and calculate the adjusted first vertical axis intercept EC' according to the adjusted first horizontal axis intercept OD0 and the slope k (OB / OA), that is
[0099] If OD0 >= OD1, then OD' = OD0, EC' = OD0 · OB / OA;
[0100] If OD0 < OD1, then OD' = OD1, EC' = OD1 · OB / OA.
[0101] It can be understood that since the adjusted first horizontal axis intercept OD is the larger value selected from the first horizontal axis intercept OD1 and the preset initial value of the second header duration, the integrity of the search range is ensured.
[0102] In a specific embodiment, the adjusted second intercept includes an adjusted second horizontal axis intercept and an adjusted second vertical axis intercept; the verification and adjustment according to the second intercept and the preset initial value of the first header duration in step 110E to obtain the adjusted second intercept may include the following steps 110E1 to 110E2, specifically as follows:
[0103] Step 110E1: If the second vertical axis intercept is less than or equal to the preset initial value of the first header duration, determine the preset initial value of the first header duration as the adjusted second vertical axis intercept, and calculate the adjusted second horizontal axis intercept according to the adjusted second horizontal axis intercept and the slope;
[0104] Step 110E2: If the second vertical axis intercept is greater than the preset initial value of the first header duration, determine the second vertical axis intercept as the adjusted second vertical axis intercept, and calculate the adjusted second horizontal axis intercept according to the adjusted second vertical axis intercept and the slope.
[0105] Among them, the preset initial value of the first header duration corresponds to OF, set as OF0, and the second vertical axis intercept is OF1. When the second vertical axis intercept OF1 is less than or equal to the preset initial value OF0 of the first header duration, determine the preset initial value OF0 of the first header duration as the adjusted second vertical axis intercept OF, and calculate the adjusted second horizontal axis intercept GC' according to the adjusted second horizontal axis intercept OF and the slope k(OB / OA). When the second vertical axis intercept OF1 is greater than the preset initial value OF0 of the first header duration, determine the second vertical axis intercept OF1 as the adjusted second vertical axis intercept OF, and calculate the adjusted second horizontal axis intercept GC' according to the adjusted second vertical axis intercept OF' and the slope k(OB / OA). That is
[0106] If OF0 >= OF1, then OF' = OF0, GC' = OF0·OA / OB;
[0107] If OF0 < OF1, then OF' = OF1, GC' = OF1·OA / OB. It can be understood that since the adjusted second vertical axis intercept OF is the larger value of the second vertical axis intercept OF1 and the preset initial value OF0 of the second header duration, the integrity of the search range is ensured.
[0108] Step 112: Determine the voice matching degree between the test template and the reference template in the target search area, and determine the voice recognition result of the test template according to the voice matching degree and the preset matching degree threshold.
[0109] Specifically, after determining the target search area, the voice matching degree between the test template and the reference template can be determined, such as calculating the minimum Euclidean distance, and then the voice recognition result of the test template can be determined according to the minimum Euclidean distance and the preset matching degree threshold, realizing the voice recognition of the test template to be recognized.
[0110] The aforementioned speech recognition method utilizes test duration, reference duration, first duration, initial value of test duration, second duration, and initial value of reference duration to determine the target search region formed by the test template and reference template. This achieves adaptive adjustment of the target search region, making it more compatible with the test template and reference template, improving the completeness and accuracy of the target search region, and reducing unnecessary computation. It determines the speech matching degree between the test template and reference template within the target search region and determines the speech recognition result of the test template based on the speech matching degree and a preset matching degree threshold, thus achieving speech recognition of the test template. Because the target search region is determined, search performance is improved, unnecessary computation is reduced, and therefore, the efficiency of speech recognition is increased.
[0111] In one specific embodiment, step 112, which involves determining the speech matching degree between the test template and the reference template in the target search area, and determining the speech recognition result of the test template based on the speech matching degree and a preset matching degree threshold, may include the following steps 112A to 112B, as follows:
[0112] Step 112A: Calculate the maximum similarity between the test speech feature data of the test template in the target search region and the reference speech feature data of the reference template in the target search region to obtain the speech matching degree;
[0113] Step 112B: If the voice matching degree is greater than the preset matching degree threshold, it is determined that the test voice data matches the reference voice data.
[0114] Specifically, the maximum similarity between the test speech feature data of the test template in the target search region and the reference speech feature data of the reference template in the target search region can be calculated using the time dynamic warping algorithm to obtain the speech matching degree. When the speech matching degree is greater than the preset matching degree threshold, it indicates that the test speech data matches the reference speech data.
[0115] like Figure 5 As shown, in one embodiment, a speech recognition device is provided, the speech recognition device comprising:
[0116] The first acquisition module 402 is used to acquire a test template for the test speech data to be recognized. The test template includes test speech feature data and test duration. The test speech feature data is valid speech feature data extracted from the original test speech feature data.
[0117] The second acquisition module 404 is used to acquire a reference template for reference speech data of the target object. The reference template includes reference speech feature data and reference duration. The reference speech feature data is valid speech feature data extracted from the original reference speech feature data.
[0118] The third acquisition module 406 is used to acquire the first duration of invalid speech feature data in the original test speech feature data, and the initial value of the test duration of the first duration;
[0119] The fourth acquisition module 408 is used to acquire the second duration of invalid speech feature data in the original reference speech feature data, and the initial value of the reference duration of the second duration;
[0120] The determining module 410 is used to determine the target search area formed by the test template and the reference template based on the test duration, the reference duration, the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration;
[0121] The recognition module 412 is used to determine the speech matching degree between the test template and the reference template in the target search area, and to determine the speech recognition result of the test template based on the speech matching degree and the preset matching degree threshold.
[0122] In one embodiment, invalid speech feature data in the original test speech feature data includes initial test speech data at the beginning of the original test speech feature data and final test speech data at the end of the original test speech feature data. The first duration includes a first beginning duration of the initial test speech data and a first end duration of the final test speech data. The initial value of the test duration of the first duration is a preset initial value of the first beginning duration. Invalid speech feature data in the original reference speech feature data includes initial reference speech data at the beginning of the original reference speech feature data and final reference speech data at the end of the original reference speech feature data. The second duration includes a second beginning duration of the initial reference speech data and a second end duration of the final reference speech data. The initial value of the reference duration of the second duration is a preset initial value of the second beginning duration. The determining module is specifically used for:
[0123] A strip-shaped constraint region is constructed based on the reference duration, the test duration, the preset initial value of the first head duration, and the preset initial value of the second head duration. The strip-shaped constraint region includes two parallel lines parallel to the diagonal, and the two parallel lines are divided into an upper parallel line and a lower parallel line.
[0124] Calculate the slope of the two parallel lines based on the reference duration and the test duration;
[0125] The first intercept of the lower parallel line is calculated based on the slope, the second head duration, and the first tail duration.
[0126] The second intercept of the upper parallel line is calculated based on the slope, the first head duration, and the second tail duration.
[0127] The first intercept and the second head duration are verified and adjusted according to the preset initial values to obtain the adjusted first intercept.
[0128] The second intercept is adjusted by verifying and adjusting the preset initial values of the second intercept and the first head duration to obtain the adjusted second intercept.
[0129] The target search area is determined based on the adjusted first intercept and the adjusted second intercept.
[0130] In one embodiment, the first intercept includes a first horizontal intercept and a first vertical intercept; the determining module is further configured to:
[0131] The calculated value of the ordinate of the lower parallel line is obtained based on the slope and the second head duration.
[0132] If the calculated value of the vertical intercept of the lower parallel line is greater than or equal to the first tail duration, the second head duration is determined as the first horizontal intercept, and the first vertical intercept is calculated based on the first horizontal intercept and the slope.
[0133] If the calculated value of the vertical intercept of the lower parallel line is less than the first tail duration, the first tail duration is determined as the first vertical intercept, and the first horizontal intercept is calculated based on the first vertical intercept and the slope.
[0134] In one embodiment, the second intercept includes a second horizontal intercept and a second vertical intercept; the determining module is further configured to:
[0135] The calculated value of the ordinate of the upper parallel line is obtained based on the slope and the duration of the first head section.
[0136] If the calculated value of the vertical intercept of the upper parallel line is greater than or equal to the second tail duration, the first head duration is determined as the second vertical intercept, and the second horizontal intercept is calculated based on the second vertical intercept and the slope.
[0137] If the calculated value of the vertical intercept of the upper parallel line is less than the second tail duration, the second tail duration is determined as the second horizontal intercept, and the second vertical intercept is calculated based on the second horizontal intercept and the slope.
[0138] In one embodiment, the adjusted first intercept includes an adjusted first horizontal intercept and an adjusted first vertical intercept; the determining module is further configured to:
[0139] If the first horizontal intercept is less than or equal to the preset initial value of the second head length, the preset initial value of the second head length is determined as the adjusted first horizontal intercept, and the adjusted first vertical intercept is calculated based on the adjusted first horizontal intercept and the slope.
[0140] If the first horizontal intercept is greater than the preset initial value of the second head length, the first horizontal intercept is determined as the adjusted first horizontal intercept, and the adjusted first vertical intercept is calculated based on the adjusted first horizontal intercept and the slope.
[0141] In one embodiment, the adjusted second intercept includes an adjusted second horizontal intercept and an adjusted second vertical intercept; the determining module is further configured to:
[0142] If the second vertical intercept is less than or equal to the preset initial value of the first head length, the preset initial value of the first head length is determined as the adjusted second vertical intercept, and the adjusted second horizontal intercept is calculated based on the adjusted second horizontal intercept and the slope.
[0143] If the second vertical intercept is greater than the preset initial value of the first head length, the second vertical intercept is determined as the adjusted second vertical intercept, and the adjusted second horizontal intercept is calculated based on the adjusted second vertical intercept and the slope.
[0144] In one embodiment, the identification module is further configured to:
[0145] The maximum similarity between the test speech feature data of the test template in the target search region and the reference speech feature data of the reference template in the target search region is calculated to obtain the speech matching degree;
[0146] If the voice matching degree is greater than a preset matching degree threshold, the test voice data is determined to match the reference voice data.
[0147] Figure 6 An internal structural diagram of a computer device in one embodiment is shown. This computer device may specifically be a server, including but not limited to high-performance computers and high-performance computer clusters. Figure 6As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and may also store a computer program that, when executed by the processor, enables the processor to implement a speech recognition method. The internal memory may also store a computer program that, when executed by the processor, enables the processor to implement a speech recognition method. Those skilled in the art will understand that... Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0148] In one embodiment, the speech recognition method provided in this application can be implemented as a computer program, which can be implemented in, for example... Figure 6 The computer device shown runs on this device. The computer device's memory can store various program templates that make up the speech recognition device. For example, a first acquisition module 402, a second acquisition module 404, a third acquisition module 406, a fourth acquisition module 408, a determination module 410, and a recognition module 412.
[0149] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the above-described speech recognition method.
[0150] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the above-described speech recognition method.
[0151] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0152] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0153] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A speech recognition method, characterized in that, include: A test template for obtaining test speech data to be recognized is provided. The test template includes test speech feature data and test duration. The test speech feature data is valid speech feature data extracted from the original test speech feature data. A reference template for obtaining reference speech data of the target object is provided. The reference template includes reference speech feature data and reference duration. The reference speech feature data is valid speech feature data extracted from the original reference speech feature data. Obtain the first duration of invalid speech feature data in the original test speech feature data, and the initial value of the test duration of the first duration; Obtain the second duration of invalid speech feature data in the original reference speech feature data, and the initial value of the reference duration of the second duration; The target search area formed by the test template and the reference template is determined based on the test duration, the reference duration, the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration; Determine the speech matching degree between the test template and the reference template in the target search area, and determine the speech recognition result of the test template based on the speech matching degree and the preset matching degree threshold.
2. The speech recognition method as described in claim 1, characterized in that, Invalid speech feature data in the original test speech feature data includes the initial test speech data at the beginning of the original test speech feature data and the final test speech data at the end of the original test speech feature data. The first duration includes the first beginning duration of the initial test speech data and the first end duration of the final test speech data. The initial test duration of the first duration is a preset initial value of the first beginning duration. Invalid speech feature data in the original reference speech feature data includes the initial reference speech data at the beginning of the original reference speech feature data and the final reference reference speech data at the end of the original reference speech feature data. The second duration includes the second beginning duration of the initial reference speech data and the second end duration of the final reference speech data. The initial reference duration of the second duration is a preset initial value of the second beginning duration. The step of determining the target search area formed by the test template and the reference template based on the test duration, the reference duration, the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration includes: A strip-shaped constraint region is constructed based on the reference duration, the test duration, the preset initial value of the first head duration, and the preset initial value of the second head duration. The strip-shaped constraint region includes two parallel lines parallel to the diagonal, and the two parallel lines are divided into an upper parallel line and a lower parallel line. Calculate the slope of the two parallel lines based on the reference duration and the test duration; The first intercept of the lower parallel line is calculated based on the slope, the second head duration, and the first tail duration. The second intercept of the upper parallel line is calculated based on the slope, the first head duration, and the second tail duration. The first intercept and the second head duration are verified and adjusted according to the preset initial values to obtain the adjusted first intercept. The second intercept is adjusted by verifying and adjusting the preset initial values of the second intercept and the first head duration to obtain the adjusted second intercept. The target search area is determined based on the adjusted first intercept and the adjusted second intercept.
3. The speech recognition method as described in claim 2, characterized in that, The first intercept includes a first horizontal intercept and a first vertical intercept; The step of calculating the first intercept of the lower parallel line based on the slope, the second beginning duration, and the first end duration includes: The calculated value of the ordinate of the lower parallel line is obtained based on the slope and the second head duration. If the calculated value of the vertical intercept of the lower parallel line is greater than or equal to the first tail duration, the second head duration is determined as the first horizontal intercept, and the first vertical intercept is calculated based on the first horizontal intercept and the slope. If the calculated value of the vertical intercept of the lower parallel line is less than the first tail duration, the first tail duration is determined as the first vertical intercept, and the first horizontal intercept is calculated based on the first vertical intercept and the slope.
4. The speech recognition method as described in claim 2, characterized in that, The second intercept includes the second horizontal intercept and the second vertical intercept; The step of calculating the second intercept of the upper parallel line based on the slope, the first beginning duration, and the second ending duration includes: The calculated value of the ordinate of the upper parallel line is obtained based on the slope and the duration of the first head section. If the calculated value of the vertical intercept of the upper parallel line is greater than or equal to the second tail duration, the first head duration is determined as the second vertical intercept, and the second horizontal intercept is calculated based on the second vertical intercept and the slope. If the calculated value of the vertical intercept of the upper parallel line is less than the second tail duration, the second tail duration is determined as the second horizontal intercept, and the second vertical intercept is calculated based on the second horizontal intercept and the slope.
5. The speech recognition method as described in claim 3, characterized in that, The adjusted first intercept includes the adjusted first horizontal intercept and the adjusted first vertical intercept; The step of verifying and adjusting based on the preset initial values of the first intercept and the second header duration to obtain the adjusted first intercept includes: If the first horizontal intercept is less than or equal to the preset initial value of the second head length, the preset initial value of the second head length is determined as the adjusted first horizontal intercept, and the adjusted first vertical intercept is calculated based on the adjusted first horizontal intercept and the slope. If the first horizontal intercept is greater than the preset initial value of the second head length, the first horizontal intercept is determined as the adjusted first horizontal intercept, and the adjusted first vertical intercept is calculated based on the adjusted first horizontal intercept and the slope.
6. The speech recognition method as described in claim 4, characterized in that, The adjusted second intercept includes the adjusted second horizontal intercept and the adjusted second vertical intercept; The step of verifying and adjusting based on the preset initial value of the second intercept and the first head duration to obtain the adjusted second intercept includes: If the second vertical intercept is less than or equal to the preset initial value of the first head length, the preset initial value of the first head length is determined as the adjusted second vertical intercept, and the adjusted second horizontal intercept is calculated based on the adjusted second vertical intercept and the slope. If the second vertical intercept is greater than the preset initial value of the first head length, the second vertical intercept is determined as the adjusted second vertical intercept, and the adjusted second horizontal intercept is calculated based on the adjusted second vertical intercept and the slope.
7. The speech recognition method according to any one of claims 1 to 6, characterized in that, The step of determining the speech matching degree between the test template and the reference template in the target search area, and determining the speech recognition result of the test template based on the speech matching degree and a preset matching degree threshold, includes: The maximum similarity between the test speech feature data of the test template in the target search region and the reference speech feature data of the reference template in the target search region is calculated to obtain the speech matching degree; If the voice matching degree is greater than a preset matching degree threshold, the test voice data is determined to match the reference voice data.
8. A voice recognition device, characterized in that, The speech recognition device includes: The first acquisition module is used to acquire a test template for the test speech data to be recognized. The test template includes test speech feature data and test duration. The test speech feature data is valid speech feature data extracted from the original test speech feature data. The second acquisition module is used to acquire a reference template for reference speech data of the target object. The reference template includes reference speech feature data and reference duration. The reference speech feature data is valid speech feature data extracted from the original reference speech feature data. The third acquisition module is used to acquire the first duration of invalid speech feature data in the original test speech feature data, and the initial value of the test duration of the first duration; The fourth acquisition module is used to acquire the second duration of invalid speech feature data in the original reference speech feature data, and the initial value of the reference duration of the second duration; The determination module is used to determine the target search area formed by the test template and the reference template based on the test duration, the reference duration, the first duration, the initial value of the test duration, the second duration, and the initial value of the reference duration; The recognition module is used to determine the speech matching degree between the test template and the reference template in the target search area, and to determine the speech recognition result of the test template based on the speech matching degree and a preset matching degree threshold.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the speech recognition method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the speech recognition method as described in any one of claims 1 to 7.