CN117746867A - Speech recognition acceleration method, device and equipment - Google Patents

Speech recognition acceleration method, device and equipment Download PDF

Info

Publication number
CN117746867A
CN117746867A CN202410182367.3A CN202410182367A CN117746867A CN 117746867 A CN117746867 A CN 117746867A CN 202410182367 A CN202410182367 A CN 202410182367A CN 117746867 A CN117746867 A CN 117746867A
Authority
CN
China
Prior art keywords
value
fixed point
target
point value
target fixed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410182367.3A
Other languages
Chinese (zh)
Inventor
李�杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Youjie Zhixin Technology Co ltd
Original Assignee
Shenzhen Youjie Zhixin Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Youjie Zhixin Technology Co ltd filed Critical Shenzhen Youjie Zhixin Technology Co ltd
Priority to CN202410182367.3A priority Critical patent/CN117746867A/en
Publication of CN117746867A publication Critical patent/CN117746867A/en
Pending legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)

Abstract

The invention belongs to the technical field of voice recognition, and discloses a voice recognition acceleration method, a device and equipment, wherein the method comprises the steps of obtaining an original voice signal; performing voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the logarithmic value of the target fixed point value is calculated by the following steps; obtaining a target fixed point value, moving the target fixed point value to a fixed q1, and obtaining a second target fixed point value; the method and the device have the advantages that the first lookup table and the second lookup table are constructed in advance, interpolation calculation is conducted by utilizing the first lookup table and the interpolation formula based on the second target fixed point value to obtain the logarithmic value of the target fixed point value, or the second lookup table is utilized to obtain the logarithmic value of the target fixed point value based on the second target fixed point value, so that the need of calculating a plurality of numbers in real time, namely the need of taking a lot of time to calculate, is eliminated, the fixed point logarithmic value can be calculated quickly, the fixed point reasoning speed is greatly accelerated, and the voice recognition speed is accelerated.

Description

