CN111191791B - Picture classification method, device and equipment based on machine learning model - Google Patents

Picture classification method, device and equipment based on machine learning model Download PDF

Info

Publication number
CN111191791B
CN111191791B CN201911213128.5A CN201911213128A CN111191791B CN 111191791 B CN111191791 B CN 111191791B CN 201911213128 A CN201911213128 A CN 201911213128A CN 111191791 B CN111191791 B CN 111191791B
Authority
CN
China
Prior art keywords
machine learning
learning model
task
current task
sample data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911213128.5A
Other languages
Chinese (zh)
Other versions
CN111191791A (en
Inventor
杨元弢
蓝利君
李超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Cloud Computing Beijing Co Ltd
Original Assignee
Tencent Cloud Computing Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Cloud Computing Beijing Co Ltd filed Critical Tencent Cloud Computing Beijing Co Ltd
Priority to CN201911213128.5A priority Critical patent/CN111191791B/en
Publication of CN111191791A publication Critical patent/CN111191791A/en
Application granted granted Critical
Publication of CN111191791B publication Critical patent/CN111191791B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Abstract

The application provides a picture classification method, device and equipment based on a machine learning model, and relates to the technical field of artificial intelligence. The method comprises the following steps: determining the correlation between the current task and the historical task; sampling the sample data of the historical task according to the correlation to obtain metadata sample data; performing online meta-learning training on the initial machine learning model by adopting meta-sample data to obtain a trained machine learning model; and adjusting parameters of the trained machine learning model by adopting sample data of the current task to obtain the machine learning model suitable for the current task. On one hand, the application realizes the data augmentation of the training sample of the current task; on the other hand, when sample data is extracted from the historical task, correlation between the current task and the historical task is fully considered, so that the online element learning process is more robust to the current task, and the prediction accuracy of the model on the current task is improved.

Description

Picture classification method, device and equipment based on machine learning model
Technical Field
The embodiment of the application relates to the technical field of artificial intelligence, in particular to a picture classification method, device and equipment based on a machine learning model.
Background
With the development of artificial intelligence technology, machine learning is also widely used.
The traditional machine learning algorithm is established under two important preconditions, namely (1) training samples and test samples are independently and uniformly distributed, and (2) a large amount of labeling data can be obtained. However, in some business scenarios (e.g., user default predictions in financial wind control scenarios), there are the following features: (1) The task characteristics change along with time, and the task at the new moment cannot directly use the model of the old task; (2) Each task has only a small amount of marked data, and most of data needing to be predicted is unmarked; (3) The scenes of different tasks are quite different, and the sample distribution is quite different.
Therefore, the traditional machine learning algorithm trained based on a large amount of annotation data is difficult to directly apply to the service scene, and an accurate and reliable machine learning model cannot be provided for the service scene.
Disclosure of Invention
The embodiment of the application provides a picture classification method, device and equipment based on a machine learning model. The technical scheme provided by the application is as follows:
in one aspect, an embodiment of the present application provides a method for applying a machine learning model, where the method includes:
Obtaining a prediction sample of a current task;
invoking a machine learning model applicable to the current task;
outputting a prediction result corresponding to the prediction sample through the machine learning model;
the machine learning model is obtained by sampling meta-sample data from sample data of the historical task according to the correlation between the current task and the historical task and then training the meta-sample data and the sample data of the current task.
In another aspect, an embodiment of the present application provides a training method of a machine learning model, where the method includes:
determining the correlation between the current task and the historical task;
sampling the sample data of the historical task according to the correlation to obtain metadata sample data;
performing online element learning training on the initial machine learning model by adopting the element sample data to obtain a trained machine learning model;
and adjusting parameters of the trained machine learning model by adopting sample data of the current task to obtain the machine learning model suitable for the current task.
In another aspect, an embodiment of the present application provides an apparatus for applying a machine learning model, where the apparatus includes:
The sample acquisition module is used for acquiring a prediction sample of the current task;
the model calling module is used for calling a machine learning model applicable to the current task;
the result output module is used for outputting a prediction result corresponding to the prediction sample through the machine learning model;
the machine learning model is obtained by sampling meta-sample data from sample data of the historical task according to the correlation between the current task and the historical task and then training the meta-sample data and the sample data of the current task.
In another aspect, an embodiment of the present application provides a training apparatus for a machine learning model, including:
the correlation determination module is used for determining the correlation between the current task and the historical task;
the sample sampling module is used for sampling the sample data of the historical task according to the correlation to obtain metadata sample data;
the model training module is used for carrying out online element learning training on the initial machine learning model by adopting the element sample data to obtain a trained machine learning model;
and the parameter adjustment module is used for adjusting the parameters of the trained machine learning model by adopting the sample data of the current task to obtain the machine learning model suitable for the current task.
In yet another aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor and a memory, where at least one instruction, at least one program, a code set, or an instruction set is stored in the memory, where the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement an application method of the machine learning model, or implement a training method of the machine learning model.
In still another aspect, an embodiment of the present application provides a computer readable storage medium, where at least one instruction, at least one program, a code set, or an instruction set is stored, where the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement an application method of the machine learning model, or implement a training method of the machine learning model.
In yet another aspect, an embodiment of the present application provides a computer program product for implementing an application method of the machine learning model or implementing a training method of the machine learning model when the computer program product is executed by a processor.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
acquiring metadata sample data from historical tasks by determining the correlation between the current task and the historical tasks according to the correlation, and performing model training by adopting the metadata sample data and the sample data of the current task to finally obtain a machine learning model applicable to the current task; on one hand, sample data is extracted from the historical task and used as a training sample of the current task, so that the data amplification of the training sample of the current task is realized; on the other hand, when sample data is extracted from the historical task, correlation between the current task and the historical task is fully considered, so that the online element learning process is more robust to the current task, and the prediction accuracy of a model obtained through final training on the current task is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method of training a machine learning model provided by one embodiment of the present application;
FIG. 2 is a schematic diagram of an embodiment of the present application;
FIG. 3 shows a schematic diagram of a rainbow handwritten digital data set;
FIG. 4 shows a schematic diagram of classification task data;
FIG. 5 is a schematic diagram showing an experimental accuracy statistic;
FIG. 6 shows a schematic diagram of experimentally derived attention components;
FIG. 7 is a flow chart of a method of applying a machine learning model provided by one embodiment of the present application;
FIG. 8 is a block diagram of a training apparatus for a machine learning model provided by one embodiment of the present application;
FIG. 9 is a block diagram of a training apparatus for a machine learning model provided by another embodiment of the present application;
FIG. 10 is a block diagram of an apparatus for applying a machine learning model provided by one embodiment of the present application;
fig. 11 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail with reference to the accompanying drawings.
Artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use the knowledge to obtain optimal results. In other words, artificial intelligence is an integrated technology of computer science that attempts to understand the essence of intelligence and to produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence, i.e. research on design principles and implementation methods of various intelligent machines, enables the machines to have functions of sensing, reasoning and decision.
The artificial intelligence technology is a comprehensive subject, and relates to the technology with wide fields, namely the technology with a hardware level and the technology with a software level. Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
Machine Learning (ML) is a multi-domain interdisciplinary, involving multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is specially studied how a computer simulates or implements learning behavior of a human to acquire new knowledge or skills, and reorganizes existing knowledge structures to continuously improve own performance. Machine learning is the core of artificial intelligence, a fundamental approach to letting computers have intelligence, which is applied throughout various areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, confidence networks, reinforcement learning, transfer learning, induction learning, teaching learning, and the like.
With research and advancement of artificial intelligence technology, research and application of artificial intelligence technology is being developed in various fields, such as common smart home, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned, automatic driving, unmanned aerial vehicles, robots, smart medical treatment, smart customer service, etc., and it is believed that with the development of technology, artificial intelligence technology will be applied in more fields and with increasing importance value.
The scheme provided by the embodiment of the application relates to the technology of artificial intelligence such as machine learning. Before describing embodiments of the present application, some terms involved in the embodiments of the present application will be described first.
1. Task (task)
The machine learning task comprises a training set and a testing set, and aims to find a proper method and learn a distribution rule under limited annotation data so as to predict other data under the same condition.
2. Online learning (Online Machine Learning)
A machine learning method for updating a model in real time and predicting data input in time sequence.
3. Attention mechanism (Attention Mechanism)
A calculation method for calculating correlation in machine learning is inspired by human visual attention, and can enable a neural network to have screening capability on input data.
The attention mechanism is derived from the inspiration of human visual research, when a human is cognizing a surrounding scene, a local target area is selectively focused, the information of the target area is given a larger degree of attention, more visual information processing resources are input, and therefore useful information is obtained more efficiently, and unimportant information is restrained. The human attention mechanism fully utilizes limited thinking resources, and greatly improves the accuracy and efficiency of cognition.
Inspired by this, the attention mechanism is introduced into the field of deep learning, and becomes a very effective computing mechanism. The introduction of the attention mechanism enables the neural network to have the capability of screening input data, and can adaptively screen out more favorable input to a final target, thereby increasing favorable data, inhibiting the input of unfavorable data and improving the performance of a model. Essentially, the attention mechanism is a measure of similarity achieved by a key-value query.
Attention mechanisms are classified into a variety of different forms, namely hard attention and soft attention according to a screening mode of data, and classified into point-multiplying attention and perceptron attention according to a calculation mode of weight. At present, attention mechanisms have been widely used in fields of natural language processing, image description and the like by virtue of their simple forms and remarkable effects.
4. Yuan Learning (Meta Learning)
Meta learning may also be referred to as "learning to learn", i.e., solving the problem of how to learn. The traditional machine learning problem is to learn a mathematical model for prediction from scratch based on a massive dataset, which is far from the process of human learning, accumulating historical experience (also called meta knowledge), and guiding new machine learning tasks. Meta learning is a learning training process for learning different machine learning tasks, and how to learn how to train a mathematical model faster and better.
5. Online element learning (Online Meta Learning)
On-line element learning is a machine learning model training method commonly used in the industry, and mainly solves the problem that a model is updated and data is processed at each time node under the condition that training samples are provided according to time sequence. Corresponding to online element learning is the usual batch learning, i.e. training together the entire training data set, to obtain an optimized model. Compared with batch learning, the online element learning updating method does not need to traverse the whole data set, greatly shortens the time and the calculation cost of calculation, and can be more efficiently adapted to the requirements of new tasks.
Common online element learning algorithms are bayesian online element learning (Bayesian Online Learning) and follow regularization leadership (Follow The Regularized Leader, FTRL), etc.
The idea of FTRL is to find a parameter w that minimizes the sum of previous task loss functions f each time an update is made t I.e. formula 1. However, it is difficult to directly solve the parameter, and thus, a proxy loss function h is found, and the optimal solution of the proxy function is taken as the approximate solution at the current moment, i.e., equation 2. To ensure the validity of the solution, the loss difference between the solution obtained and the true solution is defined as reglet (equation 3), which should satisfy equation 4.FTRL is then used to solve the parameter w t When regularization term R (w) is added, so that the solution is sparse, namely
Formula 6.
w t =argmin w h t-1 (w) 2
FTML (Follow The Meta Leader, following meta-leadership) is an algorithm integrating meta-learning and online learning, and the core idea is that meta-learning and online learning can both use knowledge of previous tasks to help learning of subsequent tasks, but meta-learning does not consider the problem of variation of task input sequence and distribution, and online learning provides a framework for processing task flows. Therefore, the method introduces a meta learning method MAML (Model-agnostic Meta Learning, model-independent meta learning) into an online learning algorithm FTRL, the optimized parameter w is an initialization parameter of the network, and then a mapping U is performed on the task at the current moment t (e.g., one-step gradient descent, equation 7) to make it more task-specific, its reglet (reglet) calculation method is as in equation 8.
Here, t in the above equations 1 to 8 represents a task time, and α in the equation 7 is a predetermined constant.
The online element learning algorithm mainly considers and solves the problems that data is input according to time sequence and a model is updated in real time, and a training data set is not selectively established aiming at the relation between a new task and a previous task, so that an old task with larger distribution difference with the new task is also applied to model updating, and the training effect is difficult to promote and even negative optimization is caused.
The attention mechanism is mainly used in deep learning networks in the fields of natural language processing, computer vision and the like, is used as a module for filtering input data by the network, and is not applied to the sampling process in online element learning.
Aiming at the technical problems mentioned in the background art section, the embodiment of the application provides a technical scheme which can be called an online meta-learning method based on task correlation sampling, the correlation between a current task and a historical task is calculated through an attention mechanism, sample data of the historical task is sampled according to the correlation to form a new meta-task, the meta-task is utilized to carry out online meta-learning training, and finally the current task is utilized to carry out adaptive updating on a model. Aiming at the characteristics of the service scene, the method fully utilizes the data of the existing task, reduces the training sample size required by reaching the optimal model, improves the generalization performance of the new task model and reduces the time of training the new task.
The technical scheme provided by the embodiment of the application can be applied to the field of machine learning in which data are sequentially input according to time sequence. If under the financial wind control scene, according to the task input of the client group at different moments, based on the correlation between the current task and the historical task, sampling the component meta-sample data to train the model, and then adopting the sample data of the current task to adaptively update the model, the prediction model of the client group which can adapt to the current task can be quickly and effectively obtained. The technical scheme of the application can be suitable for various financial wind control scenes, such as predicting the fraud risk of the user in the links of financial business such as payment, lending, financing and the like, helping financial enterprises such as banks, securities, mutual funds and the like to improve the risk identification capability and reduce the enterprise loss. In addition, the technical scheme of the application can be also applied to the fields of content recommendation, computer vision processing and the like.
The technical scheme of the application is described in detail through several embodiments.
Referring to fig. 1, a flowchart of a training method of a machine learning model according to an embodiment of the application is shown. The subject of execution of the steps of the method may be a computer device, which refers to an electronic device with processing and storage capabilities, such as a PC (Personal Computer ), server, etc. The method may comprise the following steps (101-104):
Step 101, determining the correlation between the current task and the historical task.
The correlation between the current task and the historical task refers to the degree of correlation between the task characteristics of the current task and the historical task. The task characteristics of a task can be reflected by the characteristic information of the task, which is a characteristic of the task with a distinction, and the difference between two different tasks can be seen from the characteristic information of the two tasks.
The number of history tasks may be one or a plurality of history tasks. When the number of history tasks is plural, it is necessary to determine the correlation between the current task and each history task. When the number of historical tasks is a plurality, metadata sample data for training a model can be sampled from sample data of the plurality of tasks, so that sources of the sample data are enriched.
Optionally, the correlation between the current task and the historical task is determined by an attention mechanism, and this step may include the following sub-steps:
1. and respectively extracting the characteristics of the sample data of the current task and the sample data of n historical tasks to obtain the characteristic information of the current task and the characteristic information of each historical task, wherein n is a positive integer.
And respectively carrying out feature extraction on the sample data of the current task and the sample data of the n historical tasks by adopting a feature extractor to obtain feature information of the current task and feature information of each historical task. The feature extractor is used for extracting features of the sample data of the task, mapping the sample data of the task to a certain feature space, and obtaining a low-dimensional representation of the task with differentiation (namely, feature information of the task). The feature extractor may be a convolutional neural network, which may include, for example, 4 convolutional layers and 1 fully-connected layer. Of course, the above description of the network architecture design of the feature extractor is merely exemplary and illustrative, and may be designed in connection with actual situations, which the embodiments of the present application are not limited to.
2. And calculating the attention vector according to the characteristic information of the current task and the characteristic information of each historical task through the attention network.
The attention network may include a first attention network and a second attention network. And outputting a query vector corresponding to the current task through the first attention network according to the characteristic information of the current task. The first attention network may be a single layer fully connected network. And outputting key value matrixes corresponding to the n historical tasks through the second attention network according to the characteristic information of each historical task. The second attention network may also be a single layer fully connected network. Then, an attention vector is calculated from the query vector and the key value matrix. For example, after performing a dot product operation on each component of the query vector and the key value matrix, an attention vector is obtained through an activation function layer. The activation function employed by the activation function layer may be a softmax activation function. The attention vector may be a 1×n row vector or an n×1 column vector. The attention vector includes n attention components, and the ith attention component is used for representing the correlation between the current task and the ith historical task, wherein i is a positive integer less than or equal to n.
For example, assuming that the number n of history tasks is 5, the attention vector calculated through the above procedure is [0.1,0.25,0.2,0.3,0.15], which means that the correlation between the current task and the 1 st history task is 0.1, the correlation between the current task and the 2 nd history task is 0.25, the correlation between the current task and the 3 rd history task is 0.2, the correlation between the current task and the 4 th history task is 0.3, and the correlation between the current task and the 5 th history task is 0.15.
It should be noted that, in determining the correlation between the current task and the historical task, other correlation calculation manners, such as pearson correlation coefficient, maximum mutual information coefficient (Maximal Information Coefficient, MIC), distance correlation coefficient, etc., may be used in addition to the attention mechanism described above, which is not limited in the embodiment of the present application.
And 102, sampling the sample data of the historical task according to the correlation to obtain metadata sample data.
After obtaining the correlation of the current task relative to each historical task, based on the correlation, respectively extracting a plurality of sample data from the sample data of each historical task to form metadata sample data of the current task.
Optionally, sampling sample data of n historical tasks according to the n attention components to obtain meta-sample data; wherein the ratio between the numbers of sample data sampled from the sample data of each history task is the same as the ratio between the n attention components. For example, the attention vector is [0.1,0.25,0.2,0.3,0.15], and 100 pieces of sample data are required to be extracted from the history task in total as meta-sample data, then 10 pieces of sample data are extracted from the 1 st history task, 25 pieces of sample data are extracted from the 2 nd history task, 20 pieces of sample data are extracted from the 3 rd history task, 30 pieces of sample data are extracted from the 4 th history task, 15 pieces of sample data are extracted from the 5 th history task, and a meta-sample data set is obtained by extracting 100 pieces of sample data in total.
And 103, performing online element learning training on the initial machine learning model by adopting the element sample data to obtain a trained machine learning model.
The initial machine learning model may be a model that has not been trained, e.g., parameters of the initial machine learning model may be set randomly or empirically; alternatively, the initial machine learning model may be a trained model, for example, the initial machine learning model may be a machine learning model that is suitable for a most recent historical task.
In the embodiment of the application, the initial machine learning model is trained by adopting an online element learning mode, and a trained machine learning model is obtained. Alternatively, this step may comprise the following sub-steps:
1. generating a training sample set according to the metadata sample data;
for example, a portion of sample data may be selected from the meta-sample data to form a training sample set. Optionally, the ratio between the number of sample data from each history task contained in the training sample set is the same as the ratio between the n attention components in the above-described attention vector.
Still taking the above example as an example, the metadata includes 100 pieces of sample data, the number of sample data extracted from the 1 st to 5 th history tasks is 10, 25, 20, 30 and 15 in order, if 60 pieces of sample data are required to be selected from the above metadata to constitute a training sample set, the number of sample data from the 1 st to 5 th history tasks included in the training sample set may be 6, 15, 12, 18 and 9 in order, that is, 6 pieces of sample data are selected from 10 pieces of sample data from the 1 st history task to be added to the training sample set, 15 pieces of sample data are selected from 25 pieces of sample data from the 2 nd history task to be added to the training sample set, 12 pieces of sample data are selected from 20 pieces of sample data from the 3 rd history task to be added to the training sample set, 18 pieces of sample data are selected from 30 pieces of sample data from the 4 th history task to be added to the training sample set, and 9 pieces of sample data are selected from 15 pieces of sample data from the 5 th history task to be added to the training sample set.
2. Training parameters of a machine learning model in batches by adopting a training sample set;
after the training sample set is constructed and generated, the training sample set can be used for training the machine learning model, and the performance of the machine learning model is optimized by continuously adjusting the parameters of the machine learning model.
Optionally, the machine learning model is trained in a batch-wise (batch) training mode. Batch training helps to improve training efficiency of the model.
3. Calculating a first loss function value of the machine learning model;
assuming that the loss function of the machine learning model is a first loss function in the training process of the step, the value of the first loss function can be calculated based on the prediction result of the machine learning model on the training sample and the label of the training sample, so as to obtain a first loss function value.
4. When the first loss function value meets a first condition, calculating a first gradient corresponding to an initial parameter of the machine learning model according to the first loss function value;
the first condition may be preset, for example, the first condition may be that the first loss function value is minimized. And when the first loss function value meets a first condition, calculating a first gradient corresponding to the initial parameter of the machine learning model according to the first loss function value. The initial parameters of the machine learning model are parameters of the initial machine learning model.
5. And updating initial parameters of the machine learning model according to the first gradient to obtain a trained machine learning model.
For example, based on the first gradient and initial parameters of the machine learning model, updated parameters of the machine learning model are calculated, resulting in a trained machine learning model.
In addition, a test sample set can be generated according to the metadata sample data, and the accuracy of the trained machine learning model can be evaluated by adopting the test sample set. If the accuracy of the trained machine learning model does not meet the conditions, the training sample can be selected again from the training sample set to train the machine learning model, and the next flow is entered until the accuracy of the trained machine learning model meets the conditions.
In the embodiment of the application, the sample data is extracted from the historical task and is used as the training sample of the current task, so that the data augmentation of the training sample of the current task is realized. In addition, the correlation between the current task and the historical task is fully considered when the sample data is extracted from the historical task, so that the online element learning process is more robust for the current task.
And 104, adjusting parameters of the trained machine learning model by adopting sample data of the current task to obtain the machine learning model suitable for the current task.
After the initial machine learning model is trained by adopting metadata sample data to obtain a trained machine learning model, the parameters of the trained machine learning model are further finely adjusted by adopting sample data of a current task, so that the machine learning model finally obtained by training has better performance on the current task.
Alternatively, this step may comprise the following sub-steps:
1. calculating a second loss function value of the trained machine learning model according to sample data of the current task;
assuming that the loss function of the machine learning model is a second loss function in the training process of the step, the value of the second loss function can be calculated based on the prediction result of the machine learning model on the sample data of the current task and the label of the sample data, and then the second loss function value is obtained.
2. When the second loss function value meets a second condition, calculating a second gradient corresponding to the parameters of the trained machine learning model according to the second loss function value;
The second condition may be preset, for example, the second condition may be that the second loss function value is minimized. And when the second loss function value meets a second condition, calculating a second gradient corresponding to the parameters of the trained machine learning model according to the second loss function value.
3. And updating parameters of the trained machine learning model according to the second gradient to obtain the machine learning model suitable for the current task.
For example, based on the second gradient and the original parameters of the trained machine learning model, updated parameters of the machine learning model are calculated, thereby obtaining a machine learning model suitable for the current task.
In summary, according to the technical scheme provided by the embodiment of the application, through determining the correlation between the current task and the historical task, sampling and obtaining metadata sample data from the historical task according to the correlation, and then performing model training by adopting the metadata sample data and the sample data of the current task, finally obtaining a machine learning model suitable for the current task; on one hand, sample data is extracted from the historical task and used as a training sample of the current task, so that the data amplification of the training sample of the current task is realized; on the other hand, when sample data is extracted from the historical task, correlation between the current task and the historical task is fully considered, so that the online element learning process is more robust to the current task, and the prediction accuracy of a model obtained through final training on the current task is improved.
Referring in conjunction to fig. 2, an architecture diagram of the present application is shown, including a feature extractor 21, an attention module 22, a sampler 23, and a meta classifier 24.
The feature extractor (Feature Extractor) 21: denoted by F, the network weight corresponding to the time of the t-th task isFor tasks T at various moments t Sample data D of (2) t Feature extraction is performed and sample data of the task is mapped to a certain feature space to obtain a low-dimensional representation of the task with differentiation, i.e. feature information r of the task t
Attention Module (Attention Module) 22: represented by A, the network weight corresponding to the time of the t-th task is alpha t . Characteristic information r for different tasks t Calculating an attention vector a between a current task and a historical task t
Sampler (Sampler) 23: according to the attention vector a t The attention components of the history task are sampled to form new metadata sample data D meta
Meta Classifier (Meta Classifier) 24: denoted by G, the network weight corresponding to the time of the t-th task is θ t . Learning parameters of classifier suitable for current task by on-line element learning algorithm and combining sample of current taskThe data is used for adaptively updating the parameters, and finally, the classifier applicable to the current task is obtained.
Referring to fig. 2 in combination, after obtaining the current task, the sample data of the current task and the sample data of each history task are respectively input to the feature extractor 21 for feature extraction, so as to obtain feature information of the current task and feature information of each history task. After the feature information of the current task and the feature information of each historical task are input to the attention module 22, the feature information of the current task obtains a query vector Q corresponding to the current task through a first attention network (e.g., full connection layer linear Q), and the feature information of each historical task obtains a key value matrix K corresponding to the historical task through a second attention network (e.g., full connection layer linear K). After each component of the query vector Q and the key value matrix K is subjected to dot multiplication operation, an attention vector a is obtained through an activation function layer (such as a softmax layer). Sampling the sample data of the history task according to the attention vector a by a sampler 23 to obtain meta-sample data D meta . Thereafter, the metadata D may be based on meta Generating training sample set D train And test sample set D test Employing training sample set D train Training parameters θ of meta-classifier 24 in batches using test sample set D test The updated parameter θ is evaluated to minimize the total loss. Then, the initial parameters of the meta classifier 24 are graded, and the initial parameters of the meta classifier 24 are updated according to the gradient, so that the trained meta classifier 24 is obtained. Finally, the parameters of the trained meta-classifier 24 are finely tuned by adopting the characteristic data of the current task, and finally the meta-classifier 24 suitable for the current task is obtained.
In an exemplary embodiment, the training procedure may include the following steps:
step 1, randomly initializing parameters of a feature extractorParameter alpha of attention module 0 Parameter θ of meta classifier 0
Step 2, initializing an empty task pool B, namely B≡;
step 3, for each sequential task input time t, performing the following operations from step 4 to step 11;
step 4, task T t Adding the mixture into a task pool B, B≡ B < T + > t ];
Step 5, for all tasks T in the task pool 1 ,T 2 ,…,T t The sample data of the task is obtained by a feature extractor F consisting of 4 layers of convolution layers and 1 layer of fully connected network 1 ,r 2 ,…,r t I.e.
Step 6, according to the characteristic information r of the task 1 ,r 2 ,…,r t Via an attention module comprising two single-layer fully connected networks r t And r 1 ,r 2 ,…,r t-1 Is respectively converted into a query vector Q and a key value matrix K, and each component of the query vector Q and the key value matrix K is subjected to dot multiplication operation to obtain a task T through a softmax layer t With each history task T 1 ,T 2 ,…,T t-1 Attention vector a of (a) t I.e. a t =A(r t ,R|α t );
Step 7, using the attention vector a t Each component is taken as weight to the historical task T 1 ,T 2 ,…,T t-1 Is extracted to form metadata sample data D meta
Step 8, meta-sample data D meta Divided into disjoint training sample sets D train And test sample set D test In training sample set D train The training samples are extracted from the upper batch, the optimized parameters theta' on each batch (batch) are calculated by using the method 9, and then the parameters theta of the meta-classifier G are calculated by using the method 10 t
Wherein L (·) is a classification loss function, and α and β are predetermined constants;
step 9, using the current task T t Sample data D of (2) t As input, a classification loss L on the meta classifier G is calculated based on 11 update
Step 10, calculating gradient and updating meta-classifier G at current task T based on 12 t Adaptive network weights on the current task T are obtained t Classifier G (θ' t );
Step 11, updating the system state, taking the parameter at the current moment as the initial parameter of the task at the next moment, namely
The traditional online element learning method cannot consider the relation between the current task and the historical task, is easy to be trapped into the overfitting of the current task, and in some business scenes, each task has a considerable degree of correlation, and if the relation between the tasks cannot be fully considered, the performance of the model is limited. Aiming at the problem, the technical scheme provided by the embodiment of the application has the following advantages: 1) The correlation between the current task and the historical task is established through an attention mechanism, the most suitable correlation calculation parameters are optimized according to the final model performance, and knowledge of the historical task is fully utilized to help training of the current task; 2) Through the online element learning mode, the method is fully suitable for the service scene, and can be quickly combined with the prior task unfolding training when a new task is obtained, so that the model is quickly suitable for the distribution of the new task, and the effects of real-time training and real-time prediction are achieved.
In order to objectively verify the effectiveness of the technical scheme of the application, quantitatively evaluate the algorithm performance, and compare with other online meta-learning algorithms on a multi-task data set through experiments.
The experiment selects a Rainbow handwriting digital data set (Rainbow-Mnist), mnist (Mixed National Institute of Standards and Technology database) is a large handwriting digital database collected and arranged by national institute of standards and technology, and comprises a training set of 60000 examples and a test set of 10000 examples, as shown in fig. 3.
On this basis, three kinds of transformation combinations are respectively performed on each sample, namely 7 different background colors are changed, 4 different rotation angles are changed, 2 different sizes of characters are changed, and 56 different classification task data sets are combined in total, as shown in fig. 4. In fig. 4, different background colors are represented in different gray scales, for example, the different background colors may be red, yellow, blue, violet, green, orange, black, and so on.
In the experiment, it was assumed that 56 tasks were obtained in a random order. 900 non-repeated pictures are taken for each task, wherein 450 pictures are used as training sets and 450 pictures are used as test sets. The batch size (batch size) is set to 25 when the meta classifier is trained, the iteration times are 5, the MAML inner layer uses a gradient descent method to update parameters, the learning rate is 0.1, the outer layer uses an Adam optimizer, and the learning rate is 0.001. The model accuracy under each task is shown by the solid line 51 in fig. 5.
In order to embody the advantages of the technical scheme of the application, FTML is used as a reference experiment, and the experimental super parameters are the same as above. The model accuracy under each task is shown in dashed line 52 in fig. 5.
Experimental results show that the method provided by the application can obtain a better effect during training, and is 4 percent higher than the FTML on each task. According to experimental results, the attention module can effectively select a historical task similar to the current task during training, so that the aim of more adaptively training is fulfilled. As shown in fig. 6, taking the current task as the 17 th task (task number is 16) as an example, the attention component values of the current task calculated by the attention module with respect to each historical task (including the 1 st to 16 th historical tasks, i.e., the task numbers from 0 to 15).
In summary, the technical scheme of the application calculates the correlation between the current task and the historical task through the attention mechanism, samples based on the correlation, establishes the meta-task, and performs adaptive online meta-learning based on the meta-task, thereby effectively capturing the correlation between the tasks, fully screening and utilizing the effective data, and improving the final training effect; secondly, compared with the prior art, the technical scheme of the application can effectively reduce fluctuation in the training process and improve the confidence coefficient of the result.
Referring to fig. 7, a flowchart of a method for applying a machine learning model according to an embodiment of the application is shown. The main execution body of each step of the method can be computer equipment, wherein the computer equipment refers to electronic equipment with processing and storage capabilities, such as mobile phones, tablet computers, intelligent robots, PCs and other terminal equipment, servers and the like. The method may comprise the following steps (701-703):
step 701, obtaining a prediction sample of a current task;
step 702, invoking a machine learning model applicable to the current task;
step 703, outputting a prediction result corresponding to the prediction sample through a machine learning model;
the machine learning model is obtained by sampling metadata sample data from sample data of a historical task according to the correlation between the current task and the historical task and then training the metadata sample data and the sample data of the current task.
The training process of the machine learning model can be referred to the description in the above embodiments, and will not be repeated here. After training to obtain a machine learning model suitable for the current task, the machine learning model can be adopted to predict a prediction sample of the current task to obtain a corresponding prediction result.
In different business scenarios, the prediction samples and corresponding prediction results of the machine learning model may be different. For example, in the prediction of user violations in a financial wind control scenario, the prediction sample may include user information of a certain target user, such as age, gender, social information, credit information, and the like, and the corresponding prediction result may be whether the target user is a potentially violating user. For another example, in a video recommendation scenario, the prediction sample may include user information of a target user, such as age, gender, region, hobbies, network historical behavior information, and the corresponding prediction result may be a video classification recommended to the target user.
In summary, according to the technical scheme provided by the embodiment of the application, the correlation between the current task and the historical task is determined through the attention mechanism, the meta-sample data is sampled from the historical task according to the correlation, then model training is carried out by adopting the meta-sample data and the sample data of the current task, and finally, a machine learning model suitable for the current task is obtained; on one hand, sample data is extracted from the historical task and used as a training sample of the current task, so that the data amplification of the training sample of the current task is realized; on the other hand, when sample data is extracted from the historical task, correlation between the current task and the historical task is fully considered, so that the online element learning process is more robust to the current task, and the prediction accuracy of a model obtained through final training on the current task is improved.
The following are examples of the apparatus of the present application that may be used to perform the method embodiments of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method of the present application.
Referring to fig. 8, a block diagram of a training apparatus for a machine learning model according to an embodiment of the present application is shown. The device has the function of realizing the training method example, and the function can be realized by hardware or can be realized by executing corresponding software by hardware. The apparatus may be the computer device described above or may be provided in a computer device. The apparatus 800 may include: correlation determination module 810, sample sampling module 820, model training module 830, and parameter adjustment module 840.
The relevance determining module 810 is configured to determine relevance between the current task and the historical task.
And the sample sampling module 820 is used for sampling the sample data of the historical task according to the correlation to obtain metadata sample data.
The model training module 830 is configured to perform online meta-learning training on the initial machine learning model by using the meta-sample data, so as to obtain a trained machine learning model.
And the parameter adjustment module 840 is configured to adjust parameters of the trained machine learning model by using the sample data of the current task, so as to obtain a machine learning model applicable to the current task.
In an exemplary embodiment, as shown in fig. 9, the relevance determining module 810 includes a feature extraction unit 811 and an attention calculation unit 812.
And a feature extraction unit 811, configured to perform feature extraction on the sample data of the current task and the sample data of n historical tasks, to obtain feature information of the current task and feature information of each historical task, where n is a positive integer.
An attention calculating unit 812, configured to calculate an attention vector according to the feature information of the current task and the feature information of each of the historical tasks through an attention network. The attention vector comprises n attention components, the ith attention component is used for representing the correlation between the current task and the ith historical task, and i is a positive integer less than or equal to n.
In an exemplary embodiment, the attention calculating unit 812 is configured to:
outputting a query vector corresponding to the current task through a first attention network according to the characteristic information of the current task;
outputting key value matrixes corresponding to the n historical tasks through a second attention network according to the characteristic information of each historical task;
And calculating the attention vector according to the query vector and the key value matrix.
In an exemplary embodiment, the sample sampling module 820 is configured to:
sampling the sample data of the n historical tasks according to the n attention components to obtain the meta-sample data;
wherein a ratio between the number of sample data sampled from the sample data of each of the history tasks is the same as a ratio between the n attention components.
In an exemplary embodiment, the model training module 830 is configured to:
generating a training sample set according to the metadata sample data;
training parameters of the machine learning model in batches by adopting the training sample set;
calculating a first loss function value for the machine learning model;
when the first loss function value meets a first condition, calculating a first gradient corresponding to an initial parameter of the machine learning model according to the first loss function value;
and updating initial parameters of the machine learning model according to the first gradient to obtain the trained machine learning model.
In an exemplary embodiment, the parameter adjustment module 840 is configured to:
Calculating a second loss function value of the trained machine learning model according to the sample data of the current task;
when the second loss function value meets a second condition, calculating a second gradient corresponding to the parameters of the trained machine learning model according to the second loss function value;
and updating parameters of the trained machine learning model according to the second gradient to obtain the machine learning model applicable to the current task.
In summary, according to the technical scheme provided by the embodiment of the application, the correlation between the current task and the historical task is determined through the attention mechanism, the meta-sample data is sampled from the historical task according to the correlation, then model training is carried out by adopting the meta-sample data and the sample data of the current task, and finally, a machine learning model suitable for the current task is obtained; on one hand, sample data is extracted from the historical task and used as a training sample of the current task, so that the data amplification of the training sample of the current task is realized; on the other hand, when sample data is extracted from the historical task, correlation between the current task and the historical task is fully considered, so that the online element learning process is more robust to the current task, and the prediction accuracy of a model obtained through final training on the current task is improved.
Referring to fig. 10, a block diagram of an apparatus for applying a machine learning model according to an embodiment of the present application is shown. The device has the function of realizing the application method example, and the function can be realized by hardware or can be realized by executing corresponding software by hardware. The apparatus may be the computer device described above or may be provided in a computer device. The apparatus 1000 may include: a sample acquisition module 1010, a model invocation module 1020, and a result output module 1030.
A sample acquisition module 1010, configured to acquire a prediction sample of a current task;
a model invoking module 1020 for invoking a machine learning model applicable to the current task;
and the result output module 1030 is configured to output, through the machine learning model, a prediction result corresponding to the prediction sample.
The machine learning model is obtained by sampling meta-sample data from sample data of the historical task according to the correlation between the current task and the historical task and then training the meta-sample data and the sample data of the current task.
In an exemplary embodiment, the training process of the machine learning model is as follows:
Determining a correlation between the current task and the historical task;
sampling the sample data of the historical task according to the correlation to obtain metadata sample data;
performing online element learning training on the initial machine learning model by adopting the element sample data to obtain a trained machine learning model;
and adjusting parameters of the trained machine learning model by adopting sample data of the current task to obtain the machine learning model suitable for the current task.
Other descriptions of the model training process can be found in the above embodiments, and are not repeated here.
In summary, according to the technical scheme provided by the embodiment of the application, the correlation between the current task and the historical task is determined through the attention mechanism, the meta-sample data is sampled from the historical task according to the correlation, then model training is carried out by adopting the meta-sample data and the sample data of the current task, and finally, a machine learning model suitable for the current task is obtained; on one hand, sample data is extracted from the historical task and used as a training sample of the current task, so that the data amplification of the training sample of the current task is realized; on the other hand, when sample data is extracted from the historical task, correlation between the current task and the historical task is fully considered, so that the online element learning process is more robust to the current task, and the prediction accuracy of a model obtained through final training on the current task is improved.
It should be noted that, in the apparatus provided in the foregoing embodiment, when implementing the functions thereof, only the division of the foregoing functional modules is used as an example, in practical application, the foregoing functional allocation may be implemented by different functional modules, that is, the internal structure of the device is divided into different functional modules, so as to implement all or part of the functions described above. In addition, the apparatus and the method embodiments provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the apparatus and the method embodiments are detailed in the method embodiments and are not repeated herein.
Referring to fig. 11, a schematic structural diagram of a computer device according to an embodiment of the application is shown. Specifically, the present application relates to a method for manufacturing a semiconductor device.
The computer apparatus 1100 includes a CPU (Central Processing Unit ) 1101, a system Memory 1104 including a RAM (Random Access Memory ) 1102 and a ROM (Read Only Memory) 1103, and a system bus 1105 connecting the system Memory 1104 and the central processing unit 1101. The computer device 1100 also includes a basic I/O (Input/Output) system 1106, which facilitates the transfer of information between various devices within the computer, and a mass storage device 1107 for storing an operating system 1113, application programs 1114, and other program modules 1115.
The basic input/output system 1106 includes a display 1108 for displaying information and an input device 1109, such as a mouse, keyboard, etc., for a user to input information. Wherein the display 1108 and the input device 1109 are both coupled to the central processing unit 1101 through an input-output controller 1110 coupled to the system bus 1105. The basic input/output system 1106 may also include an input/output controller 1110 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, the input output controller 1110 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 1107 is connected to the central processing unit 1101 through a mass storage controller (not shown) connected to the system bus 1105. The mass storage device 1107 and its associated computer-readable media provide non-volatile storage for the computer device 1100. That is, the mass storage device 1107 may include a computer-readable medium (not shown) such as a hard disk or CD-ROM (Compact Disc Read-Only Memory) drive.
The computer readable medium may include computer storage media and communication media without loss of generality. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read Only Memory) erasable programmable read-only memory), flash memory or other solid state memory technology, CD-ROM or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will recognize that the computer storage medium is not limited to the one described above. The system memory 1104 and mass storage device 1107 described above may be collectively referred to as memory.
The computer device 1100 may also operate in accordance with various embodiments of the present application, through a network, such as the internet, to remote computers connected to the network. I.e., the computer device 1100 may connect to the network 1112 through a network interface unit 1111 connected to the system bus 1105, or other types of networks or remote computer systems (not shown) may be connected using the network interface unit 1111.
The memory further includes at least one instruction, at least one program, code set, or instruction set stored in the memory and configured to be executed by one or more processors to implement the method of training the machine learning model or to implement the method of applying the machine learning model.
In an exemplary embodiment, a computer readable storage medium is also provided, in which at least one instruction, at least one program, a set of codes, or a set of instructions is stored, which when executed by a processor of a computer device, implement the training method of the machine learning model described above, or implement the application method of the machine learning model described above.
Alternatively, the computer-readable storage medium may include: ROM, RAM, SSD (Solid State Drives, solid state disk) or optical disk, etc. The random access memory may include ReRAM (Resistance Random Access Memory, resistive random access memory) and DRAM (Dynamic Random Access Memory ), among others.
In an exemplary embodiment, a computer program product is also provided, which, when being executed by a processor of a computer device, is adapted to implement the above-mentioned training method of the machine learning model or to implement the above-mentioned application method of the machine learning model.
It should be understood that references herein to "a plurality" are to two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. In addition, the step numbers described herein are merely exemplary of one possible execution sequence among steps, and in some other embodiments, the steps may be executed out of the order of numbers, such as two differently numbered steps being executed simultaneously, or two differently numbered steps being executed in an order opposite to that shown, which is not limiting.
The foregoing description of the exemplary embodiments of the application is not intended to limit the application to the particular embodiments disclosed, but on the contrary, the intention is to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the application.

