Data collection method and device, storage medium and electronic equipment

文档序号:1355682 发布日期:2020-07-24 浏览:6次 中文

阅读说明:本技术 数据收集方法、装置、存储介质及电子设备 (Data collection method and device, storage medium and electronic equipment ) 是由 王康 何怡 于 2020-03-27 设计创作,主要内容包括:本公开涉及一种数据收集方法、装置、存储介质及电子设备,以快速获得高质量文本语料。所述方法包括:从目标视频中获取多个目标视频帧图像;对所述多个目标视频帧图像进行OCR识别,以确定各个所述目标视频帧图像包含的第一文本和所述第一文本的文本位置信息,所述第一文本的文本位置信息用于指示所述第一文本在目标视频帧图像中出现的位置;根据各个所述文本位置信息,确定所述目标视频的字幕区域;根据所述字幕区域、所述第一文本和所述第一文本的文本位置信息,确定第二文本,所述第二文本取自文本位置信息所指示的位置处于所述字幕区域内的第一文本;将所述第二文本确定为所述目标视频的文本语料。(The disclosure relates to a data collection method, a data collection device, a storage medium and an electronic device, so as to quickly obtain high-quality text corpora. The method comprises the following steps: acquiring a plurality of target video frame images from a target video; performing OCR recognition on the plurality of target video frame images to determine a first text contained in each target video frame image and text position information of the first text, wherein the text position information of the first text is used for indicating the position of the first text appearing in the target video frame images; determining a subtitle area of the target video according to the text position information; determining a second text according to the subtitle area, the first text and the text position information of the first text, wherein the second text is taken from the first text of which the position indicated by the text position information is in the subtitle area; and determining the second text as the text corpus of the target video.)

1. A method of data collection, the method comprising:

acquiring a plurality of target video frame images from a target video;

performing OCR recognition on the plurality of target video frame images to determine a first text contained in each target video frame image and text position information of the first text, wherein the text position information of the first text is used for indicating the position of the first text appearing in the target video frame images;

determining a subtitle area of the target video according to the text position information;

determining a second text according to the subtitle area, the first text and the text position information of the first text, wherein the second text is taken from the first text of which the position indicated by the text position information is in the subtitle area;

and determining the second text as the text corpus of the target video.

2. The method of claim 1, wherein the obtaining a plurality of target video frame images from a target video comprises:

and performing frame extraction processing on the target video according to a preset time interval to obtain a plurality of target video frame images.

3. The method according to claim 1, wherein the determining the subtitle region of the target video according to the respective text position information comprises:

determining a subtitle position according to the text position information, wherein the subtitle position is the position with the largest occurrence frequency in the positions indicated by the text position information, or the subtitle position is the position with the ratio of the occurrence frequency to all the positions in the positions indicated by the text position information exceeding a preset ratio threshold;

and determining a subtitle area of the target video according to the subtitle position.

4. The method of claim 3, wherein the determining the caption area of the target video according to the caption position comprises:

and determining the area corresponding to the preset range around the subtitle position as the subtitle area.

5. The method of claim 1, wherein determining the second text according to the subtitle region, the first text, and text position information of the first text comprises:

and determining the first text of which the position indicated by the text position information is in the subtitle area as the second text.

6. The method of claim 1, wherein each of the first texts corresponds to a first occurrence in the target video;

determining a second text according to the subtitle region, the first text, and the text position information of the first text, including:

determining a first text of which the position indicated by the text position information is in the subtitle area as a third text;

if a plurality of third texts with adjacent first appearance moments and text similarity larger than a preset similarity threshold exist, determining the third text with the longest text length as the second text;

and if the third text has preset characters, deleting the preset characters in the third text, and determining the text obtained after deleting the preset characters as the second text.

7. The method according to claim 1, wherein the text corpus consists of a plurality of the second texts, and each of the second texts corresponds to a second occurrence time in the target video;

the method further comprises the following steps:

dividing the text corpus to obtain target corpus fragments;

determining an initial starting time and an initial ending time of a target corpus fragment in the target video according to a second occurrence time of a second text contained in the target corpus fragment in the target video;