Speech recognition acceleration method, device and equipment
Technical Field
The present invention relates to the field of speech recognition technologies, and in particular, to a method, an apparatus, and a device for accelerating speech recognition.
Background
In the field of speech recognition, speech recognition is generally performed by using an end-to-end (e 2 e) network recognition or a hybrid recognition method (acoustic model (am) +language model). The input features of e2e or am are typically fbank features, and the output is a probability distribution of phonemes. In calculating fbank and decoding and identifying the probability distribution matrix of the phonemes (the probability of calculation has probability accumulation, and the numerical stability is considered and the probability distribution matrix is converted into log domain for carrying out), log calculation is generally used for directly outputting the phoneme probability distribution of logsoftmax. In addition, in the intelligent voice equipment, the limitation of resources and real-time calculation is adopted in general reasoning calculation, however, some low-resource equipment is not realized by the logarithm of hardware, so that the fixed-point log value (fixed-point log value) can only be calculated by a software mode, but the time consumption of the existing software implementation mode (such as calculating the logarithm by adopting a Taylor formula) is larger, so that the equipment of a low-power chip cannot recognize the voice in real time, and therefore, the technical problem that how to solve the problem that the equipment of the low-power chip cannot recognize the voice in real time due to the large time consumption of the fixed-point log calculation of the existing software mode is needed to be solved at present is solved.
Disclosure of Invention
The invention mainly aims to provide a voice recognition acceleration method, device and equipment, and aims to solve the technical problem that equipment with a low-power chip cannot recognize voice in real time due to large fixed-point logarithmic calculation time consumption in the existing software mode.
In order to achieve the above object, a first aspect of the present invention provides a voice recognition acceleration method, the method comprising:
acquiring an original voice signal;
performing voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the logarithmic value of the target fixed point value is calculated by adopting the following steps:
acquiring a target fixed point value;
moving the target fixed point value to a fixed q1 to obtain a second target fixed point value; wherein q1 represents the accuracy of the input data and is set in advance;
judging whether the second target fixed point value is in a first preset interval or not;
if the target fixed point value is within the first preset interval, calculating the logarithmic value of the target fixed point value by using the second target fixed point value, a preset first lookup table and an interpolation calculation method; wherein, the first lookup table stores the corresponding logarithmic value of the numerical value taking the preset first numerical value as the interval in the first preset interval;
If the second target fixed point value is not in the first preset interval, judging whether the second target fixed point value is smaller than the minimum value of the first preset interval or larger than or equal to the maximum value of the first preset interval;
if the second target fixed point value is smaller than the minimum value of the first preset interval, judging whether the second target fixed point value is smaller than a preset first threshold value or not;
if the target fixed point value is smaller than the first threshold value, acquiring the logarithmic value of the target fixed point value through a preset second lookup table; wherein, the second lookup table stores the corresponding logarithmic value of the numerical value taking the preset second numerical value as the interval in the second preset interval; wherein the second preset interval is [0 ], a first threshold value;
if the second target fixed point value is not smaller than the first threshold value, calculating a left shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the left shift number, and moving to the first preset intervals to obtain a third target fixed point value;
calculating the logarithmic value of the target fixed point value by using the left shift number, the third target fixed point value, the first lookup table and an interpolation calculation method;
If the second target fixed point value is greater than or equal to the maximum value of the first preset interval, calculating the right shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the right shift number, and moving to the first preset interval to obtain a fourth target fixed point value;
and calculating the logarithmic value of the target fixed point value by using the right shift number, the fourth target fixed point value, the first lookup table and an interpolation calculation method.
Further, the first preset interval isThe method comprises the steps of carrying out a first treatment on the surface of the Wherein n is an integer.
Further, the step of calculating the number of left shifts required to change the second target setpoint value to a value between the first preset intervals includes:
calculating the left shift number required to change the second target setpoint value to a value between the first preset intervals according to formula (1);
shift1= n + q1+ 1 -8- log_table3[x 2 >>8];(1)
wherein x is 2 For the second target fixed point value, shift1 is the left shift number required for changing the second target fixed point value to a value between the first preset intervals, log_table3 is a preset third lookup table, the total number of the third lookup table log_table3 is n+1 elements, each element records the position of the highest 1 of the position values, and N is equal to the first threshold value; where q1 represents the accuracy of the input data and is set in advance.
Further, the step of calculating the number of right shifts required to change the second target setpoint value to a value between the first preset intervals includes:
acquiring the second target fixed point value;
right shifting the second target fixed point value by n+q1+1 bits, and if the upper 32- (n+q1+1) -8 bits in the remaining bit numbers are 0 after the second target fixed point value is right shifted by n+q1+1 bits, acquiring a shift corresponding to the lower 8 bit number value through a preset third lookup table, and taking the shift corresponding to the lower 8 bit number value as a right shift number required for changing the second target fixed point value into a value between the first preset intervals;
if the high 32- (n+q1+1) -8 bits are not 0 in the rest bit numbers, shifting by 8 bits to the right, and judging whether 32- (n+q1+1) - (a+1) x 8 is greater than or equal to 8; a is the number of times shifted by 8 bits to the right; if n+q1+1=8, the right shift of the second target setpoint value by n+q1+1 is not counted by 8 right shift times;
if the number is smaller than 8, the shift corresponding to the residual numerical value is directly obtained through the third lookup table and is used as a first shift bit number; adding a x 8 to the first shift bit number to obtain a right shift bit number required for changing the second target fixed point value to a value between the first preset intervals;
If the number of the bits is greater than or equal to 8, continuing to move the bits to the right by 8 bits, and returning to the step of judging whether 32- (n+q1+1) - (a+1) x 8 is greater than or equal to 8 until 32- (n+q1+1) - (a+1) x 8 is less than 8; the third lookup table log_table3 contains n+1 elements, each element records the position of 1 of the highest bit of the position value, and N is equal to the first threshold value.
Further, the second target fixed point value, a preset first lookup table and an interpolation calculation method are utilized to calculate the logarithmic value of the target fixed point value; the step of storing the corresponding logarithmic value of the value with the preset first value as the interval in the first preset interval in the first lookup table includes:
calculating a first base, a second base, and a third base of the second target setpoint value based on the second target setpoint value;
calculating a distance of the second target setpoint value from a value to the left thereof based on the first, second, and third substrates of the second target setpoint value;
calculating the distance of the second target setpoint value from the value to the right thereof based on the distance of the second target setpoint value from the value to the left thereof;
calculating a position of the second target setpoint value in the first lookup table based on the first, second, and third substrates of the second target setpoint value;
Calculating the logarithmic value of the second target fixed point value by utilizing an interpolation calculation method based on the distance of the second target fixed point value from the numerical value on the left side of the second target fixed point value, the distance of the second target fixed point value from the numerical value on the right side of the second target fixed point value and the position of the second target fixed point value in the first lookup table;
and taking the logarithmic value of the second target fixed point value as the logarithmic value of the target fixed point value.
Further, the step of calculating the logarithmic value of the target fixed point value using the left shift number, the third target fixed point value, the first lookup table, and an interpolation calculation method includes:
calculating a first base, a second base, and a third base of the third target setpoint value based on the third target setpoint value;
calculating a distance of the third target setpoint value from a value to the left thereof based on the first, second, and third substrates of the third target setpoint value;
calculating the distance of the third target setpoint value from the value to the right thereof based on the distance of the third target setpoint value from the value to the left thereof;
calculating a position of the third target setpoint value in the first lookup table based on the first base, the second base, and the third base of the third target setpoint value;
Calculating the logarithmic value of the third target fixed point value by utilizing an interpolation calculation method based on the distance of the third target fixed point value from the numerical value on the left side of the third target fixed point value, the distance of the third target fixed point value from the numerical value on the right side of the third target fixed point value and the position of the third target fixed point value in the first lookup table;
and calculating the logarithmic value of the target fixed point value according to the logarithmic value of the third target fixed point value, the left shift number and the q 1.
Further, the step of calculating the logarithmic value of the target fixed point value using the right shift number, the fourth target fixed point value, the first lookup table, and an interpolation calculation method includes:
calculating a first base, a second base, and a third base of the fourth target setpoint value based on the fourth target setpoint value;
calculating a distance of the fourth target setpoint value from a value to the left thereof based on the first, second, and third substrates of the fourth target setpoint value;
calculating the distance of the fourth target setpoint value from the value to the right thereof based on the distance of the fourth target setpoint value from the value to the left thereof;
calculating a position of the fourth target setpoint value in the first lookup table based on the first, second, and third bases of the fourth target setpoint value;
Calculating the logarithmic value of the fourth target fixed point value by utilizing an interpolation calculation method based on the distance of the fourth target fixed point value from the numerical value on the left side of the fourth target fixed point value, the distance of the fourth target fixed point value from the numerical value on the right side of the fourth target fixed point value and the position of the fourth target fixed point value in the first lookup table;
and calculating the logarithmic value of the target fixed point value according to the logarithmic value of the fourth target fixed point value, the right shift number and the q 1.
Further, the first threshold value is
In a second aspect, an embodiment of the present application provides a voice recognition acceleration apparatus, including:
the acquisition module is used for acquiring an original voice signal;
the voice recognition module is used for carrying out voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the following units are adopted to calculate the logarithmic value of the target fixed point value:
the first acquisition unit is used for acquiring a target fixed point value;
a moving unit for moving the target fixed point value to a fixed q1 to obtain a second target fixed point value; wherein q1 represents the accuracy of the input data and is set in advance;
the first judging unit is used for judging whether the second target fixed point value is in a first preset interval or not;
A first calculation unit, configured to calculate, if the first target fixed point value is within the first preset interval, a logarithmic value of the target fixed point value using the second target fixed point value, a preset first lookup table, and an interpolation calculation method; wherein, the first lookup table stores the corresponding logarithmic value of the numerical value taking the preset first numerical value as the interval in the first preset interval;
a second judging unit configured to judge whether the second target setpoint value is smaller than a minimum value of the first preset section or greater than or equal to a maximum value of the first preset section if the second target setpoint value is not within the first preset section;
a third judging unit, configured to judge whether the second target fixed point value is smaller than a preset first threshold value if the second target fixed point value is smaller than a minimum value of the first preset interval;
the second acquisition unit is used for acquiring the logarithmic value of the target fixed point value through a preset second lookup table if the second acquisition unit is smaller than the first threshold value; wherein, the second lookup table stores the corresponding logarithmic value of the numerical value taking the preset second numerical value as the interval in the second preset interval; wherein the second preset interval is [0 ], a first threshold value;
a second calculation unit, configured to calculate a left shift number required to change the second target fixed point value to a value between the first preset intervals if the second target fixed point value is not smaller than the first threshold, shift the second target fixed point value by using the left shift number, and move to the first preset interval to obtain a third target fixed point value;
A third calculation unit for calculating a logarithmic value of the target fixed point value using the left shift number, the third target fixed point value, the first lookup table, and an interpolation calculation method;
a fourth calculation unit, configured to calculate a right shift number required to change the second target fixed point value to a value between the first preset intervals if the second target fixed point value is greater than or equal to a maximum value of the first preset intervals, shift the second target fixed point value by using the right shift number, and move to the first preset intervals to obtain a fourth target fixed point value;
a fifth calculation unit for calculating a logarithmic value of the target fixed point value using the right shift number, the fourth target fixed point value, the first lookup table, and an interpolation calculation method.
In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the speech recognition acceleration method according to any one of the preceding claims when the computer program is executed.
The method comprises the steps of obtaining an original voice signal; performing voice recognition on the original voice signal to obtain a voice recognition result, and acquiring a target fixed point value in the voice recognition process; moving the target fixed point value to a fixed q1 to obtain a second target fixed point value; for the condition that the fixed point value of the second target is in the first preset interval, a first lookup table is built in advance, the value is checked through the first lookup table, interpolation calculation is carried out by utilizing the checked value, and the fact that a plurality of numbers are needed to be calculated in real time like the fact that a Taylor formula is adopted in the prior art is not needed, namely, a lot of time is not needed to be spent for calculation is avoided, so that the technical problem that the equipment of a low-calculation-force chip cannot recognize voice in real time due to the fact that the time consumption of an existing software implementation mode (such as calculating logarithm by the Taylor formula) is large is solved, the logarithm of the fixed point can be calculated quickly, the reasoning speed of the fixed point is greatly accelerated, and the speed of voice recognition is accelerated. In addition, for the situation that the numerical value which is not in the first preset interval and is smaller than the minimum value of the first preset interval and smaller than the preset first threshold value, the second lookup table is constructed in advance, the logarithmic value of the second target fixed point value is searched through the second lookup table, the searched logarithmic value of the second target fixed point value is used as the logarithmic value of the target fixed point value, the Taylor formula is not needed to calculate a plurality of numbers in real time like the prior art, namely, a lot of time is not needed to be spent for calculation, so that the technical problem that the equipment of the low-calculation-force chip cannot recognize voice in real time due to the fact that the time consumption of the existing software implementation mode (such as calculating the logarithmic value by the Taylor formula) is large is solved, the fixed point logarithmic value can be calculated quickly, the fixed point reasoning speed is greatly accelerated, and the voice recognition speed is accelerated. For the situation that the value is not in the first preset interval and is smaller than the minimum value of the first preset interval and is larger than or equal to the preset first threshold value, the left shift number needed for changing the second target fixed point value into a value between the first preset intervals is calculated, and the calculated left shift number is used for shifting the second target fixed point value, so that the second target fixed point value can be moved to the first preset interval and then moved to the first preset interval, the first lookup table and the interpolation calculation method can be used for calculating the logarithmic value of the target fixed point value, as described above, a plurality of numbers do not need to be calculated in real time like the prior art by adopting a Taylor formula, namely, a lot of time is not needed to be spent for calculation, the technical problem that the equipment of a low-calculation-force chip cannot recognize voice in real time is solved, the fixed point logarithm can be calculated quickly, the speed of fixed point reasoning is accelerated greatly, and the speed of voice recognition is accelerated. When the second target fixed point value is not in the first preset interval and the second target fixed point value is greater than or equal to the maximum value of the first preset interval, the right shift number required for changing the second target fixed point value into a value between the first preset intervals is calculated, and the second target fixed point value is shifted by the calculated right shift number, so that the second target fixed point value can be moved to the first preset interval and then moved to the first preset interval, the first lookup table and the interpolation calculation method can be used for calculating the logarithmic value of the target fixed point value, as described above, a plurality of numbers do not need to be calculated in real time like the prior art by adopting a Taylor formula, namely, a great amount of time consumption is not needed, the technical problem that the equipment of a low-calculation-force chip cannot recognize voice in real time is solved, the logarithmic value of the fixed point can be calculated quickly, the speed of fixed point reasoning is accelerated, and the speed of voice recognition is accelerated.
Drawings
FIG. 1 is a flowchart of a voice recognition acceleration method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a voice recognition acceleration device according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a computer device according to an embodiment of the present invention;
the achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, modules, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, modules, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any module and all combination of one or more of the associated listed items.
It will be understood by those skilled in the art that all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs unless defined otherwise. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
Floating point and fixed point conversion relationship: fixed point = int (floating point 2^q); floating point = fixed point/2^q; where q represents the numerical precision and int represents the rounding operation. The q values mentioned in the following examples of the invention, i.e. q1, q2, represent different numerical accuracies, are multiplication numbers, representing multiplication.
As shown in fig. 1, an embodiment of the present application provides a voice recognition acceleration method, where the method includes:
s1, acquiring an original voice signal.
In step S1, the original voice signal may be a voice signal collected by a microphone, or may be a voice signal sent by other devices.
S2, performing voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the logarithmic value of the target fixed point value is calculated by adopting the following steps.
S20, acquiring a target fixed point value.
In step S20, in the speech recognition process, fbank features need to be calculated, and the fbank feature extraction flow is as follows: and sequentially preprocessing, framing, windowing, fourier changing and passing through a group of Mel filters to obtain the result output by the Mel filters, and carrying out logarithmic (log) operation on the result output by the Mel filters to obtain fbank characteristics, wherein when calculating fbank characteristics, the target fixed point value is the result output by the Mel filters. Further, since a logarithmic (log) calculation is also used for decoding and recognizing the probability distribution matrix of the phoneme, the target fixed point value is the output value of the softmax function when decoding and recognizing the probability distribution matrix of the phoneme.
S21, moving the target fixed point value to a fixed q1 to obtain a second target fixed point value; where q1 denotes the accuracy of input data and is set in advance.
In step S21, q1 is the numerical precision of the input data, and moving the target setpoint value to a fixed q1 is equivalent to a normalization operation. Assuming that q1=15, the target setpoint value is a value of q=17, then the target setpoint value x1> > (17-15) is required, i.e. the target setpoint value x1 is required to be shifted 2 bits to the right. For another example, if the target setpoint value is a value of q=6, the target setpoint value x1< (15-6) is required, i.e., the target setpoint value x1 is required to be shifted to the left by 9 bits.
S22, judging whether the second target fixed point value is in a first preset interval or not.
In step S22, the first preset interval isThe n is an integer;when n=0, the range of the first preset interval is optimal, and the first preset interval +.>. It should be noted that the number of the substrates,the value of this interval is a fixed point value, not a floating point value, and if understood in terms of a floating point value, is based on the floating point and fixed point conversion relationships: fixed point = int (floating point 2^q); floating point = fixed point/2^q; wherein q represents the numerical precision, and int represents the rounding operation; the floating point interval corresponding to the first preset interval should be +.>When n=0, the floating point range corresponding to the first preset range should be +.>It should be noted that, the content of floating point is only for facilitating logic understanding, and fixed point operations are adopted in the actual calculation process.
S23, if the target fixed point value is within the first preset interval, calculating the logarithmic value of the target fixed point value by using the second target fixed point value, a preset first lookup table and an interpolation calculation method; the first lookup table stores a logarithmic value corresponding to a value taking a preset first value as an interval in the first preset interval.
In step S23, the numerical precision stored in the first lookup table is set to q2, and when n=0, q1=15, and q2=15, the first preset section is set toFor convenience of explanation, a first preset interval is used +.>The corresponding floating point interval is described. />The corresponding floating point interval is +.>Q1=15->The corresponding floating point interval is +.>For floating point interval->At intervals of 0.001, i.e. 1.001,1.002, assuming that the log2 value is found, log2 (1.001) = 0.001441974, the value of 47 is stored in a first look-up table with fixed point storage of q2=15, i.e. int (0.001441974 x 2≡) =47, the first few values in the first look-up table are shaped as follows: log_table 1= {0, 47, 94, 141, 188, 235, 282, 329, 376, 423, 470, 517, 563, 610,.}. Here, the first location stores 0, which is an acceleration location, such as calculating the log2 value of 1.116, directly locatable to log_table1[116 ]]And obtaining the product. It should be understood that the floating point value 0.001 corresponds to the fixed point value int (1.001 x 2 q2) =1.001 x 2 q15=32800, i.e. 47 is the log2 value of 32800. According to the method and the device, the first lookup table is built in advance, when the fixed point value of the second target is in the first preset interval, the value is checked through the first lookup table, interpolation calculation is carried out by utilizing the checked value, real-time calculation of a plurality of numbers is not needed like the Taylor formula adopted in the prior art, namely, time consumption is not needed to be spent for calculation, the technical problem that the equipment of a low-calculation-force chip cannot recognize voice in real time due to the fact that the time consumption of an existing software implementation mode (such as calculating logarithm by adopting the Taylor formula) is large is solved, the logarithm of the fixed point can be calculated quickly, the reasoning speed of the fixed point is greatly accelerated, and therefore the speed of voice recognition is accelerated.
S24, if the second target fixed point value is not in the first preset interval, judging whether the second target fixed point value is smaller than the minimum value of the first preset interval or larger than or equal to the maximum value of the first preset interval.
In step S24, the first preset interval is taken asFor example, if the first preset interval is not withinBetween, judge that said second target setpoint value is less than +.>Or greater than or equal to->
S25, if the second target fixed point value is smaller than the minimum value of the first preset interval, judging whether the second target fixed point value is smaller than a preset first threshold value.
In step S25, the first threshold is a value less than the minimum value of the first preset interval, preferablySelection 8 may enable fast calculations. Continuing the explanation on the basis of the example of step S24, if the second target setpoint value is less than +.>Then it is determined whether said second target setpoint value is smaller than +.>
S26, if the target fixed point value is smaller than the first threshold value, acquiring the logarithmic value of the target fixed point value through a preset second lookup table; wherein, the second lookup table stores the corresponding logarithmic value of the numerical value taking the preset second numerical value as the interval in the second preset interval; wherein the second preset interval is [0 ], and the first threshold value).
In step S26, the explanation is continued on the basis of the example of step S24, if it is smaller thanObtaining the logarithmic value of the target fixed point value through a preset second lookup table, and taking the logarithmic value as a first thresholdThe value is +.>I.e. the first threshold is 256, and assuming q1=15, q2=15 (i.e. the table data is stored with q2=15), log is found 2 The second table look-up data is log_tabel2[257 ]]-524288, -491520, -458752, -439584, -425984, -415435, -406816, -399529, -393216, -387648, -382667, & gt. Where-491520 is the log2 value of fixed point 1, and is derived from the conversion of floating point and fixed point, int (log 2 (1/2. Quadrature. Q1) ×2. Quadrature. Q2) =int ([ log) 2 (1/2^15) ]*2≡15= -491520; 458752 is log of setpoint 2 2 The value, int ([ log ], is obtained from the conversion of floating point and fixed point 2 (2/2^q1) ]*2^q2) =int([log 2 (2/2^15) ]*2≡15= -458752. Note that, -524288 is log of setpoint 0 2 The value is virtually minus infinity, but allows for-524288 for precision to meet the requirements. Thus, taking this truncated, i.e. let the log of setpoint 0 2 The value was-524288. In this example, the second predetermined interval is [0,256 ]]The second value is 1, and the second lookup table stores the logarithmic values of 257 fixed point values of 0,1,2,3. According to the method, the second lookup table is built in advance, when the second target fixed point value is smaller than the first threshold value, the second lookup table is used for searching the logarithmic value of the second target fixed point value, the searched logarithmic value of the second target fixed point value is used as the logarithmic value of the target fixed point value, real-time calculation of a plurality of numbers is not needed like the Taylor formula in the prior art, namely, a lot of time is not needed to be spent for calculation, so that the technical problem that the equipment of a low-calculation-force chip cannot recognize voice in real time due to the fact that the time consumption of an existing software implementation mode (such as calculating the logarithmic value by the Taylor formula) is large is solved, the logarithmic of the fixed point can be calculated quickly, the reasoning speed of the fixed point is greatly accelerated, and the speed of voice recognition is accelerated.
And S27, if the second target fixed point value is not smaller than the first threshold value, calculating the left shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the left shift number, and moving to the first preset intervals to obtain a third target fixed point value.
In step S27, the first threshold is 2^8 and the first preset interval isThen the second target setpoint value is changed to +.>Between them. Further calculating the number of left shifts required to change the second target fixed point value to a value between the first preset intervals refers to calculating the number of left shifts required to move the second target fixed point value to the first preset interval.
S28, calculating the logarithmic value of the target fixed point value by using the left shift number, the third target fixed point value, the first lookup table and an interpolation calculation method.
In step S28, when the second target fixed point value is not in the first preset interval, and when the second target fixed point value is smaller than the minimum value of the first preset interval and is not smaller than the first threshold, the left shift number required for changing the second target fixed point value to a value between the first preset intervals is calculated, and the second target fixed point value is shifted by using the calculated left shift number, so that the second target fixed point value can be moved to the first preset interval, and then moved to the first preset interval, the logarithm of the target fixed point value can be calculated by using the first lookup table and the interpolation calculation method, as described above, a large number of values need not be calculated in real time like the prior art, that is, a large amount of time is not required to be spent for calculation, so that the technical problem that the equipment of the low-calculation-force chip cannot recognize speech in real time is solved, the logarithm of the fixed point can be calculated quickly, and the recognition speed of the fixed point speech can be accelerated greatly is increased.
And S29, if the second target fixed point value is larger than or equal to the maximum value of the first preset interval, calculating the right shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the right shift number, and moving to the first preset interval to obtain a fourth target fixed point value.
In step S29, the first threshold is 2^8 and the first preset interval isThen the second target setpoint value is changed to +.>Between them. In addition, calculating the number of right shifts required to change the second target fixed point value to one value between the first preset sections refers to calculating the number of right shifts required to move the second target fixed point value to the first preset section.
S30, calculating the logarithmic value of the target fixed point value by using the right shift number, the fourth target fixed point value, the first lookup table and an interpolation calculation method.
In step S30, when the second target fixed point value is not in the first preset interval and the second target fixed point value is greater than or equal to the maximum value of the first preset interval, the right shift number required for changing the second target fixed point value to a value between the first preset intervals is calculated, and the second target fixed point value is shifted by using the calculated right shift number, so that the second target fixed point value can be moved to the first preset interval and then moved to the first preset interval, and then the logarithmic value of the target fixed point value can be calculated by using the first lookup table and the interpolation calculation method. The application method is applied to the low-power chip, so that the calculated amount can be reduced, the voice recognition speed can be accelerated, and further, the voice real-time recognition can be realized on the low-power chip.
In addition, the method of the invention has small occupied space and less than 3kb. This part of the value is fixed and can be stored in a low cost MROM. If the low-resource device does not have MROM, the low-resource device can also be completely loaded into the SRAM for searching during calculation. MROM (mask Read-Only Memory), which is a Read-Only Memory whose contents are fixed at the time of manufacture and cannot be modified, is far cheaper than SRAM (Read-write, equivalent to pc's Memory). The invention has high calculation precision, and the difference between the algorithm and a calculation library such as matlabnumpy is less than 10 < -4 > through the comparison of 1 hundred million random values, so that the precision requirement is completely met.
In one embodiment. The first preset interval isThe method comprises the steps of carrying out a first treatment on the surface of the Wherein n is an integer.
In one embodiment, the step of calculating the number of left shifts required to change the second target setpoint value to a value between the first preset intervals includes:
calculating the left shift number required to change the second target setpoint value to a value between the first preset intervals according to formula (1);
shift1= n + q1 + 1 -8- log_table3[x 2 >>8]; (1)
wherein x2 is a second target fixed point value, shift1 is a left shift number required for changing the second target fixed point value to a value between the first preset intervals, q1 represents the accuracy of input data and is preset, log_table3 is a preset third lookup table, log_table3 is n+1 elements in total, each element records a position of 1 of the highest bit of the position value, and N is equal to the first threshold value. For example, the second target setpoint value x 2 Less than a first threshold of 2A 8, log_table3[257 ]]The shapes are {0, 1,2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, }. Wherein the method comprisesEach element in the third lookup table records the position of the most significant 1 of its position value. It should be understood that the most significant 1 position of the position value herein refers to the most significant 1 position of its binary of the position value, e.g., 0 binary is 0 without 1, thus 0 most significant 1 is 0,1 binary is 1, 1 most significant 1 is 1,2 binary is 10, 1 most significant 1 is 2, and so on, 256 binary is 1 0000 0000, and 1 most significant is 9. Assuming n=0, q2=15, then shift 1=8-log_table 3[ x ] 2 >>8]If the second target fixed point value is 2≡10, the first preset interval isShift the second target fixed point value 2≡10 to +.>Then a shift of 5 bits to the left is required (i.e., 8-log_table3[4 ]]=8-3=5). The number of left shifts required to change the second target setpoint value to a value between the first preset intervals can be rapidly calculated by constructing a third lookup table in advance and using the above formula (1). By the method for calculating the shift, the traversal of 1 bit movement and then judgment is omitted, and the speed is greatly accelerated.
In one embodiment, the step of calculating the number of right shifts required to change the second target setpoint value to a value between the first preset intervals includes:
acquiring the second target fixed point value;
right shifting the second target fixed point value by n+q1+1 bits, and if the upper 32- (n+q1+1) -8 bits in the remaining bit numbers are 0 after the second target fixed point value is right shifted by n+q1+1 bits, acquiring a shift corresponding to the lower 8 bit number value through a preset third lookup table, and taking the shift corresponding to the lower 8 bit number value as a right shift number required for changing the second target fixed point value into a value between the first preset intervals;
if the high 32- (n+q1+1) -8 bits are not 0 in the rest bit numbers, shifting by 8 bits to the right, and judging whether 32- (n+q1+1) - (a+1) x 8 is greater than or equal to 8; a is the number of times shifted by 8 bits to the right; if n+q1+1=8, the right shift of the second target setpoint value by n+q1+1 is not counted by 8 right shift times;
if the number is smaller than 8, the shift corresponding to the residual numerical value is directly obtained through the third lookup table and is used as a first shift bit number; adding a x 8 to the first shift bit number to obtain a right shift bit number required for changing the second target fixed point value to a value between the first preset intervals;
If the number of the bits is greater than or equal to 8, continuing to move the bits to the right by 8 bits, and returning to the step of judging whether 32- (n+q1+1) - (a+1) x 8 is greater than or equal to 8 until 32- (n+q1+1) - (a+1) x 8 is less than 8; the third lookup table log_table3 contains n+1 elements, each element records the position of 1 of the highest bit of the position value, and N is equal to the first threshold value.
In general, one fixed point is represented by 32 bits, that is, the second fixed point value is 32 bits, when n=0, q1=14, the second target fixed point value is shifted 15 bits to the right, after shifting 15 bits to the right, 17 bits remain, and in the remaining 17 bits, if the value of the upper 9 bits is 0, the shift corresponding to the value of the lower eight bits is obtained through a preset third lookup table; if the upper 9 bits of the remaining 17 bits are not 0, then the left shift is 8 bits, at this time the remaining 9 bits need to see if the upper 9-8 bits are 0, if 0, the shift corresponding to the lower 8 bits is added with 8, which is the final result. If the upper 9-8 bits of the remaining 9 bits are not 0, the shift corresponding to the upper 1 bit is added by 16 to be the final result.
Also for example, the second setpoint value is 32 bits, when n=0, q1=15, for example, the second target setpoint value is 2≡17 right shifted by 16 bits followed by 2, corresponding,
The 32-bit binary of 2≡17 is:
0000 0000 0000 00100000000000000000,
after shifting it to the right by 16 bits, the remaining bits are 0000 0000 0000 0010, and it can be seen that the upper 8 bits are 0, so that the shift corresponding to the lower 8 bits of the bit number can be obtained through the preset third lookup table, the lower 8 bits of the bit number are 0000 0010, i.e. the value of log_table3[2], log_table3[2] =2, i.e. the bit number needs to be shifted to the right by 2 bits.
By the method, the position with the height of 1 of the second target fixed point value can be omitted from traversing, the searching speed is greatly accelerated by a mode equivalent to direct positioning, and the number of digits needing right shift can be rapidly obtained.
The most significant bits described in this application refer to the most significant bits in binary form, and shift, etc., are described in terms of binary (the fixed point values are stored in binary, and for convenience, are sometimes explained in decimal).
In an embodiment, the calculating the logarithmic value of the target fixed point value using the second target fixed point value, a preset first lookup table and an interpolation calculating method; the step of storing the corresponding logarithmic value of the value with the preset first value as the interval in the first preset interval in the first lookup table includes:
S231, calculating a first substrate, a second substrate and a third substrate of the second target fixed point value based on the second target fixed point value.
In step S231, when the first preset interval isWhen (the following steps S232-S236 are all carried out with the first preset interval +.>Based on the enumerated formula), will second target setpoint value x 2 Substituting x in the following formula (2), and then calculating the first base, the second base, and the third base of the second target setpoint value in the order of formulas (2) - (5).
x_int = (x - 2^(q1+n))*10;(2)
n1 =x_int>>(q1+n);(3)
x_res = x_int - (n1<<(q1+n));x_int = x_res*10;n2 = x_int>>(q1+n);(4)
x_res = x_int - (n2<<(q1+n));x_int = x_res*10;n3 = x_int>>(q1+n);(5)
Wherein x is an independent variable, q1 is the precision of input data, n is an integer, n is preset, n1 is a first substrate of x, n2 is a second substrate of x, n3 is a third substrate of x, and x_int and x_res are intermediate variables; the term < left shift, > > right shift.
To facilitate understanding of the first base, the second base, and the third base, in which the second target-fixed point value is calculated in the order of formulas (2) - (5), the following codes are given for assistance in understanding (the following codes q1=15, n=0):
int x_int = (x -2^15)*10;
int nums[3] = {0,0,0};
for (int i = 0;i<3;i++)
{
nums[i] = (x_int>>15);
int x_res = x_int - (nums[i]<<15);
x_int = x_res * 10;
}
in this code, nums [0] is n1, nums [1] is n2, and nums [2] is n3.
It should also be noted that the substrate can be understood in a floating point number as follows: for example, 1.2345 = 1*1 +2×0.1+3×0.01+4×0.001+5×0.0001, where 1.1.0.01 is the substrate, and converting the floating point number substrate into the fixed point value is the fixed point substrate. When the first preset interval is When n=0, the floating point interval of the first preset interval is [1, 2), then the first base of the floating point value corresponding to the second target fixed point value is the first bit after the decimal point, the second base is the second bit after the decimal point, and the third base is the third bit after the decimal point. This is illustrated for ease of visual understanding and does not mean that the floating point participates in the operation.
S232, calculating the distance from the second target fixed point value to the left numerical value based on the first substrate, the second substrate and the third substrate of the second target fixed point value.
In this step S232, the second target-fixed-point value x 2 Substituting x in the following formula (6) to calculate to obtain the secondThe distance of the target setpoint value from the value to the left thereof.
d1 = x - 2^(q1+n) - ((n1<<(q1+n) ) / 10) - ((n2<<(q1+n) ) / 100) - ((n3<<(q1+n) ) / 1000);(6)
Where x is an argument, q1 is a precision of input data and is set in advance, n is an integer and is set in advance, < < is left shift, and d1 is a distance of x from a value on the left side (adjacent left side) thereof.
S233, calculating the distance between the second target fixed point value and the numerical value on the right side of the second target fixed point value based on the distance between the second target fixed point value and the numerical value on the left side of the second target fixed point value.
In this step S233, d1 calculated in step S232 is brought into formula (7) to obtain
The second target setpoint value is a distance from the value to the right thereof.
d2 =int(0.001*2^(n+q1)) - d1 ;(7)
Where d2 is the distance of x from the value to the right (adjacent right) and d1 is the distance of x from the value to the left (adjacent left).
S234, calculating the position of the second target fixed point value in the first lookup table based on the first substrate, the second substrate and the third substrate of the second target fixed point value.
In step S234, n1, n2, and n3 calculated in step S231 are substituted into formula (8), and the position of the second target fixed point value in the first lookup table is obtained.
pos = n1 * 100 + n2*10 + n3 ;(8)
Where pos is the position of x in the first lookup table, i.e. when x is the second target setpoint value, pos is the position of the second target setpoint value in the first lookup table.
S235, calculating the logarithmic value of the second target fixed point value by using an interpolation calculation method based on the distance of the second target fixed point value from the numerical value on the left side of the second target fixed point value, the distance of the second target fixed point value from the numerical value on the right side of the second target fixed point value and the position of the second target fixed point value in the first lookup table.
In step S235, d1 calculated in step S232, d2 calculated in step S233, and pos calculated in step S234 are substituted into the formula (9) to obtain the logarithmic value of the second target setpoint value.
;(9)
Wherein equation (9) is an interpolation equation, y_cal isWhen substituting the second target setpoint value as x into x in equation (2), y_cal is the logarithmic value of the second target setpoint value. In log 2 For example, y_cal is +.>Log of values within a range 2 Values.
S236 takes the logarithmic value of the second target fixed point value as the logarithmic value of the target fixed point value.
In one embodiment, the calculating the logarithmic value of the target setpoint value using the left shift number, the third target setpoint value, the first lookup table, and an interpolation method includes:
s281, calculating a first substrate, a second substrate and a third substrate of the third target fixed point value based on the third target fixed point value.
In step S281, when the first preset interval isWhen (the following steps S282-S286 are all carried out with the first preset interval +.>Based on the enumerated formula), a third target setpoint value x 3 Substituting x in the following formula (2), and then calculating the first base, the second base, and the third base of the third target setpoint value in the order of formulas (2) - (5).
x_int = (x - 2^(q1+n))*10;(2)
n1 =x_int>>(q1+n);(3)
x_res = x_int - (n1<<(q1+n));x_int = x_res*10;n2 = x_int>>(q1+n);(4)
x_res = x_int - (n2<<(q1+n));x_int = x_res*10;n3 = x_int>>(q1+n);(5)
Wherein x is an independent variable, q1 is the precision of input data, n is an integer, n is preset, n1 is a first substrate of x, n2 is a second substrate of x, n3 is a third substrate of x, and x_int and x_res are intermediate variables; the term < left shift, > > right shift.
To facilitate understanding of the first base, the second base, and the third base, where the third target-fixed-point value is calculated in the order of formulas (2) - (5), the following codes are given for aiding understanding:
int x_int = (x -2^15)*10;
int nums[3] = {0,0,0};
for (int i = 0;i<3;i++)
{
nums[i] = (x_int>>15);
int x_res = x_int - (nums[i]<<15);
x_int = x_res * 10;
}
in this code, nums [0] is n1, nums [1] is n2, and nums [2] is n3.
It should also be noted that the substrate can be understood in a floating point number as follows: for example, 1.2345 = 1*1 +2×0.1+3×0.01+4×0.001+5×0.0001, where 1.1.0.01 is the substrate, and converting the floating point number substrate into the fixed point value is the fixed point substrate. When the first preset interval isAnd when n=0, the floating point interval of the first preset interval is [1, 2), then the first base of the floating point value corresponding to the third target fixed point value is the first bit after the decimal point, the second base is the second bit after the decimal point, and the third base is the third bit after the decimal point. This is illustrated for floating point at this time to facilitate visual understandingFloating point participation is not meant to be an operation.
S282, calculating the distance of the third target fixed point value from the numerical value on the left side of the third target fixed point value based on the first substrate, the second substrate and the third substrate of the third target fixed point value.
In step S282, the third target fixed point value x 3 Substituting x in the following formula (6) for calculation, and calculating the distance from the third target fixed point value to the left numerical value.
d1 = x - 2^(q1+n) - ((n1<<(q1+n) ) / 10) - ((n2<<(q1+n) ) / 100) - ((n3<<(q1+n) ) / 1000);(6)
Where x is an argument, q1 is a precision of input data and is set in advance, n is an integer and is set in advance, < < is left shift, and d1 is a distance of x from a value on the left side (adjacent left side) thereof.
S283, calculating the distance between the third target fixed point value and the numerical value on the right side of the third target fixed point value based on the distance between the third target fixed point value and the numerical value on the left side of the third target fixed point value.
In step S283, d1 calculated in step S282 is substituted into formula (7) to obtain
The distance of the third target setpoint value from the value to the right thereof.
d2 =int(0.001*2^(n+q1)) - d1 ;(7)
Where d2 is the distance of x from the value to the right (adjacent right) and d1 is the distance of x from the value to the left (adjacent left).
S284, calculating the position of the third target fixed point value in the first lookup table based on the first substrate, the second substrate and the third substrate of the third target fixed point value.
In step S284, n1, n2, and n3 calculated in step S281 are substituted into formula (8), and the position of the third target fixed point value in the first lookup table is obtained.
pos = n1 * 100 + n2*10 + n3 ;(8)
Where pos is the position of x in the first lookup table, i.e. when x is the third target setpoint value, pos is the position of the third target setpoint value in the first lookup table.
S285, calculating the logarithmic value of the third target fixed point value by an interpolation calculation method based on the distance of the third target fixed point value from the left numerical value, the distance of the third target fixed point value from the right numerical value, and the position of the third target fixed point value in the first lookup table
In step S285, d1 calculated in step S282, d2 calculated in step S283, and pos calculated in step S284 are substituted into the formula (9), and the logarithmic value of the third target fixed point value is obtained.
;(9)
Wherein equation (9) is an interpolation equation, y_cal isLog values of values within the range. In log 2 For example, y_cal is +.>Log of values within a range 2 Values. When the third target-fixed-point value is substituted as x into x in formula (2), y_cal is the logarithmic value of the third target-fixed-point value.
S286, calculating the logarithmic value of the target fixed point value according to the logarithmic value of the third target fixed point value, the left shift number and the q 1.
In the present embodiment, it is the log of the target setpoint value that is sought 2 When the value is obtained, y_cal calculated in step S285 is substituted as shift into the following formula (10), and the logarithmic value of the target fixed point value is obtained.
y=y1+y_cal,y1=-shift*2 n+q1 ;(10)
Where y is the logarithmic value of the target setpoint value and y1 is the partial result.
In one embodiment, the calculating the logarithmic value of the target setpoint value using the right shift number, the fourth target setpoint value, the first lookup table, and an interpolation method includes:
s301, calculating a first substrate, a second substrate and a third substrate of the fourth target fixed point value based on the fourth target fixed point value.
In step S301, when the first preset interval isWhen (the following steps S302-S306 are all about the first preset interval +.>Based on the enumerated formula), the fourth target setpoint value x 4 Substituting x in the following formula (2), and then calculating the first base, the second base, and the third base of the fourth target setpoint value in the order of formulas (2) - (5).
x_int = (x - 2^(q1+n))*10;(2)
n1 =x_int>>(q1+n);(3)
x_res = x_int - (n1<<(q1+n));x_int = x_res*10;n2 = x_int>>(q1+n);(4)
x_res = x_int - (n2<<(q1+n));x_int = x_res*10;n3 = x_int>>(q1+n);(5)
Wherein x is an independent variable, q1 is the precision of input data, n is an integer, n is preset, n1 is a first substrate of x, n2 is a second substrate of x, n3 is a third substrate of x, and x_int and x_res are intermediate variables; the term < left shift, > > right shift.
To facilitate understanding of the first base, the second base, and the third base, where the third target-fixed-point value is calculated in the order of formulas (2) - (5), the following codes are given for aiding understanding:
int x_int = (x -2^15)*10;
int nums[3] = {0,0,0};
for (int i = 0;i<3;i++)
{
nums[i] = (x_int>>15);
int x_res = x_int - (nums[i]<<15);
x_int = x_res * 10;
}
in this code, nums [0] is n1, nums [1] is n2, and nums [2] is n3.
It should also be noted that the substrate can be understood in a floating point number as follows: for example, 1.2345 = 1*1 +2×0.1+3×0.01+4×0.001+5×0.0001, where 1.1.0.01 is the substrate, and converting the floating point number substrate into the fixed point value is the fixed point substrate. When the first preset interval isAnd when n=0, the floating point interval of the first preset interval is [1, 2), then the first base of the floating point value corresponding to the fourth target fixed point value is the first bit after the decimal point, the second base is the second bit after the decimal point, and the third base is the third bit after the decimal point. This is illustrated for ease of visual understanding and does not mean that the floating point participates in the operation.
S302, calculating the distance from the fourth target fixed point value to the left numerical value based on the first substrate, the second substrate and the third substrate of the fourth target fixed point value.
In step S302, the fourth target fixed point value x 4 Substituting x in the following formula (6) for calculation, and calculating the distance from the fourth target fixed point value to the left numerical value.
d1 = x - 2^(q1+n) - ((n1<<(q1+n) ) / 10) - ((n2<<(q1+n) ) / 100) - ((n3<<(q1+n) ) / 1000);(6)
Where x is an argument, q1 is the precision of the input data and is preset, n is an integer, and is preset, < < is left shift, and d1 is the distance of x from the value on the left side (adjacent left side) thereof.
S303, calculating the distance between the fourth target fixed point value and the numerical value on the right side of the fourth target fixed point value based on the distance between the fourth target fixed point value and the numerical value on the left side of the fourth target fixed point value.
In step S303, d1 calculated in step S303 is substituted into formula (7) to obtain
The distance of the fourth target setpoint value from the value to the right thereof.
d2 =int(0.001*2^(n+q1)) - d1 ;(7)
Where d2 is the distance of x from the value to the right (adjacent right) and d1 is the distance of x from the value to the left (adjacent left).
S304, calculating the position of the fourth target fixed point value in the first lookup table based on the first substrate, the second substrate and the third substrate of the fourth target fixed point value.
In step S304, n1, n2, and n3 calculated in step S301 are substituted into formula (8), and the position of the fourth target fixed point value in the first lookup table is obtained.
pos = n1 * 100 + n2*10 + n3 ;(8)
Where pos is the position of x in the first lookup table, i.e. when x is the fourth target setpoint value, pos is the position of the fourth target setpoint value in the first lookup table.
S305, calculating the logarithmic value of the fourth target fixed point value by using an interpolation calculation method based on the distance between the fourth target fixed point value and the numerical value on the left side of the fourth target fixed point value, the distance between the fourth target fixed point value and the numerical value on the right side of the fourth target fixed point value and the position of the fourth target fixed point value in the first lookup table.
In step S305, d1 calculated in step S302, d2 calculated in step S303, and pos calculated in step S304 are substituted into the formula (9), and a logarithmic value of the fourth target setpoint value is obtained.
The method comprises the steps of carrying out a first treatment on the surface of the Wherein formula (9) is an interpolation formula, y_cal is +.>Log values of values within the range. In log 2 For example, y_cal is +.>Log of values within a range 2 Values. When the fourth target-fixed-point value is substituted as x into x in formula (2), y_cal is the fourth target-fixed-point valueLogarithmic values.
S306, calculating the logarithmic value of the target fixed point value according to the logarithmic value of the fourth target fixed point value, the right shift number and the q 1.
In the present embodiment, it is the log of the target setpoint value that is sought 2 When the value is obtained, y_cal calculated in step S305 is substituted as shift into the following formula (10), and the logarithmic value of the target fixed point value is obtained.
y=y1+y_cal,y1=shift*2 n+q1 ;(10)
Where y is the logarithmic value of the target setpoint value and y1 is the partial result.
In one embodiment, log 2 For example, if the calculated log value of y as the target fixed point value is the log of the target fixed point value 2 Then, log10 (x) can be calculated according to log10 (x) =log 2 (x)/log 2 (10), wherein 1/log2 (10) can be directly calculated and converted into a fixed point value calculation, and 1/log2 (10) × 2^8 =77, so that the fixed point calculation can be changed into log10 (x) = (log 2 (x) ×77)>>8. Here, 8 is selected because 8 can satisfy the accuracy requirement.
According to the formula ln (x) =log2 (x)/log 2 (e), where 1/log2 (e) 2^9 =355 so ln (x) = (log 2 (x) 355) > >9. Here, 9 is selected because 9 can satisfy the accuracy requirement.
Referring to fig. 2, an embodiment of the present application further provides a voice recognition acceleration device, where the device includes:
the acquisition module 1 is used for acquiring an original voice signal;
the voice recognition module 2 is used for carrying out voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the following units are adopted to calculate the logarithmic value of the target fixed point value:
a first acquisition unit 21 for acquiring a target fixed point value;
A moving unit 31 for moving the target setpoint value to a fixed q1 to obtain a second target setpoint value; wherein q1 represents the accuracy of the input data and is set in advance;
a first judging unit 22, configured to judge whether the second target fixed point value is within a first preset interval;
a first calculation unit 23, configured to calculate, if the first preset interval is within the first preset interval, a logarithmic value of the target fixed point value using the second target fixed point value, a preset first lookup table, and an interpolation calculation method; wherein, the first lookup table stores the corresponding logarithmic value of the numerical value taking the preset first numerical value as the interval in the first preset interval;
a second judging unit 24 for judging whether the second target setpoint value is smaller than the minimum value of the first preset section or greater than or equal to the maximum value of the first preset section if not within the first preset section;
a third judging unit 25, configured to judge whether the second target fixed point value is smaller than a preset first threshold value if the second target fixed point value is smaller than a minimum value of the first preset interval;
a second obtaining unit 26, configured to obtain, if the first threshold is smaller than the second threshold, a logarithmic value of the target fixed-point value through a preset second lookup table; wherein, the second lookup table stores the corresponding logarithmic value of the numerical value taking the preset second numerical value as the interval in the second preset interval; wherein the second preset interval is [0 ], a first threshold value;
A second calculation unit 27 for calculating a left shift number required to change the second target fixed point value to a value between the first preset sections if not smaller than the first threshold, shifting the second target fixed point value by the left shift number, and moving to the first preset section to obtain a third target fixed point value;
a third calculation unit 28 for calculating a logarithmic value of the target fixed point value using the left shift number, the third target fixed point value, the first lookup table, and an interpolation calculation method;
a fourth calculation unit 29, configured to calculate a right shift number required to change the second target fixed point value to a value between the first preset intervals if the second target fixed point value is greater than or equal to the maximum value of the first preset intervals, shift the second target fixed point value by using the right shift number, and move to the first preset intervals to obtain a fourth target fixed point value;
a fifth calculation unit 30 for calculating a logarithmic value of the target fixed point value using the right shift number, the fourth target fixed point value, the first lookup table, and an interpolation calculation method.
In one embodiment, the first preset interval is The method comprises the steps of carrying out a first treatment on the surface of the Wherein n is an integer.
In one embodiment, the second computing unit 27 is specifically configured to:
calculating the left shift number required to change the second target setpoint value to a value between the first preset intervals according to formula (1);
shift1= n + q1+ 1 -8- log_table3[x2>>8];(1)
wherein x2 is a second target fixed point value, shift1 is a left shift number required for changing the second target fixed point value to a value between the first preset intervals, log_table3 is a preset third lookup table, the third lookup table log_table3 contains n+1 elements, each element records a position of 1 of the highest bit of the position value, and N is equal to the first threshold; where q1 denotes the accuracy of input data and is set in advance.
In one embodiment, the fourth computing unit 29 is specifically configured to:
acquiring the second target fixed point value;
right shifting the second target fixed point value by n+q1+1 bits, and if the upper 32- (n+q1+1) -8 bits in the remaining bit numbers are 0 after the second target fixed point value is right shifted by n+q1+1 bits, acquiring a shift corresponding to the lower 8 bit number value through a preset third lookup table, and taking the shift corresponding to the lower 8 bit number value as a right shift number required for changing the second target fixed point value into a value between the first preset intervals;
If the high 32- (n+q1+1) -8 bits are not 0 in the rest bit numbers, shifting by 8 bits to the right, and judging whether 32- (n+q1+1) - (a+1) x 8 is greater than or equal to 8; a is the number of times shifted by 8 bits to the right; if n+q1+1=8, the right shift of the second target setpoint value by n+q1+1 is not counted by 8 right shift times;
if the number is smaller than 8, the shift corresponding to the residual numerical value is directly obtained through the third lookup table and is used as a first shift bit number; adding a x 8 to the first shift bit number to obtain a right shift bit number required for changing the second target fixed point value to a value between the first preset intervals;
if the number of the bits is greater than or equal to 8, continuing to move the bits to the right by 8 bits, and returning to the step of judging whether 32- (n+q1+1) - (a+1) x 8 is greater than or equal to 8 until 32- (n+q1+1) - (a+1) x 8 is less than 8; the third lookup table log_table3 contains n+1 elements, each element records the position of 1 of the highest bit of the position value, and N is equal to the first threshold value.
In one embodiment, the first computing unit 23 includes:
a first calculation subunit configured to calculate a first substrate, a second substrate, and a third substrate of the second target setpoint value based on the second target setpoint value;
a second calculation subunit for calculating a distance of the second target setpoint value from a numerical value to the left thereof based on the first base, the second base, and the third base of the second target setpoint value;
A third calculation subunit, configured to calculate a distance from the second target fixed point value to a value on the right side of the second target fixed point value based on the distance from the second target fixed point value to the value on the left side of the second target fixed point value;
a fourth calculation subunit configured to calculate a position of the second target-fixed-point value in the first lookup table based on the first base, the second base, and the third base of the second target-fixed-point value;
a fifth calculating subunit, configured to calculate, by using an interpolation calculation method, a logarithmic value of the second target fixed point value based on a distance of the second target fixed point value from a value on the left side thereof, a distance of the second target fixed point value from a value on the right side thereof, and a position of the second target fixed point value in the first lookup table;
and the equivalent unit is used for taking the logarithmic value of the second target fixed point value as the logarithmic value of the target fixed point value.
In one embodiment, the third computing unit 28 includes:
a sixth calculation subunit configured to calculate a first base, a second base, and a third base of the third target setpoint value based on the third target setpoint value;
a seventh calculation subunit configured to calculate, based on the first base, the second base, and the third base of the third target-fixed-point value, a distance of the third target-fixed-point value from a numerical value to the left thereof;
An eighth calculation subunit configured to calculate a distance of the third target fixed point value from a value on the right thereof based on the distance of the third target fixed point value from a value on the left thereof;
a ninth calculation subunit configured to calculate a position of the third target-fixed-point value in the first lookup table based on the first base, the second base, and the third base of the third target-fixed-point value;
a tenth calculation subunit, configured to calculate, by using an interpolation calculation method, a logarithmic value of the third target fixed point value based on a distance of the third target fixed point value from a value on the left side thereof, a distance of the third target fixed point value from a value on the right side thereof, and a position of the third target fixed point value in the first lookup table;
an eleventh calculation subunit for calculating the logarithmic value of the target fixed point value according to the logarithmic value of the third target fixed point value, the left shift number, and the q 1.
In an embodiment, the fifth calculating unit 30 includes:
a twelfth calculation subunit for calculating the first, second, and third substrates of the fourth target setpoint value based on the fourth target setpoint value;
a thirteenth calculation subunit configured to calculate, based on the first base, the second base, and the third base of the fourth target-fixed-point value, a distance of the fourth target-fixed-point value from a numerical value to the left thereof;
A fourteenth calculation subunit configured to calculate a distance of the fourth target-fixed-point value from a value on the right thereof based on the distance of the fourth target-fixed-point value from a value on the left thereof;
a fifteenth calculation subunit for calculating a position of the fourth target-fixed-point value in the first lookup table based on the first base, the second base, and the third base of the fourth target-fixed-point value;
a sixteenth calculating subunit, configured to calculate, by using an interpolation calculation method, a logarithmic value of the fourth target fixed-point value based on a distance of the fourth target fixed-point value from a value on the left side thereof, a distance of the fourth target fixed-point value from a value on the right side thereof, and a position of the fourth target fixed-point value in the first lookup table;
a seventeenth calculation subunit calculates a logarithmic value of the target fixed-point value according to the logarithmic value of the fourth target fixed-point value, the right shift number, and the q 1.
In an embodiment, the first threshold is
Referring to fig. 3, an embodiment of the present invention further provides a computer device, and an internal structure of the computer device may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The nonvolatile storage medium stores an operating device, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing data of a voice recognition acceleration method and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. Further, the above-mentioned computer apparatus may be further provided with an input device, a display screen, and the like. The computer program is executed by a processor to realize a voice recognition acceleration method, and comprises the following steps: acquiring an original voice signal; performing voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the logarithmic value of the target fixed point value is calculated by adopting the following steps: acquiring a target fixed point value; moving the target fixed point value to a fixed q1 to obtain a second target fixed point value; wherein q1 represents the accuracy of the input data and is set in advance; judging whether the second target fixed point value is in a first preset interval or not; if the target fixed point value is within the first preset interval, calculating the logarithmic value of the target fixed point value by using the second target fixed point value, a preset first lookup table and an interpolation calculation method; wherein, the first lookup table stores the corresponding logarithmic value of the numerical value taking the preset first numerical value as the interval in the first preset interval; if the second target fixed point value is not in the first preset interval, judging whether the second target fixed point value is smaller than the minimum value of the first preset interval or larger than or equal to the maximum value of the first preset interval; if the second target fixed point value is smaller than the minimum value of the first preset interval, judging whether the second target fixed point value is smaller than a preset first threshold value or not; if the target fixed point value is smaller than the first threshold value, acquiring the logarithmic value of the target fixed point value through a preset second lookup table; wherein, the second lookup table stores the corresponding logarithmic value of the numerical value taking the preset second numerical value as the interval in the second preset interval; wherein the second preset interval is [0 ], a first threshold value; if the second target fixed point value is not smaller than the first threshold value, calculating a left shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the left shift number, and moving to the first preset intervals to obtain a third target fixed point value; calculating the logarithmic value of the target fixed point value by using the left shift number, the third target fixed point value, the first lookup table and an interpolation calculation method; if the second target fixed point value is greater than or equal to the maximum value of the first preset interval, calculating the right shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the right shift number, and moving to the first preset interval to obtain a fourth target fixed point value; and calculating the logarithmic value of the target fixed point value by using the right shift number, the fourth target fixed point value, the first lookup table and an interpolation calculation method. Those skilled in the art will appreciate that the architecture shown in fig. 3 is merely a block diagram of a portion of the architecture in connection with the present application and is not intended to limit the computer device to which the present application is applied.
An embodiment of the present application further provides a computer readable storage medium having a computer program stored thereon, which when executed by a processor, implements a speech recognition acceleration method, including the steps of: acquiring an original voice signal; performing voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the logarithmic value of the target fixed point value is calculated by adopting the following steps: acquiring a target fixed point value; moving the target fixed point value to a fixed q1 to obtain a second target fixed point value; wherein q1 represents the accuracy of the input data and is set in advance; judging whether the second target fixed point value is in a first preset interval or not; if the target fixed point value is within the first preset interval, calculating the logarithmic value of the target fixed point value by using the second target fixed point value, a preset first lookup table and an interpolation calculation method; wherein, the first lookup table stores the corresponding logarithmic value of the numerical value taking the preset first numerical value as the interval in the first preset interval; if the second target fixed point value is not in the first preset interval, judging whether the second target fixed point value is smaller than the minimum value of the first preset interval or larger than or equal to the maximum value of the first preset interval; if the second target fixed point value is smaller than the minimum value of the first preset interval, judging whether the second target fixed point value is smaller than a preset first threshold value or not; if the target fixed point value is smaller than the first threshold value, acquiring the logarithmic value of the target fixed point value through a preset second lookup table; wherein, the second lookup table stores the corresponding logarithmic value of the numerical value taking the preset second numerical value as the interval in the second preset interval; wherein the second preset interval is [0 ], a first threshold value; if the second target fixed point value is not smaller than the first threshold value, calculating a left shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the left shift number, and moving to the first preset intervals to obtain a third target fixed point value; calculating the logarithmic value of the target fixed point value by using the left shift number, the third target fixed point value, the first lookup table and an interpolation calculation method; if the second target fixed point value is greater than or equal to the maximum value of the first preset interval, calculating the right shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the right shift number, and moving to the first preset interval to obtain a fourth target fixed point value; and calculating the logarithmic value of the target fixed point value by using the right shift number, the fourth target fixed point value, the first lookup table and an interpolation calculation method. It is understood that the computer readable storage medium in this embodiment may be a volatile readable storage medium or a nonvolatile readable storage medium.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile 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 a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the invention, and all equivalent structures or equivalent processes using the descriptions and drawings of the present invention or directly or indirectly applied to other related technical fields are included in the scope of the invention.