Claims (10)

1. A method for classifying pictures based on a machine learning model, the method comprising:
obtaining a prediction sample of a current task, wherein the prediction sample comprises pictures to be classified;
outputting a prediction result corresponding to the prediction sample according to the prediction sample through a machine learning model suitable for the current task, wherein the prediction result is used for indicating a classification result of the picture to be classified;
the training process of the machine learning model applicable to the current task is as follows:
respectively extracting features of sample data of the current task and sample data of n historical tasks to obtain feature information of the current task and feature information of each historical task, wherein n is a positive integer;
calculating an attention vector through an attention network according to the characteristic information of the current task and the characteristic information of each historical task; wherein the attention vector includes n attention components, an i-th attention component of the n attention components being used to characterize a correlation between the current task and an i-th historical task of the n historical tasks, the i being a positive integer less than or equal to the n;
Sampling the sample data of the n historical tasks according to the n attention components to obtain metadata sample data; wherein a ratio between the numbers of sample data sampled from the sample data of the n history tasks is the same as a ratio between the n attention components;
performing online element learning training on the initial machine learning model by adopting the element sample data to obtain a trained machine learning model;
and adjusting parameters of the trained machine learning model by adopting sample data of the current task to obtain the machine learning model suitable for the current task.
2. The method of claim 1, wherein calculating, via an attention network, an attention vector from the characteristic information of the current task and the characteristic information of each of the historical tasks, comprises:
outputting a query vector corresponding to the current task through a first attention network according to the characteristic information of the current task;
outputting key value matrixes corresponding to the n historical tasks through a second attention network according to the characteristic information of each historical task;
and calculating the attention vector according to the query vector and the key value matrix.
3. The method according to claim 1 or 2, wherein the performing on-line meta-learning training on the initial machine learning model using the meta-sample data to obtain a trained machine learning model comprises:
generating a training sample set according to the metadata sample data;
training parameters of the machine learning model in batches by adopting the training sample set;
calculating a first loss function value for the machine learning model;
when the first loss function value meets a first condition, calculating a first gradient corresponding to an initial parameter of the machine learning model according to the first loss function value;
and updating initial parameters of the machine learning model according to the first gradient to obtain the trained machine learning model.
4. The method according to claim 1 or 2, wherein the adjusting parameters of the trained machine learning model using the sample data of the current task to obtain a machine learning model applicable to the current task comprises:
calculating a second loss function value of the trained machine learning model according to the sample data of the current task;
when the second loss function value meets a second condition, calculating a second gradient corresponding to the parameters of the trained machine learning model according to the second loss function value;
And updating parameters of the trained machine learning model according to the second gradient to obtain the machine learning model applicable to the current task.
5. A method of training a machine learning model for picture classification, the method comprising:
respectively extracting features of sample data of a current task and sample data of n historical tasks to obtain feature information of the current task and feature information of each historical task, wherein n is a positive integer;
calculating an attention vector through an attention network according to the characteristic information of the current task and the characteristic information of each historical task; wherein the attention vector includes n attention components, an i-th attention component of the n attention components being used to characterize a correlation between the current task and an i-th historical task of the n historical tasks, the i being a positive integer less than or equal to the n;
sampling the sample data of the n historical tasks according to the n attention components to obtain metadata sample data; wherein a ratio between the numbers of sample data sampled from the sample data of the n history tasks is the same as a ratio between the n attention components;
Performing online element learning training on the initial machine learning model by adopting the element sample data to obtain a trained machine learning model;
the parameters of the trained machine learning model are adjusted by adopting the sample data of the current task, so that a machine learning model applicable to the current task is obtained; the machine learning model applicable to the current task is used for outputting a prediction result corresponding to a prediction sample according to a picture to be classified contained in the prediction sample of the current task, and the prediction result is used for indicating a classification result of the picture to be classified.
6. The method of claim 5, wherein calculating, via an attention network, an attention vector from the characteristic information of the current task and the characteristic information of each of the historical tasks, comprises:
outputting a query vector corresponding to the current task through a first attention network according to the characteristic information of the current task;
outputting key value matrixes corresponding to the n historical tasks through a second attention network according to the characteristic information of each historical task;
and calculating the attention vector according to the query vector and the key value matrix.
7. A machine learning model-based picture classification apparatus, the apparatus comprising:
the sample acquisition module is used for acquiring a prediction sample of the current task, wherein the prediction sample comprises pictures to be classified;
the result output module is used for outputting a prediction result corresponding to the prediction sample according to the prediction sample through a machine learning model suitable for the current task, wherein the prediction result is used for indicating a classification result of the picture to be classified;
the training process of the machine learning model applicable to the current task is as follows:
respectively extracting features of sample data of the current task and sample data of n historical tasks to obtain feature information of the current task and feature information of each historical task, wherein n is a positive integer;
calculating an attention vector through an attention network according to the characteristic information of the current task and the characteristic information of each historical task; wherein the attention vector includes n attention components, an i-th attention component of the n attention components being used to characterize a correlation between the current task and an i-th historical task of the n historical tasks, the i being a positive integer less than or equal to the n;
Sampling the sample data of the n historical tasks according to the n attention components to obtain metadata sample data; wherein a ratio between the numbers of sample data sampled from the sample data of the n history tasks is the same as a ratio between the n attention components;
performing online element learning training on the initial machine learning model by adopting the element sample data to obtain a trained machine learning model;
and adjusting parameters of the trained machine learning model by adopting sample data of the current task to obtain the machine learning model suitable for the current task.
8. A training apparatus for machine learning models for picture classification, the apparatus comprising:
the relevance determining module is used for respectively extracting the characteristics of the sample data of the current task and the sample data of n historical tasks to obtain the characteristic information of the current task and the characteristic information of each historical task, wherein n is a positive integer; calculating an attention vector through an attention network according to the characteristic information of the current task and the characteristic information of each historical task; wherein the attention vector includes n attention components, an i-th attention component of the n attention components being used to characterize a correlation between the current task and an i-th historical task of the n historical tasks, the i being a positive integer less than or equal to the n;
The sample sampling module is used for sampling the sample data of the n historical tasks according to the n attention components to obtain metadata sample data; wherein a ratio between the numbers of sample data sampled from the sample data of the n history tasks is the same as a ratio between the n attention components;
the model training module is used for carrying out online element learning training on the initial machine learning model by adopting the element sample data to obtain a trained machine learning model;
the parameter adjustment module is used for adjusting parameters of the trained machine learning model by adopting sample data of the current task to obtain a machine learning model suitable for the current task; the machine learning model applicable to the current task is used for outputting a prediction result corresponding to a prediction sample according to a picture to be classified contained in the prediction sample of the current task, and the prediction result is used for indicating a classification result of the picture to be classified.
9. A computer device comprising a processor and a memory, wherein the memory has stored therein at least one program that is loaded and executed by the processor to implement the method of any one of claims 1 to 4 or to implement the method of any one of claims 5 to 6.
10. A computer readable storage medium, characterized in that at least one program is stored in the computer readable storage medium, which is loaded and executed by a processor to implement the method of any one of claims 1 to 4 or to implement the method of any one of claims 5 to 6.
CN201911213128.5A 2019-12-02 2019-12-02 Picture classification method, device and equipment based on machine learning model Active CN111191791B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911213128.5A CN111191791B (en) 2019-12-02 2019-12-02 Picture classification method, device and equipment based on machine learning model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911213128.5A CN111191791B (en) 2019-12-02 2019-12-02 Picture classification method, device and equipment based on machine learning model

Publications (2)

Publication Number Publication Date
CN111191791A CN111191791A (en) 2020-05-22
CN111191791B true CN111191791B (en) 2023-09-29

Family

ID=70709175

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911213128.5A Active CN111191791B (en) 2019-12-02 2019-12-02 Picture classification method, device and equipment based on machine learning model

Country Status (1)

Country Link
CN (1) CN111191791B (en)

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111813143B (en) * 2020-06-09 2022-04-19 天津大学 Underwater glider intelligent control system and method based on reinforcement learning
CN111931991A (en) * 2020-07-14 2020-11-13 上海眼控科技股份有限公司 Weather nowcast method, weather nowcast device, computer equipment and storage medium
CN111724083B (en) * 2020-07-21 2023-10-13 腾讯科技(深圳)有限公司 Training method and device for financial risk identification model, computer equipment and medium
CN111738355B (en) * 2020-07-22 2020-12-01 中国人民解放军国防科技大学 Image classification method and device with attention fused with mutual information and storage medium
CN113095440B (en) * 2020-09-01 2022-05-17 电子科技大学 Training data generation method based on metalearner and causal effect heterogeneous reaction difference estimation method
CN112085103B (en) * 2020-09-10 2023-06-27 北京百度网讯科技有限公司 Data enhancement method, device, equipment and storage medium based on historical behaviors
CN112069329B (en) * 2020-09-11 2024-03-15 腾讯科技(深圳)有限公司 Text corpus processing method, device, equipment and storage medium
CN114248265B (en) * 2020-09-25 2023-07-07 广州中国科学院先进技术研究所 Method and device for learning multi-task intelligent robot based on meta-simulation learning
CN112364999B (en) * 2020-10-19 2021-11-19 深圳市超算科技开发有限公司 Training method and device for water chiller adjustment model and electronic equipment
CN112269769B (en) * 2020-11-18 2023-12-05 远景智能国际私人投资有限公司 Data compression method, device, computer equipment and storage medium
CN112446505B (en) * 2020-11-25 2023-12-29 创新奇智(广州)科技有限公司 Meta learning modeling method and device, electronic equipment and storage medium
CN112598133B (en) * 2020-12-16 2023-07-28 联合汽车电子有限公司 Method, device, equipment and storage medium for processing vehicle data
CN112766388A (en) * 2021-01-25 2021-05-07 深圳中兴网信科技有限公司 Model acquisition method, electronic device and readable storage medium
CN113298286A (en) * 2021-03-31 2021-08-24 捷佳润科技集团股份有限公司 Machine learning-based pitaya marketing time prediction method
CN113408374B (en) * 2021-06-02 2022-09-23 湖北工程学院 Yield estimation method, device, equipment and storage medium based on artificial intelligence
CN113392118B (en) * 2021-06-04 2022-10-18 中电四川数据服务有限公司 Data updating detection system and method based on machine learning
CN113537297B (en) * 2021-06-22 2023-07-28 同盾科技有限公司 Behavior data prediction method and device
CN113657926A (en) * 2021-07-28 2021-11-16 上海明略人工智能(集团)有限公司 Advertisement effect prediction method, system, electronic device and storage medium
CN114444717A (en) * 2022-01-25 2022-05-06 杭州海康威视数字技术股份有限公司 Autonomous learning method, device, electronic equipment and machine-readable storage medium
CN114491039B (en) * 2022-01-27 2023-10-03 四川大学 Primitive learning few-sample text classification method based on gradient improvement
CN114822855B (en) * 2022-06-28 2022-09-20 北京智精灵科技有限公司 Cognitive training task pushing method, system and construction method based on FTRL model
CN115470936B (en) * 2022-09-23 2023-06-06 广州爱浦路网络技术有限公司 NWDAF-based machine learning model updating method and device

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105279240A (en) * 2015-09-28 2016-01-27 暨南大学 Client origin information associative perception based metadata pre-acquisition method and system
CN108665506A (en) * 2018-05-10 2018-10-16 腾讯科技(深圳)有限公司 Image processing method, device, computer storage media and server
CN109919299A (en) * 2019-02-19 2019-06-21 西安交通大学 A kind of meta learning algorithm based on meta learning device gradually gradient calibration
CN109948783A (en) * 2019-03-29 2019-06-28 中国石油大学(华东) A kind of Topological expansion method based on attention mechanism
CN109961089A (en) * 2019-02-26 2019-07-02 中山大学 Small sample and zero sample image classification method based on metric learning and meta learning
CN109961142A (en) * 2019-03-07 2019-07-02 腾讯科技(深圳)有限公司 A kind of Neural network optimization and device based on meta learning
CN109992866A (en) * 2019-03-25 2019-07-09 新奥数能科技有限公司 Training method, device, readable medium and the electronic equipment of load forecasting model
CN110163380A (en) * 2018-04-28 2019-08-23 腾讯科技(深圳)有限公司 Data analysing method, model training method, device, equipment and storage medium
CN110196946A (en) * 2019-05-29 2019-09-03 华南理工大学 A kind of personalized recommendation method based on deep learning
CN110276446A (en) * 2019-06-26 2019-09-24 北京百度网讯科技有限公司 The method and apparatus of model training and selection recommendation information
EP3568811A1 (en) * 2017-02-24 2019-11-20 Deepmind Technologies Limited Training machine learning models

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105279240A (en) * 2015-09-28 2016-01-27 暨南大学 Client origin information associative perception based metadata pre-acquisition method and system
EP3568811A1 (en) * 2017-02-24 2019-11-20 Deepmind Technologies Limited Training machine learning models
CN110163380A (en) * 2018-04-28 2019-08-23 腾讯科技(深圳)有限公司 Data analysing method, model training method, device, equipment and storage medium
CN108665506A (en) * 2018-05-10 2018-10-16 腾讯科技(深圳)有限公司 Image processing method, device, computer storage media and server
CN109919299A (en) * 2019-02-19 2019-06-21 西安交通大学 A kind of meta learning algorithm based on meta learning device gradually gradient calibration
CN109961089A (en) * 2019-02-26 2019-07-02 中山大学 Small sample and zero sample image classification method based on metric learning and meta learning
CN109961142A (en) * 2019-03-07 2019-07-02 腾讯科技(深圳)有限公司 A kind of Neural network optimization and device based on meta learning
CN109992866A (en) * 2019-03-25 2019-07-09 新奥数能科技有限公司 Training method, device, readable medium and the electronic equipment of load forecasting model
CN109948783A (en) * 2019-03-29 2019-06-28 中国石油大学(华东) A kind of Topological expansion method based on attention mechanism
CN110196946A (en) * 2019-05-29 2019-09-03 华南理工大学 A kind of personalized recommendation method based on deep learning
CN110276446A (en) * 2019-06-26 2019-09-24 北京百度网讯科技有限公司 The method and apparatus of model training and selection recommendation information

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
A SIMPLE NEURAL ATTENTIVE META-LEARNER;Nikhil Mishra 等;《arXiv》;1-17 *
Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks;Chelsea Finn 等;《arXiv》;1-13 *
On the Importance of Attention in Meta-Learning for Few-Shot Text Classification;Xiang Jiang 等;《arXiv》;1-13 *
Online Meta-Learning;Chelsea Finn 等;《arXiv》;1-19 *
基于 VAE 和注意力机制的小样本图像分类方法;郑欣悦 等;《计算机应用与软件》;第36卷(第10期);168-174 *

Also Published As

Publication number Publication date
CN111191791A (en) 2020-05-22

Similar Documents

Publication Publication Date Title
CN111191791B (en) Picture classification method, device and equipment based on machine learning model
WO2021042828A1 (en) Neural network model compression method and apparatus, and storage medium and chip
CN111507378A (en) Method and apparatus for training image processing model
EP3968179A1 (en) Place recognition method and apparatus, model training method and apparatus for place recognition, and electronic device
CN111860573A (en) Model training method, image class detection method and device and electronic equipment
EP4163831A1 (en) Neural network distillation method and device
CN112651511A (en) Model training method, data processing method and device
US11621930B2 (en) Systems and methods for generating dynamic conversational responses using trained machine learning models
WO2024001806A1 (en) Data valuation method based on federated learning and related device therefor
US20220237917A1 (en) Video comparison method and apparatus, computer device, and storage medium
Shi et al. Recent advances in plant disease severity assessment using convolutional neural networks
Walsh et al. Automated human cell classification in sparse datasets using few-shot learning
Schiliro et al. A novel cognitive computing technique using convolutional networks for automating the criminal investigation process in policing
CN114330499A (en) Method, device, equipment, storage medium and program product for training classification model
US20230095606A1 (en) Method for training classifier, and data processing method, system, and device
Shehu et al. Lateralized approach for robustness against attacks in emotion categorization from images
Neggaz et al. Boosting Archimedes optimization algorithm using trigonometric operators based on feature selection for facial analysis
US20230351119A1 (en) Systems and methods for generating dynamic conversational responses through aggregated outputs of machine learning models
WO2020201913A1 (en) Computer architecture for labeling documents
CN114155388B (en) Image recognition method and device, computer equipment and storage medium
CN115222112A (en) Behavior prediction method, behavior prediction model generation method and electronic equipment
US11587323B2 (en) Target model broker
CA3196711A1 (en) Systems and methods for generating dynamic conversational responses through aggregated outputs of machine learning models
CN111582404B (en) Content classification method, device and readable storage medium
WO2022262603A1 (en) Method and apparatus for recommending multimedia resources, device, storage medium, and computer program product

Legal Events

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