Method and apparatus for detecting starting point and finishing point of speech, computer device and storage medium
View Patent ↗The present disclosure provides a method and apparatus for detecting a starting point and a finishing point of a speech, a computer device and a storage medium, wherein the method comprises: obtaining speech data to be detected; segmenting the speech data into speech segments, the number of speech segments being greater than one; respectively determining speech states of respective speech segments based on a Voice Activity Detection model obtained by pre-training; determining a starting point and a finishing point of the speech data according to the speech states. The solution of the present disclosure can be employed to improve the accuracy of the detection results.
1. A method for detecting a starting point and a finishing point of a speech, wherein the method comprises:
obtaining speech data to be detected;
segmenting the speech data into speech segments, the number of speech segments being greater than one;
respectively determining speech states of respective speech segments based on a Voice Activity Detection model obtained by pre-training;
determining a starting point and a finishing point of the speech data according to the speech states,
wherein training to obtain the Voice Activity Detection model comprises:
obtaining training speech data as training data;
extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data, N being a positive integer greater than one;
training according to the extracted sample segments to obtain the Voice Activity Detection model, and
the speech states comprise:
a mute state, a starting point state, a speech retention state and a finishing point state, and
the extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data comprises:
randomly extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data;
wherein in the sample segment in the starting point state, the starting point of the speech is located in a first half of the sample segment, and a distance from the starting point of the sample segment is greater than a predetermined threshold;
in the sample segment in the finishing point state, the finishing point of the speech is located in a first half of the sample segment, and a distance from the starting point of the sample segment is greater than a second predetermined threshold.
2. The method according to claim 1 , wherein there is overlap between at least two adjacent speech segments.
3. The method according to claim 1 , wherein the Voice Activity Detection model comprises a convolutional neural network model.
4. The method according to claim 1 , wherein the respectively determining speech states of respective speech segments based on a Voice Activity Detection model obtained by pre-training comprises:
using the Voice Activity Detection model to classify the speech segments;
based on an output of the Voice Activity Detection model, using a Viterbi decoding algorithm to determine the speech states of the speech segments.
5. The method according to claim 1 , wherein the extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data comprises:
for each piece of the training speech data, obtaining speech frame and non-speech frame annotation results of the training speech data respectively;
according to the annotation results, extracting sample segments in N different speech states from the training speech data.
6. The method according to claim 1 , wherein the determining a starting point and a finishing point of the speech data according to the speech states comprises:
determining the starting point and the finishing point of the training speech data according to a first speech segment in the starting point state and a first speech segment in the finishing point state in the training speech data.
7. A computer device, comprising a memory, a processor and a computer program which is stored on the memory and runs on the processor, wherein the processor, upon executing the program, implements a method for detecting a starting point and a finishing point of a speech, wherein the method comprises:
obtaining speech data to be detected;
segmenting the speech data into speech segments, the number of speech segments being greater than one;
respectively determining speech states of respective speech segments based on a Voice Activity Detection model obtained by pre-training;
determining a starting point and a finishing point of the speech data according to the speech states,
wherein training to obtain the Voice Activity Detection model comprises:
obtaining training speech data as training data;
extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data, N being a positive integer greater than one;
training according to the extracted sample segments to obtain the Voice Activity Detection model, and
the speech states comprise:
a mute state, a starting point state, a speech retention state and a finishing point state, and
the extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data comprises:
randomly extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data;
wherein in the sample segment in the starting point state, the starting point of the speech is located in a first half of the sample segment, and a distance from the starting point of the sample segment is greater than a predetermined threshold;
in the sample segment in the finishing point state, the finishing point of the speech is located in a first half of the sample segment, and a distance from the starting point of the sample segment is greater than a second predetermined threshold.
8. A non-transitory computer-readable storage medium on which a computer program is stored, wherein the program, when executed by a processor, implements a method for detecting a starting point and a finishing point of a speech, wherein the method comprises:
obtaining speech data to be detected;
segmenting the speech data into speech segments, the number of speech segments being greater than one;
respectively determining speech states of respective speech segments based on a Voice Activity Detection model obtained by pre-training;
determining a starting point and a finishing point of the speech data according to the speech states,
wherein training to obtain the Voice Activity Detection model comprises:
obtaining training speech data as training data;
extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data, N being a positive integer greater than one;
training according to the extracted sample segments to obtain the Voice Activity Detection model, and
the speech states comprise:
a mute state, a starting point state, a speech retention state and a finishing point state, and
the extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data comprises:
randomly extracting sample segments in N different speech states respectively from the obtained each piece of the training speech data;
wherein in the sample segment in the starting point state, the starting point of the speech is located in a first half of the sample segment, and a distance from the starting point of the sample segment is greater than a predetermined threshold;
in the sample segment in the finishing point state, the finishing point of the speech is located in a first half of the sample segment, and a distance from the starting point of the sample segment is greater than a second predetermined threshold.