taking the initial starting time as a time starting point and the initial ending time as a time end point, and acquiring a target audio clip from the target video;

and performing time alignment on the target corpus fragment and the target audio fragment by using a preset time alignment tool to obtain a target starting time and a target ending time of the target corpus fragment in the target video.

8. The method of claim 7, wherein the preset time alignment tool is an alignment tool;

the time alignment of the target corpus fragment and the target audio fragment by using a preset time alignment tool to obtain a target start time and a target end time of the target corpus fragment in the target video includes:

setting the beam parameter of the alignment tool to be a first numerical value, aligning the target corpus segment and the target audio segment for the first time, then setting the beam parameter of the alignment tool to be a second numerical value, and aligning the target corpus segment and the target audio segment for the second time to obtain a target starting time and a target ending time of the target corpus segment in the target video, wherein the first numerical value is smaller than the second numerical value.

9. A data collection device, the device comprising:

the first acquisition module is used for acquiring a plurality of target video frame images from a target video;

the recognition module is used for performing OCR recognition on the target video frame images to determine a first text contained in each target video frame image and text position information of the first text, wherein the text position information of the first text is used for indicating the position of the first text appearing in the target video frame images;

the first determining module is used for determining a subtitle area of the target video according to the text position information;

a second determining module, configured to determine a second text according to the subtitle region, the first text, and text position information of the first text, where the second text is taken from the first text in the subtitle region at a position indicated by the text position information;

and the third determining module is used for determining the second text as the text corpus of the target video.

10. A non-transitory computer readable storage medium, on which a computer program is stored, characterized in that the program, when executed by a processing device, implements the steps of the method of any one of claims 1-8.

11. An electronic device, comprising:

a storage device having a computer program stored thereon;

processing means for executing the computer program in the storage means to carry out the steps of the method according to any one of claims 1 to 8.

Technical Field

The present disclosure relates to the field of computer technologies, and in particular, to a data collection method and apparatus, a storage medium, and an electronic device.

Background

In the field of speech processing, the success or failure of speech recognition techniques relies on the collection of training data, e.g., the training data of a language model is a corpus of text. At present, when text corpora required by a language model are collected, original data are generally obtained from an open source channel, but because the data obtaining process includes indiscriminate obtaining of errors, a large amount of noise data exist in the obtained data, and if the data are directly used as the text corpora for training the language model, the training effect of the language model is poor.

Disclosure of Invention

This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.

In a first aspect, the present disclosure provides a data collection method, the method comprising:

acquiring a plurality of target video frame images from a target video;

performing OCR recognition on the plurality of target video frame images to determine a first text contained in each target video frame image and text position information of the first text, wherein the text position information of the first text is used for indicating the position of the first text appearing in the target video frame images;

determining a subtitle area of the target video according to the text position information;

determining a second text according to the subtitle area, the first text and the text position information of the first text, wherein the second text is taken from the first text of which the position indicated by the text position information is in the subtitle area;

and determining the second text as the text corpus of the target video.

In a second aspect, the present disclosure provides a data collection apparatus, the apparatus comprising:

the first acquisition module is used for acquiring a plurality of target video frame images from a target video;

the recognition module is used for performing OCR recognition on the target video frame images to determine a first text contained in each target video frame image and text position information of the first text, wherein the text position information of the first text is used for indicating the position of the first text appearing in the target video frame images;

the first determining module is used for determining a subtitle area of the target video according to the text position information;

a second determining module, configured to determine a second text according to the subtitle region, the first text, and text position information of the first text, where the second text is taken from the first text in the subtitle region at a position indicated by the text position information;

and the third determining module is used for determining the second text as the text corpus of the target video.

In a third aspect, the present disclosure provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processing device, performs the steps of the method of the first aspect of the present disclosure.

In a fourth aspect, the present disclosure provides an electronic device comprising:

a storage device having a computer program stored thereon;

processing means for executing the computer program in the storage means to implement the steps of the method of the first aspect of the present disclosure.

According to the technical scheme, a plurality of target video frame images are obtained from the target video, OCR recognition is carried out on the plurality of target video frame images to determine the first text contained in each target video frame image and the text position information of the first text, the subtitle area of the target video is determined according to each text position information, the second text is determined according to the subtitle area, the first text and the text position information of the first text, and the second text is determined as the text corpus of the target video. In this way, OCR recognition is carried out on the image in the video, the position where the subtitle most possibly exists, namely the subtitle region, is determined according to the recognition result, and the available text corpora are extracted from the subtitle region, so that the text corpora can be automatically obtained from the video, and the efficiency is high. Moreover, because the text content appearing in the same video has strong correlation, the noise data in the obtained text corpus is less, the text corpus quality is high, and the language model obtained by training by using the text corpus also has high quality.

Additional features and advantages of the disclosure will be set forth in the detailed description which follows.

Drawings

The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.

In the drawings:

FIG. 1 is a flow chart of a data collection method provided according to one embodiment of the present disclosure;

FIG. 2 is a flow chart of a data collection method provided in accordance with another embodiment of the present disclosure;

FIG. 3 is a block diagram of a data collection device provided in accordance with one embodiment of the present disclosure;

fig. 4 is a block diagram of an apparatus provided according to an embodiment.

Detailed Description

Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.

It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.

The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.

It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.

It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.

The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.

In the field of speech processing, the effectiveness of speech recognition techniques relies on the collection of training data. For example, the training data of the language model is a text corpus, and the training data of the speech recognition is audio and characters corresponding to each other.

For the collection of the text corpus required by the language model, in the prior art, when the text corpus required by the language model is collected, the original data is generally obtained from an open source channel, but since the data obtaining process includes the non-differential obtaining of the error, a large amount of noise data exists in the obtained data, and if the data is directly used as the text corpus for training the language model, the training of the obtained language model is poor.

Aiming at the collection of training data required by voice recognition, in the prior art, manual marking is generally required to be carried out based on collected audio and characters, and then the audio and the characters are mutually corresponding and used as training data used by voice recognition, but the mode of manual marking consumes resources and is not high in efficiency.

In order to solve the above problems in the prior art, the present disclosure provides a data collection method, an apparatus, a storage medium, and an electronic device, so as to obtain high-quality training data quickly.

Fig. 1 is a flow chart of a data collection method provided according to one embodiment of the present disclosure. As shown in fig. 1, the method may include the following steps.

In step 11, a plurality of target video frame images are acquired from a target video.

The method provided by the disclosure can extract the text corpus from the target video, wherein the target video can be any video, and when the text corpus needs to be extracted from the video, the video can be taken as the target video, and a series of steps of the data collection method provided by the disclosure are executed.

A plurality of target video frame images can be acquired from the target video, wherein each target video frame image is one frame image in the target video.

In step 12, OCR recognition is performed on the plurality of target video frame images to determine a first text and text position information of the first text included in each target video frame image.

OCR (Optical Character Recognition) is capable of recognizing characters in an image as editable text, and thus, a Character portion thereof can be extracted from the image by the OCR Recognition.

Based on the plurality of target video frame images obtained in step 11, OCR recognition is performed on each of the target video frame images, so that the position of the text included in each of the target video frame images and the position of the text appearing in the target video frame image can be obtained, and thus, the text position information of the first text and the first text included in each of the target video frame images can be obtained. The first text may be composed of one or more words, text position information of the first text is used to indicate a position where the first text appears in the target video frame image, and the position where the first text appears in the target video frame image may be embodied by coordinates of a pixel point corresponding to the first text in the target video frame image (for example, a set of coordinates of all pixel points corresponding to the first text in the target video frame image, or a set of coordinates of a pixel point located at an edge corresponding to the first text in the target video frame image, and so on).

And, there may be multiple positions in the same target video frame image where there exists text, and the text positions may be, for example, the bottom of the picture, the top of the picture, the middle of the picture, the upper left corner of the picture, the upper right corner of the picture, the lower left corner of the picture, etc. Such a target video frame image may be subjected to OCR recognition to obtain a plurality of first texts at different positions, each of the first texts corresponding to a different position of the target video frame image. For example, if the target video frame image a is subjected to OCR recognition to obtain a text B1 at the top of the screen and a text B2 at the bottom of the screen, the target video frame image includes two first texts, namely a text B1 and a text B2, and the text position information of the first text B1 is the top of the screen and the text position information of the second text B2 is the bottom of the screen.

In step 13, a subtitle region of the target video is determined based on the respective text position information.

And determining the subtitle area of the target video according to the position indicated by each text position information. Illustratively, the subtitle region may be a bar region at the bottom of the target video frame image.

In step 14, the second text is determined according to the subtitle region, the first text, and the text position information of the first text.

Wherein the second text is taken from the first text whose position indicated by the text position information is within the subtitle region. That is, the text appearing in the caption area is extracted from the target video and used as the text corpus.

In step 15, the second text is determined as the text corpus of the target video.

According to the technical scheme, a plurality of target video frame images are obtained from the target video, OCR recognition is carried out on the plurality of target video frame images to determine the first text contained in each target video frame image and the text position information of the first text, the subtitle area of the target video is determined according to each text position information, the second text is determined according to the subtitle area, the first text and the text position information of the first text, and the second text is determined as the text corpus of the target video. In this way, OCR recognition is carried out on the image in the video, the position where the subtitle most possibly exists, namely the subtitle region, is determined according to the recognition result, and the available text corpora are extracted from the subtitle region, so that the text corpora can be automatically obtained from the video, and the efficiency is high. Moreover, because the text content appearing in the same video has strong correlation, the noise data in the obtained text corpus is less, the text corpus quality is high, and the language model obtained by training by using the text corpus also has high quality.

In order to make those skilled in the art understand the technical solutions provided by the embodiments of the present invention, the following detailed descriptions are provided for the corresponding steps in the above.

First, the step 11 will be described in detail, in which a plurality of target video frame images are acquired from a target video.

In one possible implementation, all video frame images in the target video may be used as the target video frame images, that is, data collection may be performed based on all video frame images of the target video frame. Therefore, the text corpora in the target video can be comprehensively collected.

In another possible embodiment, step 11 may include the steps of:

and performing frame extraction processing on the target video according to a preset time interval to obtain a plurality of target video frame images.

For example, the preset time interval may be 0.5s, that is, one video frame image is extracted from the target video as the target video frame image every 0.5 s.

By adopting the mode, the frame extraction processing is carried out on the target video according to the preset time interval so as to obtain a plurality of target video frame images, excessive data in the target video can not be omitted, and the calculation pressure in the subsequent data collection process can be reduced.

In step 13, the subtitle area of the target video is determined based on the text position information.

In one possible embodiment, step 13 may include the steps of:

determining the position of the subtitle according to the position information of each text;

and determining a subtitle area of the target video according to the subtitle position.

The subtitle position is a position with the largest occurrence frequency in the positions indicated by the text position information, or the subtitle position is a position with the ratio of the occurrence frequency to all the positions exceeding a preset ratio threshold in the positions indicated by the text position information. Illustratively, the preset proportion threshold may be 0.6.

If the target video has content that can be converted into text, for example, the speaking content of a character in the video, the content will usually be displayed in the target video in the form of subtitles, and generally, the position of the subtitles in the same video is relatively fixed, that is, a certain position of the text frequently appears in the video (for example, the bottom of a video frame). And the text position information of each first text indicates the positions of the first texts appearing in the target video frame image, so that the position with the largest number of occurrences among the positions indicated by the text position information of each first text can be determined as the subtitle position, or the position with the ratio of the number of occurrences to all the positions exceeding a preset ratio threshold among the positions indicated by the text position information of each first text can be determined as the subtitle position.

After the subtitle position is determined, the subtitle area of the target video can be determined according to the subtitle position.

In one possible embodiment, the region corresponding to the subtitle position may be directly determined as the subtitle region of the target video.

In another possible embodiment, determining the subtitle region of the target video according to the subtitle position may include the following steps:

and determining the area corresponding to the preset range around the subtitle position as the subtitle area.

That is, after the caption position is determined, the range can be expanded appropriately according to the caption position, and the expanded region is used as the caption region to more fully cover the position where the text may appear in the image. For example, after the text height is expanded by a certain multiple (for example, 1.5 times the text height) both upward and downward based on the subtitle position, the region corresponding to the expanded position range is determined as the subtitle region.

Next, in step 14, the second text is determined according to the subtitle region, the first text, and the text position information of the first text, and the detailed description is given below.

In one possible embodiment, step 14 may include the steps of:

and determining the first text of which the position indicated by the text position information is in the subtitle area as the second text.

Therefore, all texts in the subtitle area can be determined as the second text, and the text corpus obtained based on the second text has richer content.

In another possible embodiment, step 14 may include the steps of:

determining a first text of which the position indicated by the text position information is in the subtitle area as a third text;

if a plurality of third texts adjacent to each other at the first appearance moment exist, and the text similarity is greater than a preset similarity threshold, determining the third text with the longest text length as a second text;

and if the preset characters exist in the third text, deleting the preset characters in the third text, and determining the text obtained after deleting the preset characters as the second text.

Wherein each first text corresponds to a first time of occurrence in the target video. When the target video frame images are acquired from the target video, each target video frame image corresponds to the time when the target video frame image appears in the target video, so that the first text obtained based on the target video frame images has the same first appearance time as the time when the target video frame images appear in the target video. For example, if the time when the target video frame image C appears in the target video is 0.5s, the first appearance time of the first text D in the target video, which is obtained based on the target video frame image C, is also 0.5 s.

The first text whose position indicated by the text position information is within the subtitle region is determined as the third text, that is, the first text whose position indicated by the text position information is within the subtitle region is first screened out as the third text, and further screening is performed based on these third texts.

If a plurality of third texts exist, the first appearance moments of which are adjacent and the text similarity is greater than the preset similarity threshold, it is described that the contents of the third texts are similar and come from adjacent target video frames, that is, the third texts have parts with the same contents, so that duplication removal can be performed to a certain extent, and therefore, the third text with the longest text length can be determined as the second text, and the third text with the longest text length can be reserved, so that rich text information can be reserved to the maximum extent.

The preset character is a character with low availability in the current data collection process, for example, when data collection is performed for a common language, a character in an unusual language may be determined as the preset character. For example, if data collection is performed for chinese and english, characters other than chinese, english, and arabic numerals may be set as the preset characters. If the preset characters exist in the third text, it is indicated that characters with low availability for data collection exist in the third text, so that the preset characters in the third text can be deleted, and the text obtained after the preset characters are deleted is determined as the second text.

By adopting the method, after the position screening based on the subtitle area is carried out, the duplication removing or character deleting processing is further carried out according to the position screening result, so that the second text with better quality can be obtained, and the text corpus obtained based on the second text can have higher quality.

Fig. 2 is a flow chart of a data collection method provided in accordance with another embodiment of the present disclosure. As shown in fig. 2, on the basis of the steps shown in fig. 1, the method of the present disclosure may further include the following steps, where the description related to steps 11 to 15 is given above and is not repeated here.

In step 21, the text corpus is divided to obtain target corpus segments.

As can be seen from the foregoing, the text corpus is composed of a plurality of second texts. And, each second text corresponds to a second time of occurrence in the target video. When the target video frame images are acquired from the target video, each target video frame image corresponds to the time when the target video appears, so that the first text obtained based on the target video frame images has a first appearance time which is the same as the time when the target video frame images appear in the target video, and correspondingly, the second text obtained based on the first text has a second appearance time which is the same as the first appearance time when the first text appears in the target video. For example, if the time when the target video frame image C appears in the target video is 0.5s, the first appearance time of the first text D in the target video obtained based on the target video frame image C is also 0.5s, and the second appearance time of the second text E extracted from the first text D in the target video is also 0.5 s.

In one possible embodiment, N adjacent second texts in the text corpus may be used as a group to obtain a combination of multiple groups of second texts. And each group of second texts can be used as a target corpus fragment, and the subsequent steps provided by the disclosure are executed. Wherein N is a positive integer greater than or equal to 1. Illustratively, N may be 2. Thus, the amount of calculation in the data processing process can be reduced.

In step 22, according to a second occurrence time of a second text included in the target corpus fragment in the target video, an initial start time and an initial end time of the target corpus fragment in the target video are determined.

In a possible implementation manner, if the target corpus fragment only includes one second text, based on a second occurrence time of the second text in the target video, a time corresponding to a first preset time before the second occurrence time is taken as an initial starting time, and a time corresponding to a second preset time after the second occurrence time is taken as an initial ending time. The first preset time period may be a time period greater than or equal to 0, and the second preset time period may be a time period greater than or equal to 0. Generally, the first preset time period and the second preset time period are not 0 at the same time. For example, the first preset time period may be 0.5 s. For another example, the second preset time period may be 0.5 s.

In a possible embodiment, if the target corpus fragment contains a plurality of second texts, a second occurrence time of the second text appearing earliest in the target video may be used as an initial starting time, and a second occurrence time of the second text appearing latest in the target video may be used as an initial ending time.

In step 23, the target audio segment is obtained from the target video with the initial start time as a time start point and the initial end time as a time end point.

In step 24, a preset time alignment tool is used to perform time alignment on the target corpus fragment and the target audio fragment, so as to obtain a target start time and a target end time of the target corpus fragment in the target video.

Illustratively, the preset time alignment tool is an alignment tool. Accordingly, step 24 may include the steps of:

setting the beam parameter of the alignment tool as a first numerical value, aligning the target corpus segment and the target audio segment for the first time, setting the beam parameter of the alignment tool as a second numerical value, and aligning the target corpus segment and the target audio segment for the second time to obtain the target starting time and the target ending time of the target corpus segment in the target video.

Wherein the first value is less than the second value. Illustratively, the first value may be 3. As another example, the second value may be 30.

In the alignment process, the beam parameter is set to be a smaller first numerical value in the first alignment, so that the accuracy of one-to-one correspondence between the characters and the audios in the target corpus fragment and the target audio fragment, namely the correspondence between the single character and the audio, can be ensured. The second alignment sets the beam parameter to a second larger value, so that the accuracy of the alignment of the head and the tail of the target corpus fragment and the target audio fragment, namely the accuracy of the time point when the target expected fragment appears and disappears in the target audio fragment, can be ensured.

By adopting the mode, after the text corpus of the target video is obtained, the content in the text corpus can be automatically aligned with the corresponding audio in the target video, and the complicated step of manual labeling is omitted, so that the audio and the characters which correspond to each other can be more efficiently obtained, and the method can be quickly used for voice recognition.

Fig. 3 is a block diagram of a data collection device provided according to an embodiment of the present disclosure, and as shown in fig. 3, the device 30 may include:

a first obtaining module 31, configured to obtain a plurality of target video frame images from a target video;

the recognition module 32 is configured to perform OCR recognition on the multiple target video frame images to determine a first text and text position information of the first text, where the first text and the text position information of the first text are included in each target video frame image, and the text position information of the first text is used to indicate a position where the first text appears in the target video frame image;

a first determining module 33, configured to determine a subtitle region of the target video according to each piece of text position information;

a second determining module 34, configured to determine, according to the subtitle region, the first text, and text position information of the first text, a second text that is taken from the first text whose position indicated by the text position information is within the subtitle region;

a third determining module 35, configured to determine the second text as a text corpus of the target video.

Optionally, the first obtaining module 31 is configured to perform frame extraction processing on the target video according to a preset time interval to obtain the multiple target video frame images.

Optionally, the first determining module 33 includes:

the first determining submodule is used for determining a subtitle position according to the text position information, wherein the subtitle position is the position with the largest occurrence frequency in the positions indicated by the text position information, or the subtitle position is the position with the ratio of the occurrence frequency to all the positions in the positions indicated by the text position information exceeding a preset ratio threshold;

and the second determining submodule is used for determining a subtitle area of the target video according to the subtitle position.

Optionally, the second determining submodule is configured to determine an area corresponding to a preset range around the subtitle position as the subtitle area.

Optionally, the second determining module 34 includes:

and the third determining sub-module is used for determining the first text of which the position indicated by the text position information is in the subtitle area as the second text.

Optionally, each of the first texts corresponds to a first occurrence time in the target video;

the second determination module 34 includes:

a fourth determining sub-module, configured to determine, as a third text, the first text whose position is indicated by the text position information is within the subtitle region;

a fifth determining submodule, configured to determine, if multiple third texts exist, where the first occurrence time is adjacent to each other and the text similarity is greater than a preset similarity threshold, a third text with a longest text length as the second text;

and the sixth determining submodule is used for deleting the preset characters in the third text if the preset characters exist in the third text, and determining the text obtained after deleting the preset characters as the second text.

Optionally, the text corpus is composed of a plurality of second texts, and each second text corresponds to a second occurrence time in the target video;

the device 30 further comprises:

the dividing module is used for dividing the text corpus to obtain target corpus fragments;

a fourth determining module, configured to determine, according to a second occurrence time of a second text included in a target corpus fragment in the target video, an initial starting time and an initial ending time of the target corpus fragment in the target video, which correspond to each other;

a second obtaining module, configured to obtain a target audio segment from the target video by using the initial starting time as a time starting point and the initial ending time as a time ending point;

and the alignment module is used for performing time alignment on the target corpus fragment and the target audio fragment by using a preset time alignment tool so as to obtain a target starting time and a target ending time of the target corpus fragment in the target video.

Optionally, the preset time alignment tool is an alignment tool;

the alignment module is configured to set a beam parameter of the alignment tool to a first numerical value, perform first alignment on the target corpus segment and the target audio segment, then set the beam parameter of the alignment tool to a second numerical value, and perform second alignment on the target corpus segment and the target audio segment, so as to obtain a target start time and a target end time of the target corpus segment in the target video, where the first numerical value is smaller than the second numerical value.

With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

Referring now to FIG. 4, a block diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 4 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.

As shown in fig. 4, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.

In general, input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc., output devices 607 including, for example, a liquid crystal display (L CD), speaker, vibrator, etc., storage devices 608 including, for example, magnetic tape, hard disk, etc., and communication devices 609.

In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of the embodiments of the present disclosure.

It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.

In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). examples of communications networks include local area networks ("L AN"), wide area networks ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.

The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.

The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a plurality of target video frame images from a target video; performing OCR recognition on the plurality of target video frame images to determine a first text contained in each target video frame image and text position information of the first text, wherein the text position information of the first text is used for indicating the position of the first text appearing in the target video frame images; determining a subtitle area of the target video according to the text position information; determining a second text according to the subtitle area, the first text and the text position information of the first text, wherein the second text is taken from the first text of which the position indicated by the text position information is in the subtitle area; and determining the second text as the text corpus of the target video.

Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including but not limited to AN object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages.

The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

The modules described in the embodiments of the present disclosure may be implemented by software or hardware. The name of the module does not in some cases constitute a limitation of the module itself, and for example, the first acquiring module may also be described as a "module that acquires a plurality of target video frame images from a target video".

For example, without limitation, exemplary types of hardware logic that may be used include Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CP L D), and so forth.

In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

According to one or more embodiments of the present disclosure, there is provided a data collection method including:

acquiring a plurality of target video frame images from a target video;

performing OCR recognition on the plurality of target video frame images to determine a first text contained in each target video frame image and text position information of the first text, wherein the text position information of the first text is used for indicating the position of the first text appearing in the target video frame images;

determining a subtitle area of the target video according to the text position information;

determining a second text according to the subtitle area, the first text and the text position information of the first text, wherein the second text is taken from the first text of which the position indicated by the text position information is in the subtitle area;

and determining the second text as the text corpus of the target video.

According to one or more embodiments of the present disclosure, there is provided a data collection method, wherein the acquiring a plurality of target video frame images from a target video includes:

and performing frame extraction processing on the target video according to a preset time interval to obtain a plurality of target video frame images.

According to one or more embodiments of the present disclosure, there is provided a data collection method, wherein the determining a subtitle region of the target video according to the respective text position information includes:

determining a subtitle position according to the text position information, wherein the subtitle position is the position with the largest occurrence frequency in the positions indicated by the text position information, or the subtitle position is the position with the ratio of the occurrence frequency to all the positions in the positions indicated by the text position information exceeding a preset ratio threshold;

and determining a subtitle area of the target video according to the subtitle position.

According to one or more embodiments of the present disclosure, there is provided a data collection method, wherein the determining a caption area of the target video according to the caption position includes:

and determining the area corresponding to the preset range around the subtitle position as the subtitle area.

According to one or more embodiments of the present disclosure, there is provided a data collection method, wherein the determining a second text according to the subtitle region, the first text, and text position information of the first text, includes:

and determining the first text of which the position indicated by the text position information is in the subtitle area as the second text.

According to one or more embodiments of the present disclosure, a data collection method is provided, wherein each of the first texts corresponds to a first occurrence time in the target video;

determining a second text according to the subtitle region, the first text, and the text position information of the first text, including:

determining a first text of which the position indicated by the text position information is in the subtitle area as a third text;

if a plurality of third texts with adjacent first appearance moments and text similarity larger than a preset similarity threshold exist, determining the third text with the longest text length as the second text;

and if the third text has preset characters, deleting the preset characters in the third text, and determining the text obtained after deleting the preset characters as the second text.

According to one or more embodiments of the present disclosure, a data collection method is provided, in which the text corpus is composed of a plurality of the second texts, and each of the second texts corresponds to a second occurrence time in the target video;

the method further comprises the following steps:

dividing the text corpus to obtain target corpus fragments;

determining an initial starting time and an initial ending time of a target corpus fragment in the target video according to a second occurrence time of a second text contained in the target corpus fragment in the target video;

taking the initial starting time as a time starting point and the initial ending time as a time end point, and acquiring a target audio clip from the target video;

and performing time alignment on the target corpus fragment and the target audio fragment by using a preset time alignment tool to obtain a target starting time and a target ending time of the target corpus fragment in the target video.

According to one or more embodiments of the present disclosure, there is provided a data collection method, wherein the preset time alignment tool is an alignment tool;

the time alignment of the target corpus fragment and the target audio fragment by using a preset time alignment tool to obtain a target start time and a target end time of the target corpus fragment in the target video includes:

setting the beam parameter of the alignment tool to be a first numerical value, aligning the target corpus segment and the target audio segment for the first time, then setting the beam parameter of the alignment tool to be a second numerical value, and aligning the target corpus segment and the target audio segment for the second time to obtain a target starting time and a target ending time of the target corpus segment in the target video, wherein the first numerical value is smaller than the second numerical value.

According to one or more embodiments of the present disclosure, there is provided a data collection apparatus including:

the first acquisition module is used for acquiring a plurality of target video frame images from a target video;

the recognition module is used for performing OCR recognition on the target video frame images to determine a first text contained in each target video frame image and text position information of the first text, wherein the text position information of the first text is used for indicating the position of the first text appearing in the target video frame images;

the first determining module is used for determining a subtitle area of the target video according to the text position information;

a second determining module, configured to determine a second text according to the subtitle region, the first text, and text position information of the first text, where the second text is taken from the first text in the subtitle region at a position indicated by the text position information;

and the third determining module is used for determining the second text as the text corpus of the target video.

According to one or more embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon a computer program that, when executed by a processing device, performs the steps of the method of any embodiment of the present disclosure.

According to one or more embodiments of the present disclosure, there is provided an electronic device including:

a storage device having a computer program stored thereon;

processing means for executing the computer program in the storage means to implement the steps of the method of any embodiment of the present disclosure.

The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.

Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims. With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

20页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:企业名称识别方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!