Claims (10)

1. A method for accelerating speech recognition, the method comprising:
acquiring an original voice signal;
performing voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the logarithmic value of the target fixed point value is calculated by adopting the following steps:
Acquiring a target fixed point value;
moving the target fixed point value to a fixed q1 to obtain a second target fixed point value; wherein q1 represents the accuracy of the input data and is set in advance;
judging whether the second target fixed point value is in a first preset interval or not;
if the target fixed point value is within the first preset interval, calculating the logarithmic value of the target fixed point value by using the second target fixed point value, a preset first lookup table and an interpolation calculation method; wherein, the first lookup table stores the corresponding logarithmic value of the numerical value taking the preset first numerical value as the interval in the first preset interval;
if the second target fixed point value is not in the first preset interval, judging whether the second target fixed point value is smaller than the minimum value of the first preset interval or larger than or equal to the maximum value of the first preset interval;
if the second target fixed point value is smaller than the minimum value of the first preset interval, judging whether the second target fixed point value is smaller than a preset first threshold value or not;
if the target fixed point value is smaller than the first threshold value, acquiring the logarithmic value of the target fixed point value through a preset second lookup table; wherein, the second lookup table stores the corresponding logarithmic value of the numerical value taking the preset second numerical value as the interval in the second preset interval; wherein the second preset interval is [0 ], a first threshold value;
If the second target fixed point value is not smaller than the first threshold value, calculating a left shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the left shift number, and moving to the first preset intervals to obtain a third target fixed point value;
calculating the logarithmic value of the target fixed point value by using the left shift number, the third target fixed point value, the first lookup table and an interpolation calculation method;
if the second target fixed point value is greater than or equal to the maximum value of the first preset interval, calculating the right shift number required for changing the second target fixed point value into a value between the first preset intervals, shifting the second target fixed point value by using the right shift number, and moving to the first preset interval to obtain a fourth target fixed point value;
and calculating the logarithmic value of the target fixed point value by using the right shift number, the fourth target fixed point value, the first lookup table and an interpolation calculation method.
2. The method according to claim 1, wherein the first predetermined interval isThe method comprises the steps of carrying out a first treatment on the surface of the Wherein n is an integer.
3. The voice recognition acceleration method of claim 2, wherein the step of calculating a left shift number required to change the second target-fixed-point value to a value between the first preset intervals comprises:
Calculating the left shift number required to change the second target setpoint value to a value between the first preset intervals according to formula (1);
shift1= n + q1+ 1 -8- log_table3[x 2 >>8];(1)
wherein x is 2 For the second target fixed point value, shift1 is the left shift number required for changing the second target fixed point value to a value between the first preset intervals, log_table3 is a preset third lookup table, the total number of the third lookup table log_table3 is n+1 elements, each element records the position of the highest 1 of the position values, and N is equal to the first threshold value; where q1 denotes the accuracy of input data and is set in advance.
4. The voice recognition acceleration method of claim 2, wherein the step of calculating a right shift number required to change the second target-fixed-point value to a value between the first preset intervals comprises:
acquiring the second target fixed point value;
right shifting the second target fixed point value by n+q1+1 bits, and if the upper 32- (n+q1+1) -8 bits in the remaining bit numbers are 0 after the second target fixed point value is right shifted by n+q1+1 bits, acquiring a shift corresponding to the lower 8 bit number value through a preset third lookup table, and taking the shift corresponding to the lower 8 bit number value as a right shift number required for changing the second target fixed point value into a value between the first preset intervals;
If the high 32- (n+q1+1) -8 bits are not 0 in the rest bit numbers, shifting by 8 bits to the right, and judging whether 32- (n+q1+1) - (a+1) x 8 is greater than or equal to 8; a is the number of times shifted by 8 bits to the right; if n+q1+1=8, the right shift of the second target setpoint value by n+q1+1 is not counted by 8 right shift times;
if the number is smaller than 8, the shift corresponding to the residual numerical value is directly obtained through the third lookup table and is used as a first shift bit number; adding a x 8 to the first shift bit number to obtain a right shift bit number required for changing the second target fixed point value to a value between the first preset intervals;
if the number of the bits is greater than or equal to 8, continuing to move the bits to the right by 8 bits, and returning to the step of judging whether 32- (n+q1+1) - (a+1) x 8 is greater than or equal to 8 until 32- (n+q1+1) - (a+1) x 8 is less than 8; the third lookup table log_table3 contains n+1 elements, each element records the position of 1 of the highest bit of the position value, and N is equal to the first threshold value.
5. The method according to claim 1, wherein the logarithmic value of the target fixed point value is calculated by using the second target fixed point value, a preset first lookup table and an interpolation calculation method; the step of storing the corresponding logarithmic value of the value with the preset first value as the interval in the first preset interval in the first lookup table includes:
Calculating a first base, a second base, and a third base of the second target setpoint value based on the second target setpoint value;
calculating a distance of the second target setpoint value from a value to the left thereof based on the first, second, and third substrates of the second target setpoint value;
calculating the distance of the second target setpoint value from the value to the right thereof based on the distance of the second target setpoint value from the value to the left thereof;
calculating a position of the second target setpoint value in the first lookup table based on the first, second, and third substrates of the second target setpoint value;
calculating the logarithmic value of the second target fixed point value by utilizing an interpolation calculation method based on the distance of the second target fixed point value from the numerical value on the left side of the second target fixed point value, the distance of the second target fixed point value from the numerical value on the right side of the second target fixed point value and the position of the second target fixed point value in the first lookup table;
and taking the logarithmic value of the second target fixed point value as the logarithmic value of the target fixed point value.
6. The method according to claim 1, wherein the step of calculating the logarithmic value of the target-fixed-point value using the left shift number, the third target-fixed-point value, the first lookup table, and the interpolation calculation method comprises:
Calculating a first base, a second base, and a third base of the third target setpoint value based on the third target setpoint value;
calculating a distance of the third target setpoint value from a value to the left thereof based on the first, second, and third substrates of the third target setpoint value;
calculating the distance of the third target setpoint value from the value to the right thereof based on the distance of the third target setpoint value from the value to the left thereof;
calculating a position of the third target setpoint value in the first lookup table based on the first base, the second base, and the third base of the third target setpoint value;
calculating the logarithmic value of the third target fixed point value by utilizing an interpolation calculation method based on the distance of the third target fixed point value from the numerical value on the left side of the third target fixed point value, the distance of the third target fixed point value from the numerical value on the right side of the third target fixed point value and the position of the third target fixed point value in the first lookup table;
and calculating the logarithmic value of the target fixed point value according to the logarithmic value of the third target fixed point value, the left shift number and the q 1.
7. The method according to claim 1, wherein the step of calculating the logarithmic value of the target-fixed-point value using the right shift number, the fourth target-fixed-point value, the first lookup table, and an interpolation calculation method comprises:
Calculating a first base, a second base, and a third base of the fourth target setpoint value based on the fourth target setpoint value;
calculating a distance of the fourth target setpoint value from a value to the left thereof based on the first, second, and third substrates of the fourth target setpoint value;
calculating the distance of the fourth target setpoint value from the value to the right thereof based on the distance of the fourth target setpoint value from the value to the left thereof;
calculating a position of the fourth target setpoint value in the first lookup table based on the first, second, and third bases of the fourth target setpoint value;
calculating the logarithmic value of the fourth target fixed point value by utilizing an interpolation calculation method based on the distance of the fourth target fixed point value from the numerical value on the left side of the fourth target fixed point value, the distance of the fourth target fixed point value from the numerical value on the right side of the fourth target fixed point value and the position of the fourth target fixed point value in the first lookup table;
and calculating the logarithmic value of the target fixed point value according to the logarithmic value of the fourth target fixed point value, the right shift number and the q 1.
8. The method for accelerating speech recognition according to claim 1, wherein the first threshold value is
9. A speech recognition acceleration apparatus, the apparatus comprising:
The acquisition module is used for acquiring an original voice signal;
the voice recognition module is used for carrying out voice recognition on the original voice signal to obtain a voice recognition result; in the voice recognition process, the following units are adopted to calculate the logarithmic value of the target fixed point value:
the first acquisition unit is used for acquiring a target fixed point value;
a moving unit for moving the target fixed point value to a fixed q1 to obtain a second target fixed point value; wherein q1 represents the accuracy of the input data and is set in advance;
the first judging unit is used for judging whether the second target fixed point value is in a first preset interval or not;
a first calculation unit, configured to calculate, if the first target fixed point value is within the first preset interval, a logarithmic value of the target fixed point value using the second target fixed point value, a preset first lookup table, and an interpolation calculation method; wherein, the first lookup table stores the corresponding logarithmic value of the numerical value taking the preset first numerical value as the interval in the first preset interval;
a second judging unit configured to judge whether the second target setpoint value is smaller than a minimum value of the first preset section or greater than or equal to a maximum value of the first preset section if the second target setpoint value is not within the first preset section;
A third judging unit, configured to judge whether the second target fixed point value is smaller than a preset first threshold value if the second target fixed point value is smaller than a minimum value of the first preset interval;
the second acquisition unit is used for acquiring the logarithmic value of the target fixed point value through a preset second lookup table if the second acquisition unit is smaller than the first threshold value; wherein, the second lookup table stores the corresponding logarithmic value of the numerical value taking the preset second numerical value as the interval in the second preset interval; wherein the second preset interval is [0 ], a first threshold value;
a second calculation unit, configured to calculate a left shift number required to change the second target fixed point value to a value between the first preset intervals if the second target fixed point value is not smaller than the first threshold, shift the second target fixed point value by using the left shift number, and move to the first preset interval to obtain a third target fixed point value;
a third calculation unit for calculating a logarithmic value of the target fixed point value using the left shift number, the third target fixed point value, the first lookup table, and an interpolation calculation method;
a fourth calculation unit, configured to calculate a right shift number required to change the second target fixed point value to a value between the first preset intervals if the second target fixed point value is greater than or equal to a maximum value of the first preset intervals, shift the second target fixed point value by using the right shift number, and move to the first preset intervals to obtain a fourth target fixed point value;
A fifth calculation unit for calculating a logarithmic value of the target fixed point value using the right shift number, the fourth target fixed point value, the first lookup table, and an interpolation calculation method.
10. A computer device comprising a memory and a processor, the memory having stored therein a computer program, characterized in that the processor, when executing the computer program, implements the steps of the speech recognition acceleration method of any one of claims 1 to 8.
CN202410182367.3A 2024-02-19 2024-02-19 Speech recognition acceleration method, device and equipment Pending CN117746867A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410182367.3A CN117746867A (en) 2024-02-19 2024-02-19 Speech recognition acceleration method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410182367.3A CN117746867A (en) 2024-02-19 2024-02-19 Speech recognition acceleration method, device and equipment

