Model training method and device
Patent Information
- Application Number
- CN202310957741.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2043-07-31
AI Technical Summary
例如,可以采用光学字符识别(Optical Character Recognition,OCR)对文字内容是被,但是由于文字中会存在文字复杂的情况,采用OCR使得文字识别不准确
[0047] In some or related embodiments, the process involves: acquiring a training sample set and a test sample set; randomly initializing the model parameters of a first meta-learning model; updating the first model parameters of the initial meta-learning model using a first subset of training samples from the training sample set to obtain second model parameters; validating the second meta-learning model using any subset of test samples from the test sample set to obtain a reward mechanism score corresponding to any subset of test samples; updating the second model parameters using the reward mechanism score corresponding to any subset of test samples to obtain third model parameters; iteratively updating the second meta-learning model based on the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions, thus obtaining the target meta-learning model. Therefore, by adding a reward mechanism score to the meta-learning model, the learning score of the meta-learning model can be dynamically adjusted. During the training period, the learned meta-knowledge can be extracted through different task combinations to verify the accuracy of the test sample set. Adding a reward mechanism based on the verification accuracy allows for fine-tuning of the meta-learning model, improving its feature learning performance and enhancing the accuracy of its acquisition.
Smart Images

Figure CN117095407B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing, and more particularly to a model training method and apparatus. Background Technology
[0002] With the development of science and technology, users have increasingly higher requirements for the accuracy of text recognition. For example, Optical Character Recognition (OCR) can be used to recognize text content, but due to the complexity of text, OCR can lead to inaccurate text recognition. Furthermore, multi-task text recognition models require a large number of training samples, which can also result in inaccuracies in the model's acquisition process. Summary of the Invention
[0003] This disclosure provides a model training method and apparatus to improve the accuracy of acquiring meta-learning models. The technical solution of this disclosure is as follows:
[0004] According to a first aspect of the present disclosure, a model training method is provided, comprising:
[0005] Obtain a training sample set and a test sample set, wherein the training sample set includes at least one randomly selected subset of training samples, and the subset of training samples includes at least one handwritten text sample;
[0006] Randomly initialize the model parameters of the meta-learning (ML) model;
[0007] The first model parameters in the initial meta-learning model are updated using a first subset of training samples in the training sample set to obtain the second model parameters, wherein the first subset of training samples is any subset of training samples in the training sample set;
[0008] The second grammatical learning model is validated using any subset of test samples from the test sample set, and the reward mechanism score corresponding to any subset of test samples is obtained.
[0009] The second model parameters are updated using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters;
[0010] The second meta-learning model is iteratively updated based on the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions, thereby obtaining the target meta-learning model. The second training sample subset is any training sample subset in the training sample set other than the first training sample subset.
[0011] According to some embodiments, the method further includes:
[0012] Obtain the training loss corresponding to any subset of training samples;
[0013] The sum of the training losses corresponding to any subset of training samples is taken as the total loss corresponding to the initial meta-learning model.
[0014] According to some embodiments, updating the second model parameters using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters includes:
[0015] If the reward mechanism score corresponding to any subset of the test samples is greater than the preset score, the first feature point corresponding to the first subset of the training samples is obtained by using the model-independent meta-learning MANN sub-model.
[0016] The first feature point is used to update the second model parameters to obtain the third model parameters.
[0017] According to some embodiments, the method further includes:
[0018] The parameters of the third model are applied inversely to the second grammatical learning model using a stochastic gradient descent (SGD) sub-model.
[0019] According to some embodiments, the method further includes:
[0020] If the reward mechanism score corresponding to any subset of test samples is less than or equal to a preset score, the second feature point corresponding to the first training sample subset is extracted by the Long Short-Term Recurrent Neural Network (LSTM) sub-model, and the second feature point is used as a negative training sample.
[0021] According to a second aspect of the present disclosure, an image recognition method is provided, the method comprising:
[0022] Acquire a first image, wherein the first image includes handwritten text;
[0023] The first image is subjected to multi-level single-character horizontal and vertical segmentation to obtain the second image;
[0024] The second image is input into the target meta-learning model for recognition, and text information corresponding to the first image is obtained.
[0025] According to some embodiments, the step of inputting the second image into the target meta-learning model for recognition to obtain text information corresponding to the first image includes:
[0026] Obtain the font information of the text corresponding to the second image;
[0027] If the text corresponding to the second image belongs to a preset text set, perform structural analysis on the text corresponding to the second image to obtain the third image;
[0028] The third image and the font information are input into the target meta-learning model for recognition to obtain the text information corresponding to the first image.
[0029] According to a third aspect of the present disclosure, a model training apparatus is provided, comprising:
[0030] A set acquisition unit is used to acquire a training sample set and a test sample set, wherein the training sample set includes at least one randomly selected training sample subset, and the training sample subset includes at least one handwritten text sample.
[0031] The parameter initialization unit is used to randomly initialize the model parameters of the first-order learning model;
[0032] The parameter update unit is used to update the first model parameters in the initial meta-learning model using the first training sample subset in the training sample set to obtain the second model parameters, wherein the first training sample subset is any training sample subset in the training sample set;
[0033] The score acquisition unit is used to validate the second gram learning model using any subset of test samples in the test sample set, and to obtain the reward mechanism score corresponding to any subset of test samples.
[0034] The parameter update unit is further configured to update the second model parameters using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters;
[0035] The model acquisition unit is used to iteratively update the second meta-learning model according to the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions to obtain the target meta-learning model, wherein the second training sample subset is any training sample subset in the training sample set other than the first training sample subset.
[0036] According to a fourth aspect of the present disclosure, an image recognition apparatus is provided, comprising:
[0037] An image acquisition unit is used to acquire a first image, wherein the first image includes handwritten text;
[0038] The image processing unit is used to perform multi-level single-character horizontal and vertical segmentation processing on the first image to obtain the second image;
[0039] The information acquisition unit is used to input the second image into the target meta-learning model for recognition, and obtain text information corresponding to the first image.
[0040] According to a fifth aspect of the present disclosure, a network-side device is provided, comprising:
[0041] processor;
[0042] Memory used to store the processor's executable instructions;
[0043] The processor is configured to execute the instructions to implement the model training method and the image recognition method described in any one of the preceding aspects.
[0044] According to a sixth aspect of the present disclosure, a storage medium is provided that, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the model training method and the image recognition method described in any one of the preceding aspects.
[0045] According to a seventh aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method described in any one of the preceding aspects and the image recognition method described in any one of the preceding aspects.
[0046] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:
[0047] In some or related embodiments, the process involves: acquiring a training sample set and a test sample set; randomly initializing the model parameters of a first meta-learning model; updating the first model parameters of the initial meta-learning model using a first subset of training samples from the training sample set to obtain second model parameters; validating the second meta-learning model using any subset of test samples from the test sample set to obtain a reward mechanism score corresponding to any subset of test samples; updating the second model parameters using the reward mechanism score corresponding to any subset of test samples to obtain third model parameters; iteratively updating the second meta-learning model based on the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions, thus obtaining the target meta-learning model. Therefore, by adding a reward mechanism score to the meta-learning model, the learning score of the meta-learning model can be dynamically adjusted. During the training period, the learned meta-knowledge can be extracted through different task combinations to verify the accuracy of the test sample set. Adding a reward mechanism based on the verification accuracy allows for fine-tuning of the meta-learning model, improving its feature learning performance and enhancing the accuracy of its acquisition.
[0048] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0049] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0050] Figure 1 This is a flowchart illustrating a model training method according to an exemplary embodiment;
[0051] Figure 2 This is a flowchart illustrating a model training method according to an exemplary embodiment;
[0052] Figure 3 This is an example diagram illustrating a font classification according to an exemplary embodiment;
[0053] Figure 4 This is an example diagram illustrating a font classification according to an exemplary embodiment;
[0054] Figure 5 This is an example diagram illustrating a font classification according to an exemplary embodiment;
[0055] Figure 6 This is a block diagram illustrating a model training apparatus according to an exemplary embodiment;
[0056] Figure 7 This is a block diagram illustrating a model training apparatus according to an exemplary embodiment;
[0057] Figure 8 This is a block diagram illustrating a terminal device according to an exemplary embodiment;
[0058] Figure 9 This is a block diagram illustrating a network-side device according to an exemplary embodiment. Detailed Implementation
[0059] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0060] This disclosure provides a model training method and apparatus. In some embodiments, the terms "model training method" and "information processing method" and "communication method" can be used interchangeably; the terms "model training apparatus" and "information processing apparatus" and "communication apparatus" can be used interchangeably; and the terms "information processing system" and "communication system" can be used interchangeably.
[0061] This disclosure is not exhaustive, but merely illustrative of some embodiments, and is not intended to limit the scope of protection of this disclosure. Unless otherwise specified, each step in a particular embodiment can be implemented as an independent embodiment, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a particular embodiment can also be implemented as an independent embodiment, and the order of the steps in a particular embodiment can be arbitrarily interchanged. Furthermore, the optional implementation methods in a particular embodiment can be arbitrarily combined; moreover, the embodiments can be arbitrarily combined, for example, some or all steps of different embodiments can be arbitrarily combined, and a particular embodiment can be arbitrarily combined with the optional implementation methods of other embodiments.
[0062] In each of the disclosed embodiments, unless otherwise specified or in case of logical conflict, the terminology and / or descriptions of the embodiments are consistent and can be referenced by each other. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.
[0063] The terminology used in the embodiments of this disclosure is for the purpose of describing particular embodiments only and is not intended to limit the scope of this disclosure.
[0064] In this embodiment of the disclosure, unless otherwise stated, elements expressed in the singular form, such as "a," "an," "the," "the," "the," "the," "the," "the," "this," etc., can mean "one and only one," or "one or more," "at least one," etc. For example, when using articles such as "a," "an," "the," etc. in translation, the noun following the article can be understood as either a singular expression or a plural expression.
[0065] In the embodiments disclosed herein, "multiple" refers to two or more.
[0066] In some embodiments, the terms “at least one of”, “one or more”, “a plurality of”, “multiple”, etc., may be used interchangeably.
[0067] In some embodiments, the notation "at least one of A and B", "A and / or B", "A in one case, B in another", "in response to one case A, in response to another case B", etc., may include the following technical solutions depending on the situation: in some embodiments, A (execute A regardless of B); in some embodiments, B (execute B regardless of A); in some embodiments, execution is selected from A and B (A and B are selectively executed); in some embodiments, A and B (both A and B are executed). The same applies when there are more branches such as A, B, C, etc.
[0068] In some embodiments, the notation "A or B" may include the following technical solutions, depending on the situation: in some embodiments, A (execution of A regardless of B); in some embodiments, B (execution of B regardless of A); in some embodiments, execution is selected from A and B (A and B are selectively executed). The same applies when there are more branches such as A, B, C, etc.
[0069] The prefixes "first," "second," etc., used in the embodiments of this disclosure are merely for distinguishing different descriptive objects and do not impose restrictions on the position, order, priority, quantity, or content of the descriptive objects. The description of the descriptive objects is found in the claims or the context of the embodiments, and the use of prefixes should not constitute unnecessary restrictions. For example, if the descriptive object is a "field," the ordinal numbers preceding "field" in "first field" and "second field" do not restrict the position or order of the "fields." "First" and "second" do not restrict whether the "fields" they modify are in the same message, nor do they restrict the order of "first field" and "second field." Similarly, if the descriptive object is a "level," the ordinal numbers preceding "level" in "first level" and "second level" do not restrict the priority between "levels." Furthermore, the number of descriptive objects is not limited by ordinal numbers and can be one or more. For example, in "first device," the number of "devices" can be one or more. Furthermore, the objects modified by different prefixes can be the same or different. For example, if the object being described is "device", then "first device" and "second device" can be the same device or different devices, and their types can be the same or different. Similarly, if the object being described is "information", then "first information" and "second information" can be the same information or different information, and their content can be the same or different.
[0070] In some embodiments, “including A,” “containing A,” “for indicating A,” and “carrying A” can be interpreted as directly carrying A or indirectly indicating A.
[0071] In some embodiments, the terms “in response to…”, “in response to determining…”, “in the case of…”, “when…”, “if…”, “if…”, etc., can be used interchangeably.
[0072] In some embodiments, the terms “greater than,” “greater than or equal to,” “not less than,” “more than,” “more than or equal to,” “not less than,” “higher than,” “higher than or equal to,” “not lower than,” and “above” can be used interchangeably, as can the terms “less than,” “less than or equal to,” “not greater than,” “less than,” “less than or equal to,” “not more than,” “lower than,” “lower than or equal to,” “not higher than,” and “below”.
[0073] In some embodiments, the apparatus and device may be interpreted as physical or virtual, and their names are not limited to the names recorded in the embodiments. In some cases, they may also be understood as "equipment", "device", "circuit", "network element", "node", "function", "unit", "section", "system", "network", "chip", "chip system", "entity", "body", etc.
[0074] In some embodiments, "network" can be interpreted as devices included in the network, such as access network devices, core network devices, etc.
[0075] In some embodiments, "terminal" or "terminal device" may be referred to as "user equipment (UE)," "user terminal," "mobile station (MS)," "mobile terminal (MT)," "subscriber station," "mobile unit," "subscriber unit," "wireless unit," "remote unit," "mobile device," "wireless device," "wireless communication device," "remote device," "mobile subscriber station," "access terminal," "mobile terminal," "wireless terminal," "remote terminal," "handset," "user agent," "mobile client," "client," etc.
[0076] In some embodiments, the acquisition of data, information, etc., may comply with the laws and regulations of the country where the location is situated.
[0077] In some embodiments, data, information, etc., may be obtained with the user's consent.
[0078] Furthermore, each element, each row, or each column in the table of this disclosure can be implemented as an independent embodiment, and any combination of any element, any row, or any column can also be implemented as an independent embodiment.
[0079] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0080] Among them, the decoder (Connectionist Temporal Classification, CTC) is a decoder algorithm that determines the most probable correspondence between two sequences (X, Y). In sequence problems, it is often used to calculate the correspondence between the model output X and the ground truth (GT) and to calculate the loss function. It is applicable to speech, translation, and text sequence recognition.
[0081] Among them, the attention mechanism (Attention) is a mechanism that simulates the visual thinking of the human brain. It calculates the degree of matching between the current input sequence and the output vector. The higher the matching degree, the higher the score of the attention focus point.
[0082] Among them, the Convolutional Neural Networks (CNN) sub-model is a type of feedforward neural network model that includes convolutional computation and has a deep structure. It has representation learning capabilities and can perform translation-invariant classification of input information according to its hierarchical structure. It is mainly used in the field of image recognition.
[0083] Among them, the Recurrent Neural Network (RNN) sub-model is a type of recurrent neural network that takes sequence data as input, recurses in the direction of sequence evolution, and connects all nodes (recurrent units) in a chain-like manner.
[0084] In some implementations, OCR text recognition includes both text region detection and text content recognition. The success rate of text region detection is generally over 99%. The main bottleneck is text content recognition, especially for handwritten signatures. Commonly used handwritten fonts include five major categories: running script, cursive script, official script, seal script, and regular script. Handwritten fonts vary greatly from person to person. In recent years, text content recognition has mainly followed two technical routes: one is CNN+RNN+CTC, and the other is CNN+RNN+Attention. CTC performs better in recognizing Chinese characters, while Attention is more suitable for English recognition. In multi-task text recognition model training, CTC is the primary method, with Attention assisting in training. The CTC-based text training method often requires tens of millions of samples to achieve good convergence. Due to insufficient sample size, the model often encounters convergence difficulties and the loss function not decreasing during training. For example, the sample size of handwritten text is less than tens of millions, typically ranging from hundreds of thousands to millions. Due to this insufficient sample size, the model's feature learning for handwritten text is inadequate, making targeted optimization difficult. Consequently, the accuracy of handwritten text recognition in this OCR text recognition pair is relatively low.
[0085] Figure 3 This is a flowchart illustrating a model training method according to an exemplary embodiment, such as... Figure 3 As shown, it includes the following steps:
[0086] In step S11, the training sample set and the test sample set are obtained;
[0087] The training sample set includes at least one randomly selected subset of training samples, and this subset includes at least one handwritten text sample. The training sample set refers to a collection comprised of at least one subset of training samples. This training sample set does not refer to a specific fixed set. For example, when any subset of training samples changes, the training sample set may also change accordingly. For example, when the randomly selected time point changes, the training sample set may also change accordingly. The training sample subset includes at least one handwritten text sample.
[0088] According to some embodiments, the training sample set refers to the sample set used to train the meta-learning model. The test sample set refers to the sample set used to validate the meta-learning model. This test sample set does not specifically refer to a fixed set. For example, when a set modification instruction corresponding to the test sample set is received, the test sample set can be modified. This set modification instruction includes, but is not limited to, instructing data replacement or modification of the test sample set.
[0089] According to some embodiments, when performing a model training method, a training sample set and a test sample set can be obtained.
[0090] According to some embodiments, D meta-train The meta-learning training sample set is distributed as a task, where the training sample set is classified in an N-way manner, where N is the number of categories in the training sample set. Each category has K labeled data points. The N-way and K-shot categories are repeatedly and randomly selected to form several T pools, which together constitute a new task pool TP. Table 1 illustrates an example of a classification method according to an embodiment of this disclosure.
[0091] Table 1
[0092]
[0093] Where T can represent a, b, c, ... more, and n is the size of the category, the task pool TP is represented as follows:
[0094] TP={(a1,b1,c1,...,more1),(a2,b2,...,more2),...,(a n ,b n ,...,more n )}
[0095] Here, a1, b1, c1, ..., more1 can be, for example, a subset of training samples. Data from different subsets of training samples may be duplicated.
[0096] In step S12, the model parameters of the first-order learning model are randomly initialized;
[0097] In some embodiments, model parameters refer to configuration variables within the model. These model parameters can be determined, for example, using training sample data. They can be learned and estimated from the data, for example. The model parameters are not specifically fixed parameters. For example, they can change accordingly when the training sample set changes.
[0098] In some embodiments, the first-gram learning model may be, for example, an initial model that has not been trained and validated. This first-gram learning model may, for example, be a copy of an initial meta-learning model. This disclosure does not limit this aspect.
[0099] Optionally, the model parameters of the unary learning model can be initialized randomly. For example, the initial model parameters of the unary learning model can be a random value.
[0100] According to some embodiments, meta-learning is based on learning from different small task samples, so that it can handle different types of tasks better. Based on data classification methods such as multi-level single-character horizontal and vertical segmentation, multiple small sample cross-mixing classification feature methods, and local feature methods that split and recombine corner points of rare characters, 1...N types of feature value classifications are derived. In practical applications, more feature values are not necessarily better, nor are too few. The most important thing is to keep the valuable feature values within a reasonable range.
[0101] According to some embodiments, the meta-learning model may be a combination of model-agnostic meta-learning (MAML) sub-models, memory-augmented neural network (MANN) sub-models, long short-term recurrent neural network (LSTM) sub-models, recurrent neural network (RNN) sub-models, and score sub-models.
[0102] Among them, the Model-Agnostic Meta-Learning (MAML) sub-model mainly addresses the problems of small sample sizes and slow model convergence. By initializing parameters, it can achieve rapid convergence with only a small amount of data. To achieve this, the model requires a large amount of prior knowledge to continuously adjust the initialization parameters, enabling it to adapt to different types of data.
[0103] Among them, the Memory Augmented Neural Network (MANN) sub-model is mainly used to add storage modules and corresponding read and write mechanisms to the traditional neural network model. It can simulate the working memory mechanism of the human brain, such as backward chaining in reading comprehension question answering, as well as some computational processes and algorithms.
[0104] Among them, the Long Short Term Memory (LSTM) sub-model is a time-recurrent neural network model that can store valuable information for a long time, thereby reducing the learning difficulty of recurrent neural networks.
[0105] Meta-learning models can also include, for example, stochastic gradient descent (SGD), where the gradient is a vector that indicates the direction of the weights. More precisely, it indicates the mechanism for changing the weights to minimize the loss; this process is called gradient descent because it uses the gradient to reduce the loss curve to its minimum.
[0106] In step S13, the first model parameters in the initial meta-learning model are updated using the first subset of training samples in the training sample set to obtain the second model parameters;
[0107] According to some embodiments, the first training sample subset is any subset of training samples in the training sample set. This first training sample subset does not specifically refer to a fixed subset. The "first" in this first training sample subset is only used to distinguish it from the other training sample subsets.
[0108] In some embodiments, the second model parameter refers to the model parameter obtained after updating the first model parameter once. This second model parameter does not specifically refer to a fixed parameter. For example, when the first training sample subset changes, the second model parameter can also change accordingly.
[0109] According to some embodiments, when a training sample set is obtained, the first model parameters in the initial meta-learning model can be updated using a first subset of training samples in the training sample set to obtain the second model parameters.
[0110] According to some embodiments, the training loss corresponding to any subset of training samples can be obtained; the sum of the training losses corresponding to any subset of training samples is taken as the total loss corresponding to the initial meta-learning model. The total loss is used to measure the model's performance in the current iteration and can serve as an indicator for hyperparameter tuning. Therefore, the update status of model parameters can be determined based on the total loss, improving the accuracy of model acquisition.
[0111] In step S14, the second meta-learning model is validated using any subset of test samples in the test sample set, and the reward mechanism score corresponding to any subset of test samples is obtained.
[0112] In some embodiments, the reward mechanism score is used to dynamically modify the model parameters of the meta-learning model. This reward mechanism score is not specifically a fixed value. For example, when the overall category of the task corresponding to a subset of test samples changes, the reward mechanism score corresponding to that subset of test samples can also change accordingly.
[0113] In some embodiments, when a second grammatical learning model is obtained after training a first grammatical learning model using a first subset of training samples, the second grammatical learning model can be validated using any subset of test samples in the test sample set to obtain the reward mechanism score corresponding to any subset of test samples.
[0114] In step S15, the second model parameters are updated using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters;
[0115] According to some embodiments, when the reward mechanism score is obtained, the second model parameters can be updated using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters. The third model parameters refer to the model parameters after updating the second model parameters. For example, the third model parameters can be the model parameters after updating the first model parameters twice.
[0116] In some embodiments, for example, the reward mechanism score corresponding to any subset of the test samples can be used to update the second model parameters to obtain the third model parameters.
[0117] According to some embodiments, updating the second model parameters using the reward mechanism score corresponding to any subset of test samples to obtain third model parameters includes: when the reward mechanism score corresponding to any subset of test samples is greater than a preset score, using a model-independent meta-learning MANN sub-model to obtain a first feature point corresponding to the first training sample subset; and using the first feature point to update the second model parameters to obtain third model parameters. Therefore, using the MANN sub-model to obtain the first feature point can improve the accuracy of feature point acquisition and the accuracy of meta-learning model acquisition.
[0118] In some embodiments, the first feature point refers to a feature point obtained through a model-independent meta-learning MANN sub-model, and this first feature point does not specifically refer to a fixed feature point. For example, when the model parameters in the model-independent meta-learning MANN sub-model change, the first feature point may also change accordingly.
[0119] According to some embodiments, the method further includes: using a stochastic gradient descent (SGD) sub-model to apply the third model parameters inversely to the second meta-learning model.
[0120] In step S16, the second meta-learning model is iteratively updated according to the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions, thereby obtaining the target meta-learning model.
[0121] The second training sample subset is any subset of training samples in the training sample set other than the first training sample subset. In other words, the first-gram learning model needs to be iteratively trained to obtain the target-gram learning model.
[0122] According to some embodiments, model validation conditions are not specifically defined by a single fixed condition. For example, when a modification instruction for model validation conditions is received, the model validation conditions may also change accordingly. For example, when the model identifier of the meta-learning model changes, the model validation conditions may also change accordingly.
[0123] In some embodiments, the second meta-learning model can be iteratively updated based on the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions, thereby obtaining the target meta-learning model.
[0124] According to some embodiments, when the reward mechanism score corresponding to any subset of test samples is less than or equal to a preset score, a second feature point corresponding to the first training sample subset is extracted using a Long Short-Term Recurrent Neural Network (LSTM) sub-model, and the second feature point is used as a negative training sample. The negative training sample can balance the dataset, helping the meta-learning model learn a better decision boundary and improving the robustness of the meta-learning model.
[0125] According to some embodiments, the first-order learning model may be, for example, M. meta Meta-learning models. For example, defining M... meta The step size hyperparameters α and β of the meta-learning model. The step size hyperparameter refers to the magnitude by which the parameters are updated along the negative gradient direction in each iteration. The choice of step size has a significant impact on the effectiveness and speed of model training.
[0126] In some embodiments, for example, setting M meta The model has an expected score S1 and a reward score S2, where S2 is dynamically set during training. The reward score for each task is 1 / 100 of the total categories. The expected score refers to the model's performance metric expected to be achieved during training, used to evaluate the model's quality. S1 is set, for example, based on pre-set records, and the training stops once the expected target is reached. The expected score of S1 determines the number of iterations and the duration of the model iteration loop.
[0127] In some embodiments, the reward score of S2 is the weighting factor coefficient of the accuracy of the test set found in each iteration of task T. The reward score of task T in S2 ranges X∈(0,1), where Xn is the weighting factor coefficient of the test set accuracy. For example, it can be understood that the weighting factor coefficient of accuracy is 1 / 100 of the total number of categories in the task. The formula for calculating the reward score of S2 is:
[0128]
[0129] In some embodiments, M can be randomly initialized, for example. meta Meta-learning model parameters θ.
[0130] According to some embodiments, the task T is iterated cyclically from M. meta Meta-learning model replicates temporary model M meta′ Using the training sample set of task T, the gradient θ' of each parameter is calculated. In the N-way and K-shot settings, the support set here has NK samples, and the gradient θ' of M is calculated. meta′ The parameter θ' is updated; each iteration T will adjust M accordingly. meta′ Perform a parameter θ' update once.
[0131] According to some embodiments, according to M meta′ The model's learning progress and updated parameters, for M meta-test The accuracy of the test sample set is verified using the test sample set. meta′ A reward mechanism with a score X1 is added to the model. The maximum score for each task T is max, where max = 1, and for each test set... Where n is the task category size, X1 = the cumulative value of T1, and T1 ≤ 1.
[0132] In some embodiments, after the first gradient update is completed, a reward score X1 is obtained for any subset of test samples in the test sample set. If X1 is greater than 0, the first feature point in the sample T of this task is extracted using MANN, and a second gradient update is calculated by gradually changing the gradient. Then, SGD is applied inversely to M. meta If X1 equals 0, then the second feature point extracted from the T samples of this task using LSTM is used as a negative training sample.
[0133] In some embodiments, after the above steps are completed, a cyclic iterative task can be executed to continue sampling the next task T. When S2 is greater than or equal to S1, it is determined that the sampling of M is complete. meta The update of the parameters θ of the meta-learning model, i.e., M meta The meta-learning model has been fine-tuned to the expected effect, and the final output is the target meta-learning model for this training.
[0134] In each of the disclosed embodiments, unless otherwise specified or in case of logical conflict, the terminology and / or descriptions of the embodiments are consistent and can be referenced by each other. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships.
[0135] In some or related embodiments, the process involves: acquiring a training sample set and a test sample set; randomly initializing the model parameters of a first meta-learning model; updating the first model parameters of the initial meta-learning model using a first subset of training samples from the training sample set to obtain second model parameters; validating the second meta-learning model using any subset of test samples from the test sample set to obtain a reward mechanism score corresponding to any subset of test samples; updating the second model parameters using the reward mechanism score corresponding to any subset of test samples to obtain third model parameters; iteratively updating the second meta-learning model based on the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions, thus obtaining the target meta-learning model. Therefore, by adding a reward mechanism score to the meta-learning model, the learning score of the meta-learning model can be dynamically adjusted. During the training period, the learned meta-knowledge can be extracted through different task combinations to verify the accuracy of the test sample set. Adding a reward mechanism based on the verification accuracy allows for fine-tuning of the meta-learning model, improving its feature learning performance and enhancing the accuracy of its acquisition.
[0136] Figure 2 This is a flowchart illustrating a model training method according to an exemplary embodiment, such as... Figure 2 As shown, this model training method can be used in image recognition scenarios, and includes the following steps:
[0137] In step S21, the first image is acquired;
[0138] The first image is the image to be identified. This first image can be, for example, a photograph taken directly by a terminal device of a paper document and sent to the network-side device, or it can be pre-stored in the network-side device. The technical solution of this disclosure does not limit the acquisition of the first image. The "first" in the first image is only used to distinguish it from the "second" image and does not specifically refer to a fixed image. For example, when the acquisition time point corresponding to the first image changes, the first image may also change accordingly. For example, when the image content corresponding to the first image changes, the first image may also change accordingly.
[0139] In some embodiments, a first image may be acquired. This first image may include handwritten text.
[0140] In some embodiments, the embodiments of this disclosure can be used, for example, in scenarios with multi-row and multi-column fonts, including but not limited to scenarios with a large number of uncommon characters. For example, it can also be applied to scenarios where names have a large number of characters.
[0141] In step S22, the first image is subjected to multi-level single-character horizontal and vertical segmentation to obtain the second image;
[0142] According to some embodiments, the second image refers to an image obtained by processing the first image. This second image does not specifically refer to a fixed image. For example, when the method of horizontal and vertical segmentation of multi-level characters changes, the second image can also change accordingly. Upon obtaining the first image, the first image is processed by horizontal and vertical segmentation of multi-level characters to obtain the second image.
[0143] According to some embodiments, the first image may correspond to multi-row, multi-column handwritten text. The multi-row, multi-column handwritten text is categorized horizontally and vertically, segmented and classified according to 4 to 12 characters. For each of the 4 to 12 character categories, a multi-level classification system is constructed based on font spacing and character clarity, with each category corresponding to a task. The specific classification method can be as follows: Figure 3 As shown. Among them, Figure 3 Any letter plus a number is used to uniquely identify a classification method. The more numbers in the subscript, the more detailed the classification.
[0144] According to some embodiments, multi-line handwritten text is a major category, for example, horizontal and vertical secondary categories can be constructed, where the horizontal and vertical secondary categories are represented as a1 and a2, respectively. For the horizontal and vertical secondary categories, a tertiary category is then constructed based on different font spacing and character clarity. Font spacing is divided into three levels: first distance, second distance, and third distance. The first distance can be, for example, a close distance, where the font spacing is less than a first spacing threshold. The second distance can be, for example, a medium distance, where the font spacing is greater than or equal to the first spacing threshold but less than the second spacing threshold, and the second spacing threshold is greater than the first spacing threshold. The third distance can be, for example, a far distance, where the font spacing is greater than or equal to the second spacing threshold.
[0145] The spacing between characters, such as mid-range and far-range characters, allows for visual differentiation of two characters without significant overlap, enabling clear automatic character segmentation. For characters with close spacing, this is further divided into slight overlap and large overlap. Slightly overlapping characters can be segmented using a pre-defined position, and any residual stroke marks after segmentation are eliminated (i.e., stroke marks that are not part of the original character). Large overlap that is indistinguishable to the naked eye is classified as a negative sample. Pre-defined position segmentation can be achieved using a pre-trained character segmentation model.
[0146] In some embodiments, character sharpness is divided into three levels: first sharpness, second sharpness, and third sharpness, with the sharpness decreasing progressively from first to third. That is, third sharpness is less than second sharpness, and second sharpness is less than first sharpness. Specifically, handwritten characters with a blurriness of less than 25% are segmented according to a preset segmentation method. Data with a blurriness between 25% and 40% undergoes sharpening processing before segmentation. Blurriness exceeding 50% is classified as negative samples.
[0147] According to some embodiments, the processing of the first image may also include multiple small-sample cross-mixing classification feature processing. For example, handwritten font classification is performed according to font types such as regular script, running script, cursive script, clerical script, seal script, large font, and small font. Furthermore, samples of other fonts are mixed into these five font types, with each classification corresponding to a task. Specific examples include... Figure 4 As shown.
[0148] According to some embodiments, font classification can be performed on the segmented fonts. For example, it can be classified into 5 regular fonts, and then further classified into large and small fonts of 5 regular fonts, with these 7 classifications represented as b1...b7 respectively. The 5 regular fonts are divided into two subcategories, and a first handwritten form and a second handwritten form are dynamically generated using a Generative Adversarial Network (GAN). The first handwritten form can be, for example, handwritten text written according to a preset writing method, such as normal handwritten text, which can be, for example, printed fonts; the second handwritten form can be, for example, the handwritten text included in the second image, such as actual handwritten text. The font size range for the small font category is between 12px and 24px, and the font size range for the large font category is between 24px and 48px. The advantage of this classification is that features of individual characters ranging from small to large can be extracted normally, which can improve the generalization ability and robustness of the model.
[0149] In step S23, the second image is input into the target meta-learning model for recognition to obtain text information corresponding to the first image.
[0150] According to some embodiments, when the second image is acquired, the second image can be input into the target meta-learning model for recognition to obtain text information corresponding to the first image.
[0151] According to some embodiments, the step of inputting the second image into the target meta-learning model for recognition to obtain text information corresponding to the first image comprises: acquiring font information of text corresponding to the second image; in a case that the text corresponding to the second image belongs to a preset text set, performing structural analysis on the text corresponding to the second image to obtain a third image; inputting the third image and the font information into the target meta-learning model for recognition, and obtaining text information corresponding to the first image. Therefore, the situation that characters cannot be recognized due to stroke front completion is reduced, the accuracy of text information recognition can be improved, the situation that characters cannot be recognized is reduced, the recognition accuracy of rare characters is improved, and the convenience of text recognition is improved.
[0152] Wherein, the preset text set may be a rare character set, for example. Corner point splitting is performed on some rare characters, which are separated according to 2 to 6 radical structures to construct a two-dimensional matrix grid of radical structures, retaining the stroke front features of font combinations, and corresponding the split radicals to the combined original font, with each classification corresponding to one task. For example, it may be specifically as Figure 5 shown.
[0153] In some embodiments, for Chinese character structure classification, there are 8 common classifications based on radical combination. According to the analysis of the glyph structure of rare characters, rare characters basically belong to the structure type of radical combination. People's writing habit is to complete the writing of the whole character in the order from left to right, from top to bottom and following the radical combination steps. For example, the rare Chinese character "惔" (tán) is split into "忄" (radical meaning heart) and "炎" (fire) according to the left-right structure, wherein "炎" can be further split into "火" (fire) and "火" in the top-bottom structure. Therefore, the character "惔" has a total of 3 corner points, which are "忄", "火" and "火" respectively, and the writing direction is left first, then top and then bottom.
[0154] In some or related embodiments, a first image is acquired; multi-stage cascaded single-character horizontal and vertical segmentation processing is performed on the first image to obtain a second image; the second image is input into the target meta-learning model for recognition, and text information corresponding to the first image is obtained. Therefore, by performing multi-stage cascaded single-character horizontal and vertical segmentation processing on the first image and adopting the target meta-learning model for recognition, the situation that multi-line handwritten characters and complex handwritten characters cannot be recognized is reduced, the requirements for the writing clarity and neatness of characters are lowered, and the accuracy of acquiring text information can be improved.
[0155] Figure 6 is a block diagram of a model training apparatus shown according to an exemplary embodiment. Referring to Figure 6 , the model training apparatus 600 comprises:
[0156] The set acquisition unit 601 is used to acquire a training sample set and a test sample set, wherein the training sample set includes at least one randomly selected training sample subset, and the training sample subset includes at least one handwritten text sample.
[0157] The parameter initialization unit 602 is used to randomly initialize the model parameters of the first-order learning model;
[0158] The parameter update unit 603 is used to update the first model parameters in the initial meta-learning model using the first training sample subset in the training sample set to obtain the second model parameters, wherein the first training sample subset is any training sample subset in the training sample set;
[0159] The score acquisition unit 604 is used to verify the second gram learning model using any subset of test samples in the test sample set, and to obtain the reward mechanism score corresponding to any subset of test samples.
[0160] The parameter update unit 603 is further configured to update the second model parameters using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters;
[0161] The model acquisition unit 605 is used to iteratively update the second meta-learning model according to the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions to obtain the target meta-learning model, wherein the second training sample subset is any training sample subset in the training sample set other than the first training sample subset.
[0162] According to some embodiments, the model acquisition unit 605 is also used to acquire the training loss corresponding to any subset of training samples;
[0163] The sum of the training losses corresponding to any subset of training samples is taken as the total loss corresponding to the initial meta-learning model.
[0164] According to some embodiments, the parameter update unit 603 is used to update the second model parameters using the reward mechanism score corresponding to any subset of test samples to obtain the third model parameters, specifically for:
[0165] If the reward mechanism score corresponding to any subset of the test samples is greater than the preset score, the first feature point corresponding to the first subset of the training samples is obtained by using the model-independent meta-learning MANN sub-model.
[0166] The first feature point is used to update the second model parameters to obtain the third model parameters.
[0167] According to some embodiments, the model acquisition unit 605 is also used to apply the third model parameters in reverse to the second meta-learning model using a stochastic gradient descent (SGD) sub-model.
[0168] According to some embodiments, the model acquisition unit 605 is further configured to extract the second feature point corresponding to the first training sample subset through a long short-term recurrent neural network (LSTM) sub-model when the reward mechanism score corresponding to any test sample subset is less than or equal to a preset score, and use the second feature point as a negative training sample.
[0169] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0170] In some or related embodiments, a set acquisition unit is used to acquire a training sample set and a test sample set, wherein the training sample set includes at least one randomly selected training sample subset, and the training sample subset includes at least one handwritten text sample; a parameter initialization unit is used to randomly initialize the model parameters of the first meta-learning model; a parameter update unit is used to update the first model parameters in the initial meta-learning model using the first training sample subset in the training sample set to obtain second model parameters, wherein the first training sample subset is any training sample subset in the training sample set; and a score acquisition unit is used to acquire the score using the test sample subset. The second meta-learning model is validated using any subset of test samples in the sample set, and a reward mechanism score corresponding to the subset of test samples is obtained. The parameter update unit is further used to update the parameters of the second model using the reward mechanism score corresponding to the subset of test samples to obtain third model parameters. The model acquisition unit is used to iteratively update the second meta-learning model based on the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions, thereby obtaining the target meta-learning model. The second training sample subset is any subset of training samples in the training sample set other than the first training sample subset. Therefore, by adding a reward mechanism score to the meta-learning model, the learning score of the meta-learning model can be dynamically corrected. During the training period, the learned meta-knowledge is extracted through different task combinations to verify the accuracy of the test sample set. Adding a reward mechanism to the verification accuracy allows for fine-tuning of the meta-learning model, improving its feature learning effect on the samples and enhancing the acquisition accuracy of the meta-learning model.
[0171] Figure 7 This is a block diagram illustrating an image recognition device according to an exemplary embodiment. (Refer to...) Figure 7 The image recognition device 700 includes:
[0172] Image acquisition unit 701 is used to acquire a first image, wherein the first image includes handwritten text;
[0173] Image processing unit 702 is used to perform multi-level single-character horizontal and vertical segmentation processing on the first image to obtain a second image;
[0174] The information acquisition unit 703 is used to input the second image into the target meta-learning model for recognition, and obtain text information corresponding to the first image.
[0175] According to some embodiments, the information acquisition unit 703, when inputting the second image into the target meta-learning model for recognition to obtain text information corresponding to the first image, is specifically used for:
[0176] Obtain the font information of the text corresponding to the second image;
[0177] If the text corresponding to the second image belongs to a preset text set, perform structural analysis on the text corresponding to the second image to obtain the third image;
[0178] The third image and the font information are input into the target meta-learning model for recognition to obtain the text information corresponding to the first image.
[0179] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0180] In some or related embodiments, an image acquisition unit is used to acquire a first image, wherein the first image includes handwritten text; an image processing unit is used to perform multi-level horizontal and vertical segmentation processing on the first image to obtain a second image; and an information acquisition unit is used to input the second image into the target meta-learning model for recognition to obtain text information corresponding to the first image. Therefore, by performing multi-level horizontal and vertical segmentation processing on the first image and using a target meta-learning model for recognition, the number of cases where multi-line handwritten text cannot be recognized is reduced, and the requirements for the clarity and neatness of the handwriting are lowered, thereby improving the accuracy of text information acquisition.
[0181] Figure 8 This is a block diagram of a terminal device UE800 provided in one embodiment of this disclosure. For example, UE800 may be a mobile phone, computer, digital broadcasting terminal device, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc.
[0182] Reference Figure 8UE800 may include at least one of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 810, input / output (I / O) interface 812, sensor component 814, and communication component 816.
[0183] Processing component 802 typically controls the overall operation of UE 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 802 may include at least one processor 1020 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include at least one module to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0184] Memory 804 is configured to store various types of data to support operation on UE 800. Examples of this data include instructions for any application or method operating on UE 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0185] Power supply component 806 provides power to various components of UE800. Power supply component 806 may include a power management system, at least one power supply, and other components associated with generating, managing, and distributing power to UE800.
[0186] The multimedia component 808 includes a screen that provides an output interface between the UE 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes at least one touch sensor to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or swipe action but also detect the wake-up time and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the UE 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0187] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when UE 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0188] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0189] Sensor assembly 814 includes at least one sensor for providing status assessments of various aspects of UE 800. For example, sensor assembly 814 can detect the on / off state of UE 800, the relative positioning of components such as the display and keypad of UE 800, changes in position of UE 800 or one of its components, the presence or absence of user contact with UE 800, orientation or acceleration / deceleration of UE 800, and temperature changes of UE 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0190] Communication component 816 is configured to facilitate wired or wireless communication between UE 800 and other devices. UE 800 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0191] In an exemplary embodiment, UE800 may be implemented by at least one application-specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), programmable logic device (PLD), field-programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic component to perform the above method.
[0192] Figure 9 This is a block diagram of a network-side device 900 provided in an embodiment of this disclosure. For example, the network-side device 900 can be provided as a network-side device. (Refer to...) Figure 9 The network-side device 900 includes a processing component 922, which further includes at least one processor, and memory resources represented by memory 932 for storing instructions, such as application programs, that can be executed by the processing component 922. The application programs stored in memory 932 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 922 is configured to execute instructions to perform any of the methods described above applied to the network-side device.
[0193] The network-side device 900 may also include a power supply component 927 configured to perform power management of the network-side device 900, a wired or wireless network interface 950 configured to connect the network-side device 900 to a network, and an input / output (I / O) interface 958. The network-side device 900 can operate on an operating system stored in memory 932, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.
[0194] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0195] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0196] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0197] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0198] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.
[0199] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0200] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0201] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A model training method, characterized in that, include: Obtain a training sample set and a test sample set, wherein the training sample set includes at least one randomly selected subset of training samples, and the subset of training samples includes at least one handwritten text sample; Randomly initialize the model parameters of the first-order learning model to obtain the initial meta-learning model; The first model parameters in the initial meta-learning model are updated using the first training sample subset in the training sample set to obtain a second meta-learning model with second model parameters, wherein the first training sample subset is any training sample subset in the training sample set; The second grammatical learning model is validated using any subset of test samples in the test sample set, and the reward mechanism score corresponding to any subset of test samples is obtained. The second model parameters are updated using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters; The second meta-learning model is iteratively updated based on the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions, thereby obtaining the target meta-learning model. The second training sample subset is any training sample subset in the training sample set other than the first training sample subset.
2. The method according to claim 1, characterized in that, The method further includes: Obtain the training loss corresponding to any subset of training samples; The sum of the training losses corresponding to any subset of training samples is taken as the total loss corresponding to the initial meta-learning model.
3. The method according to claim 1, characterized in that, The step of updating the second model parameters using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters includes: If the reward mechanism score corresponding to any subset of the test samples is greater than the preset score, the first feature point corresponding to the first subset of the training samples is obtained by using the model-independent meta-learning MANN sub-model. The first feature point is used to update the second model parameters to obtain the third model parameters.
4. The method according to claim 3, characterized in that, The method further includes: The parameters of the third model are applied inversely to the second grammatical learning model using a stochastic gradient descent (SGD) sub-model.
5. The method according to claim 1, characterized in that, The method further includes: If the reward mechanism score corresponding to any subset of test samples is less than or equal to a preset score, the second feature point corresponding to the first training sample subset is extracted by the Long Short-Term Recurrent Neural Network (LSTM) sub-model, and the second feature point is used as a negative training sample.
6. An image recognition method, characterized in that, The method includes: Acquire a first image, wherein the first image includes handwritten text; The first image is subjected to multi-level single-character horizontal and vertical segmentation to obtain the second image; The second image is input into the target meta-learning model for recognition to obtain text information corresponding to the first image, wherein the target meta-learning model is trained using the method in claim 1.
7. The method according to claim 6, characterized in that, The step of inputting the second image into the target meta-learning model for recognition to obtain text information corresponding to the first image includes: Obtain the font information of the text corresponding to the second image; If the text corresponding to the second image belongs to a preset text set, perform structural analysis on the text corresponding to the second image to obtain the third image; The third image and the font information are input into the target meta-learning model for recognition to obtain the text information corresponding to the first image.
8. A model training device, characterized in that, include: A set acquisition unit is used to acquire a training sample set and a test sample set, wherein the training sample set includes at least one randomly selected training sample subset, and the training sample subset includes at least one handwritten text sample. The parameter initialization unit is used to randomly initialize the model parameters of the first-order learning model to obtain the initial meta-learning model. The parameter update unit is used to update the first model parameters in the initial meta-learning model using a first subset of training samples in the training sample set to obtain a second meta-learning model with second model parameters, wherein the first subset of training samples is any subset of training samples in the training sample set; The score acquisition unit is used to validate the second gram learning model using any subset of test samples in the test sample set, and to obtain the reward mechanism score corresponding to any subset of test samples. The parameter update unit is further configured to update the second model parameters using the reward mechanism score corresponding to any subset of the test samples to obtain the third model parameters; The model acquisition unit is used to iteratively update the second meta-learning model according to the third model parameters and the second training sample subset until the second meta-learning model meets the model validation conditions to obtain the target meta-learning model, wherein the second training sample subset is any training sample subset in the training sample set other than the first training sample subset.
9. An image recognition device, characterized in that, include: An image acquisition unit is used to acquire a first image, wherein the first image includes handwritten text; The image processing unit is used to perform multi-level single-character horizontal and vertical segmentation processing on the first image to obtain the second image; An information acquisition unit is used to input the second image into a target meta-learning model for recognition, thereby obtaining text information corresponding to the first image, wherein the target meta-learning model is trained using the method in claim 1.
10. A network-side device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the model training method as described in any one of claims 1 to 5 or the image recognition method as described in any one of claims 6 to 7.
11. A storage medium, wherein when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the model training method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Generation method and intrusion detection method for intrusion recognition model and the intrusion recognition model
CN113869428A
Small sample target detection method based on multi-view learning and meta-learning
CN114119966A