Disclosure of Invention
An object of the embodiments of the present application is to provide a data identification method, apparatus, electronic device and computer-readable storage medium, which can improve the accuracy of identification. The specific technical scheme is as follows:
in a first aspect, in order to achieve the above object, an embodiment of the present application discloses a data identification method, where the method includes:
acquiring voice data to be recognized of a current recognition scene;
inputting the voice data to be recognized into a pre-constructed target recognition model to obtain a recognition result of the voice data to be recognized; the recognition result comprises text information contained in the voice data to be recognized;
wherein the model parameters of the target identification model are as follows: the method comprises the steps of determining on the basis of candidate model parameters of a plurality of candidate recognition models trained in advance; the model structures of the plurality of candidate recognition models and the target recognition model are the same; the multiple candidate recognition models are obtained by training in a meta-learning mode based on sample data of candidate recognition scenes except the current recognition scene, and training sets adopted by the multiple candidate recognition models are different.
Optionally, the process of constructing the target recognition model includes:
based on the preset weight, calculating the weighted sum of the candidate model parameters of each candidate recognition model as a target model parameter;
and determining a target recognition model based on the target model parameters.
Optionally, the determining a target recognition model based on the target model parameters includes:
and determining the model with the target model parameters as a target recognition model.
Optionally, the determining a target recognition model based on the target model parameters includes:
determining a model with the target model parameters as a recognition model to be corrected;
and training the recognition model to be corrected based on the sample voice data of the current recognition scene to obtain a target recognition model.
Optionally, the process of obtaining candidate model parameters of the multiple candidate recognition models includes:
acquiring sample data corresponding to each alternative identification scene;
dividing sample data corresponding to the candidate identification scene into a plurality of sample data groups according to the number of a plurality of preset identification tasks corresponding to the candidate identification scene, and respectively taking the sample data groups as the sample data groups corresponding to the plurality of preset identification tasks;
aiming at each preset recognition task, training an initial recognition model of a preset model structure based on a corresponding sample data set;
when the number of rounds of training reaches a preset number, acquiring model parameters of the initial recognition model after training as model parameters to be processed;
adjusting the original model parameters of the initial recognition model based on the model parameter difference values corresponding to the preset recognition tasks to obtain alternative model parameters of the alternative recognition model corresponding to the alternative recognition scene; wherein, the model parameter difference value corresponding to one preset identification task represents: and the difference value between the model parameter to be processed corresponding to the preset identification task and the original model parameter.
In a second aspect, in order to achieve the above object, an embodiment of the present application discloses a data identification apparatus, including:
the voice data to be recognized acquiring module is used for acquiring the voice data to be recognized of the current recognition scene;
the recognition module is used for inputting the voice data to be recognized into a pre-constructed target recognition model to obtain a recognition result of the voice data to be recognized; the recognition result comprises text information contained in the voice data to be recognized;
wherein the model parameters of the target identification model are as follows: the method comprises the steps of determining on the basis of candidate model parameters of a plurality of candidate recognition models trained in advance; the model structures of the plurality of candidate recognition models and the target recognition model are the same; the multiple candidate recognition models are obtained by training in a meta-learning mode based on sample data of candidate recognition scenes except the current recognition scene, and training sets adopted by the multiple candidate recognition models are different.
Optionally, the apparatus further comprises:
the target model parameter acquisition module is used for calculating the weighted sum of the alternative model parameters of each alternative recognition model as a target model parameter based on preset weight;
and the target recognition model acquisition module is used for determining a target recognition model based on the target model parameters.
Optionally, the target recognition model obtaining module is specifically configured to determine a model with the target model parameters as a target recognition model.
Optionally, the target recognition model obtaining module includes:
the identification model to be corrected acquisition module is used for determining a model with the target model parameters as the identification model to be corrected;
and the target recognition model obtaining submodule is used for training the recognition model to be corrected based on the sample voice data of the current recognition scene to obtain the target recognition model.
Optionally, the apparatus further comprises:
the sample data acquisition module is used for acquiring sample data corresponding to each alternative identification scene;
a sample data group acquisition module, configured to divide sample data corresponding to the candidate identification scene into a plurality of sample data groups according to the number of the plurality of preset identification tasks corresponding to the candidate identification scene, where the sample data groups are respectively used as sample data groups corresponding to the plurality of preset identification tasks;
the training module is used for training an initial recognition model of a preset model structure based on the corresponding sample data group aiming at each preset recognition task;
the model parameter acquisition module to be processed is used for acquiring the model parameters of the initial recognition model after training as the model parameters to be processed when the number of rounds of training reaches the preset number;
the candidate model parameter acquisition module is used for adjusting the original model parameters of the initial recognition model based on the model parameter difference values corresponding to the preset recognition tasks to obtain the candidate model parameters of the candidate recognition model corresponding to the candidate recognition scene; wherein, the model parameter difference value corresponding to one preset identification task represents: and the difference value between the model parameter to be processed corresponding to the preset identification task and the original model parameter.
On the other hand, in order to achieve the above object, an embodiment of the present application further discloses an electronic device, which includes a memory and a processor;
the memory is used for storing a computer program;
the processor is configured to implement the data identification method according to the first aspect when executing the program stored in the memory.
On the other hand, in order to achieve the above object, an embodiment of the present application further discloses a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the data identification method according to the first aspect.
On the other hand, in order to achieve the above object, an embodiment of the present application further discloses a computer program product containing instructions, which when run on a computer, causes the computer to execute the data identification method according to the first aspect.
The embodiment of the application provides a data identification method, which comprises the steps of obtaining voice data to be identified of a current identification scene; inputting the voice data to be recognized into a pre-constructed target recognition model to obtain a recognition result of the voice data to be recognized; the recognition result comprises text information contained in the voice data to be recognized; the model parameters of the target recognition model are as follows: the method comprises the steps of determining on the basis of candidate model parameters of a plurality of candidate recognition models trained in advance; the model structures of the multiple candidate recognition models and the target recognition model are the same; the multiple candidate recognition models are obtained by training in a meta-learning mode based on sample data of the candidate recognition scenes except the current recognition scene, and training sets adopted by the multiple candidate recognition models are different.
Based on the meta-learning mode, the candidate recognition model obtained by training the sample data of the candidate recognition scene can be suitable for other recognition scenes. Furthermore, the target recognition model determined by combining the candidate model parameters of the multiple candidate recognition models can effectively recognize the voice data to be recognized of the current recognition scene without training based on the sample voice data of the current recognition scene, so that even if the sample voice data of the current recognition scene is less, the target recognition model with higher precision can be obtained, and the recognition accuracy is improved.
Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the related art, in order to improve the accuracy of recognition, a large amount of sample data needs to be acquired, that is, if the sample data of the current recognition scene is less, a recognition model with higher accuracy cannot be obtained, so that the accuracy of recognition is lower.
In order to solve the above problem, an embodiment of the present application provides a data identification method, and referring to fig. 1, fig. 1 is a flowchart of the data identification method provided by the embodiment of the present application, and the method may include the following steps:
s101: and acquiring the voice data to be recognized of the current recognition scene.
S102: and inputting the voice data to be recognized into a pre-constructed target recognition model to obtain a recognition result of the voice data to be recognized.
The recognition result comprises text information contained in the voice data to be recognized; the model parameters of the target recognition model are: determined based on the candidate model parameters of each of the plurality of candidate recognition models trained in advance. The plurality of candidate recognition models are identical in model structure to the target recognition model. The multiple candidate recognition models are obtained by training in a meta-learning mode based on sample data of the candidate recognition scenes except the current recognition scene, and training sets adopted by the multiple candidate recognition models are different.
The data identification method provided by the embodiment of the application is based on a meta-learning mode, so that the alternative identification model obtained by training sample data of the alternative identification scene can be suitable for other identification scenes. Furthermore, the target recognition model determined by combining the candidate model parameters of the multiple candidate recognition models can effectively recognize the voice data to be recognized of the current recognition scene without training based on the sample voice data of the current recognition scene, so that even if the sample voice data of the current recognition scene is less, the target recognition model with higher precision can be obtained, and the recognition accuracy is improved.
For step S101, the current recognition scene may be a scene that recognizes voice data, for example, the current recognition scene may be a scene that recognizes the fortress language. Alternatively, the current recognition scene may be data for recognizing the Tibetan language. The alternative recognition scenario is different from the current recognition scenario, that is, the sample data corresponding to the alternative recognition scenario is different from the sample data corresponding to the current recognition scenario. The candidate recognition scene may be a scene for recognizing voice data or a scene for recognizing image data, but is not limited thereto.
In one embodiment, referring to FIG. 2, the process of constructing the target recognition model may include the steps of:
s201: and calculating the weighted sum of the candidate model parameters of each candidate recognition model as the target model parameter based on the preset weight.
S202: based on the target model parameters, a target recognition model is determined.
Wherein the preset weight can be set by a technician according to experience.
In the embodiment of the present application, after candidate recognition models are obtained by training based on corresponding sample data in advance, model parameters (i.e., candidate model parameters) of each candidate recognition model may be obtained.
Furthermore, the weighted sum of the candidate model parameters of each candidate recognition model can be calculated according to the preset weight to obtain the target model parameter, and the target recognition model is determined based on the target model parameter.
It is understood that the model structures of the candidate recognition models are the same, and the candidate model parameters of each candidate recognition model can be multiple. Therefore, when calculating the weighted sum of the candidate model parameters of each candidate recognition model, for each model parameter in the candidate model parameters, the weighted sum of the numerical values of the model parameter in each candidate recognition model can be calculated, and further, the target model parameter can be obtained.
In one embodiment, referring to fig. 3, the step S202 may include the following steps:
s2021: a model having target model parameters is determined as a target recognition model.
In the embodiment of the present application, after the target model parameters are determined, the model with the target model parameters may be directly determined as the target recognition model, that is, the model parameters of the target recognition model are the target model parameters.
In one embodiment, in order to further improve the accuracy of the target recognition model, referring to fig. 4, the step S202 may include the following steps:
s2022: and determining the model with the target model parameters as the identification model to be corrected.
S2023: and training the recognition model to be corrected based on the sample voice data of the current recognition scene to obtain the target recognition model.
In the embodiment of the present application, after the target model parameters are determined, a model with the target model parameters may be determined as the recognition model to be corrected, that is, the model parameters of the recognition model to be corrected are the target model parameters.
Then, sample voice data of the current recognition scene can be obtained, and the recognition model to be corrected is trained according to the obtained sample voice data until convergence, so that the target recognition model is obtained.
Based on the processing, the target recognition model can be converged only by sample voice data with few current recognition scenes, so that the target recognition model with high recognition precision is obtained, and the recognition accuracy can be improved.
In one embodiment, referring to fig. 5, the process of obtaining the alternative model parameters may include the steps of:
s501: and acquiring sample data corresponding to each candidate identification scene.
S502: and dividing the sample data corresponding to the candidate identification scene into a plurality of sample data groups according to the number of a plurality of preset identification tasks corresponding to the candidate identification scene, and respectively using the sample data groups as the sample data groups corresponding to the plurality of preset identification tasks.
S503: and aiming at each preset recognition task, training an initial recognition model of a preset model structure based on the corresponding sample data set.
S504: and when the number of the training rounds reaches a preset number, obtaining the model parameters of the initial recognition model after training as the parameters of the model to be processed.
S505: and adjusting the original model parameters of the initial recognition model based on the model parameter difference values corresponding to the preset recognition tasks to obtain the alternative model parameters of the alternative recognition model corresponding to the alternative recognition scene.
Wherein, the model parameter difference value corresponding to one preset identification task represents: and the difference value between the model parameter to be processed corresponding to the preset identification task and the original model parameter.
In the embodiment of the present application, for each candidate recognition scenario, sample data corresponding to the candidate recognition scenario may be acquired. Then, according to the number of the plurality of preset identification tasks corresponding to the candidate identification scene, sample data can be divided to obtain a plurality of sample data groups.
Each sample data set corresponds to a preset identification task, and further, for each preset identification task, the initial identification model of the preset model structure can be trained respectively based on the corresponding sample data set, so that corresponding model parameters to be processed are obtained.
For example, for a speech recognition scene, the preset recognition task may be a speech keyword recognition task, a continuous speech recognition task, an isolated word recognition task, or the like; for the scene of image recognition, the preset recognition task can be a target detection task, a gesture recognition task and the like.
After the initial recognition model is trained based on each sample data set, original model parameters of the initial recognition model can be adjusted by combining to-be-processed model parameters corresponding to each preset recognition task to obtain alternative model parameters, so that the recognition model with the alternative model parameters can effectively recognize voice data corresponding to the alternative recognition scene, and further, the recognition accuracy of the target recognition model can be improved.
In an implementation manner, the candidate model parameters of the candidate recognition model corresponding to the candidate recognition scene may be calculated based on a preset formula.
Wherein, the preset formula is as follows:
theta' represents the candidate model parameters of the candidate recognition model corresponding to the candidate recognition scene, theta represents the original model parameters of the initial recognition model, alpha represents the learning rate, m represents the number of a plurality of preset recognition tasks,
and representing model parameters obtained by training K rounds of the initial recognition model based on the corresponding sample data set aiming at the ith preset recognition task.
In one embodiment, the initial recognition model of the preset model structure may include: input layer, convolutional layer 1, convolutional layer 2, convolutional layer 3, convolutional layer 4, full-link layer 1, and full-link layer 2.
Each convolution layer may include 64 convolution kernels of 3 × 3, and the step size of convolution processing performed by the convolution kernels is 2. After BN (Batch Normalization) processing is performed on convolution results of the convolutional layers, activation is performed using the Relu function. The full connection layer 1 and the full connection layer 2 are both composed of a neuron, and the activation function is sigmoid.
The alternative recognition scenarios include: the method comprises the steps of carrying out voice recognition on the basis of an isolated word data set of the Va language, carrying out voice recognition on the basis of an isolated word data set of the time, and carrying out voice recognition on the basis of a daily voice data set recorded by a user.
The number of preset recognition tasks based on the Va language isolated word data set is 5, the number of preset recognition tasks based on the time isolated word data set is 5, and the number of preset recognition tasks based on the daily voice data set recorded by a user is 5.
Then, the data set of isolated words in Va nationality language can be divided into 5 sample data groups, an initial recognition model of a preset model structure is trained on the basis of the corresponding sample data group for each preset recognition task, and further, parameters of alternative models corresponding to scenes for voice recognition based on the data set of isolated words in Va nationality language can be calculated on the basis of the preset formula
Specifically, the number of iterations in training may be 500,the optimizer for adjusting the model parameters during training may use SGD (Stochastic Gradient) and in the above preset formula, m is 5, K is 20, and α is 0.95.
Similarly, the time isolated word data set can be divided into 5 sample data groups, an initial recognition model of a preset model structure is trained on the basis of the corresponding sample data group for each preset recognition task, and then, the candidate model parameter corresponding to the scene for performing voice recognition on the time isolated word data set can be calculated on the basis of the preset formula
Specifically, the number of iterations in the training may be 1500, the optimizer that adjusts the model parameters in the training may use SGD, and in the preset formula, m is 5, K is 15, and α is 0.95.
Similarly, the daily voice data set recorded by the user can be divided into 5 sample data groups, the initial recognition model of the preset model structure is trained based on the corresponding sample data group for each preset recognition task, and then, the alternative model parameter corresponding to the scene of voice recognition based on the daily voice data set recorded by the user can be calculated based on the preset formula
Specifically, the number of iterations in the training may be 2000, the optimizer for adjusting the model parameters in the training may adopt SGD, and in the preset formula, m is 5, K is 25, and α is 1.
Then, target model parameters may be calculated based on equation (1).
Wherein A, B, C respectively represent the respective weights, theta*Representing the target model parameters. For example, a may be 0.3, B may be 0.3, and C may be 0.4.
With target model parameters theta*The target recognition model of (2) can be used for recognizing voice data of other scenes; alternatively, the object recognition model obtained by adjusting the numbers of A, B, C may be used for other types of recognition tasks, for example, for recognizing image data.
Based on the same inventive concept, an embodiment of the present application further provides a data identification device, referring to fig. 6, where fig. 6 is a structural diagram of the data identification device provided in the embodiment of the present application, and the device includes:
a to-be-recognized voice data obtaining module 601, configured to obtain to-be-recognized voice data of a current recognition scene;
the recognition module 602 is configured to input the to-be-recognized speech data into a pre-constructed target recognition model, so as to obtain a recognition result of the to-be-recognized speech data; the recognition result comprises text information contained in the voice data to be recognized;
wherein the model parameters of the target identification model are as follows: the method comprises the steps of determining on the basis of candidate model parameters of a plurality of candidate recognition models trained in advance; the model structures of the plurality of candidate recognition models and the target recognition model are the same; the multiple candidate recognition models are obtained by training in a meta-learning mode based on sample data of candidate recognition scenes except the current recognition scene, and training sets adopted by the multiple candidate recognition models are different.
In one embodiment, the apparatus further comprises:
the target model parameter acquisition module is used for calculating the weighted sum of the alternative model parameters of each alternative recognition model as a target model parameter based on preset weight;
and the target recognition model acquisition module is used for determining a target recognition model based on the target model parameters.
In an embodiment, the target recognition model obtaining module is specifically configured to determine a model having the target model parameters as a target recognition model.
In one embodiment, the target recognition model obtaining module includes:
the identification model to be corrected acquisition module is used for determining a model with the target model parameters as the identification model to be corrected;
and the target recognition model obtaining submodule is used for training the recognition model to be corrected based on the sample voice data of the current recognition scene to obtain the target recognition model.
In one embodiment, the apparatus further comprises:
the sample data acquisition module is used for acquiring sample data corresponding to each alternative identification scene;
a sample data group acquisition module, configured to divide sample data corresponding to the candidate identification scene into a plurality of sample data groups according to the number of the plurality of preset identification tasks corresponding to the candidate identification scene, where the sample data groups are respectively used as sample data groups corresponding to the plurality of preset identification tasks;
the training module is used for training an initial recognition model of a preset model structure based on the corresponding sample data group aiming at each preset recognition task;
the model parameter acquisition module to be processed is used for acquiring the model parameters of the initial recognition model after training as the model parameters to be processed when the number of rounds of training reaches the preset number;
the candidate model parameter acquisition module is used for adjusting the original model parameters of the initial recognition model based on the model parameter difference values corresponding to the preset recognition tasks to obtain the candidate model parameters of the candidate recognition model corresponding to the candidate recognition scene; wherein, the model parameter difference value corresponding to one preset identification task represents: and the difference value between the model parameter to be processed corresponding to the preset identification task and the original model parameter.
An embodiment of the present application further provides an electronic device, as shown in fig. 7, including a memory 701 and a processor 702;
a memory 701 for storing a computer program;
the processor 702 is configured to implement the data identification method provided in the embodiment of the present application when executing the program stored in the memory 701.
Specifically, the data identification method includes:
acquiring voice data to be recognized of a current recognition scene;
inputting the voice data to be recognized into a pre-constructed target recognition model to obtain a recognition result of the voice data to be recognized; the recognition result comprises text information contained in the voice data to be recognized;
wherein the model parameters of the target identification model are as follows: the method comprises the steps of determining on the basis of candidate model parameters of a plurality of candidate recognition models trained in advance; the model structures of the plurality of candidate recognition models and the target recognition model are the same; the multiple candidate recognition models are obtained by training in a meta-learning mode based on sample data of candidate recognition scenes except the current recognition scene, and training sets adopted by the multiple candidate recognition models are different.
It should be noted that other implementation manners of the data identification method are the same as those of the foregoing method embodiment, and are not described herein again.
The electronic device may be provided with a communication interface for realizing communication between the electronic device and another device.
The processor, the communication interface, and the memory are configured to communicate with each other through a communication bus, where the communication bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment provided by the present application, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the above data identification methods.
In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the data recognition methods of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus 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, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus, system, electronic device, computer-readable storage medium, and computer program product embodiments, the description is relatively simple as it is substantially similar to the method embodiments, and reference may be made to some descriptions of the method embodiments for relevant points.
The above description is only for the preferred embodiment of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.