Publications (1)

Publication Number Publication Date
CN117746867A true CN117746867A (en) 2024-03-22

Family

ID=90261232

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410182367.3A Pending CN117746867A (en) 2024-02-19 2024-02-19 Speech recognition acceleration method, device and equipment

Country Status (1)

Country Link
CN (1) CN117746867A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030225580A1 (en) * 2002-05-29 2003-12-04 Yi-Jing Lin User interface, system, and method for automatically labelling phonic symbols to speech signals for correcting pronunciation
US20130196293A1 (en) * 2012-01-31 2013-08-01 Michael C. Wood Phonic learning using a mobile computing device having motion sensing capabilities
CN104424952A (en) * 2013-08-20 2015-03-18 索尼公司 Voice processing apparatus, voice processing method, and program
CN116466910A (en) * 2023-03-28 2023-07-21 上海思朗科技有限公司 Floating point number-based table lookup method and device, electronic equipment and storage medium
CN116543771A (en) * 2023-07-06 2023-08-04 深圳市友杰智新科技有限公司 Speech recognition method, device, storage medium and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030225580A1 (en) * 2002-05-29 2003-12-04 Yi-Jing Lin User interface, system, and method for automatically labelling phonic symbols to speech signals for correcting pronunciation
US20130196293A1 (en) * 2012-01-31 2013-08-01 Michael C. Wood Phonic learning using a mobile computing device having motion sensing capabilities
CN104424952A (en) * 2013-08-20 2015-03-18 索尼公司 Voice processing apparatus, voice processing method, and program
CN116466910A (en) * 2023-03-28 2023-07-21 上海思朗科技有限公司 Floating point number-based table lookup method and device, electronic equipment and storage medium
CN116543771A (en) * 2023-07-06 2023-08-04 深圳市友杰智新科技有限公司 Speech recognition method, device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
US20220172130A1 (en) Multi-step time series forecasting with residual learning
CN109857845B (en) Model training and data retrieval method, device, terminal and computer-readable storage medium
JP5377889B2 (en) Language processing apparatus and program
Gural et al. Memory-Optimal Direct Convolutions for Maximizing Classification Accuracy in Embedded Applications.
CN109710921B (en) Word similarity calculation method, device, computer equipment and storage medium
CN116543771B (en) Speech recognition method, device, storage medium and electronic equipment
CN112183065A (en) Text evaluation method and device, computer readable storage medium and terminal equipment
CN110825827A (en) Entity relationship recognition model training method and device and entity relationship recognition method and device
CN111370074B (en) Method and device for generating molecular sequence and computing equipment
WO2019163718A1 (en) Learning device, speech recognition order estimation device, methods therefor, and program
CN110853630A (en) Lightweight speech recognition method facing edge calculation
CN111723550A (en) Statement rewriting method, device, electronic device, and computer storage medium
CN113569196A (en) Data processing method, device, medium and equipment
CN117746867A (en) Speech recognition acceleration method, device and equipment
CN114579718A (en) Text feature generation method, device, equipment and storage medium combining RPA and AI
CN113626563A (en) Method and electronic equipment for training natural language processing model and natural language processing
CN110808036B (en) Incremental voice command word recognition method
CN113590811A (en) Text abstract generation method and device, electronic equipment and storage medium
CN111831805A (en) Model creation method and device, electronic equipment and readable storage device
CN115688779B (en) Address recognition method based on self-supervision deep learning
JP6301794B2 (en) Automaton deformation device, automaton deformation method and program
CN113656555A (en) Training method, device, equipment and medium for nested named entity recognition model
JP2008064849A (en) Sound model creation device, speech recognition device using the same, method, program and recording medium therefore
CN116306796B (en) Model self-growth training acceleration method and device, electronic equipment and storage medium
CN117634617B (en) Knowledge-intensive reasoning question-answering method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination