Method for acquiring task network in meta-learning, electronic device and readable storage medium

By adopting the source domain-target domain task interpolation method in meta-learning, new target domain tasks are generated and task network parameters are updated, the problem of insufficient generalization ability of traditional meta-learning in cross-domain scenarios is solved, and higher accuracy and cross-domain adaptability are achieved.

CN118586476BActive Publication Date: 2025-06-06SHANGHAI XUANTU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410733520.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2025-06-06
Estimated Expiration
2044-06-06

AI Technical Summary

Technical Problem

Traditional meta-learning methods perform poorly in cross-domain scenarios, especially in the case of large inter-domain deviations, how to improve the inter-domain generalization ability of the model is a key issue.

Method used

Through the task interpolation of the source domain-target domain, a new target domain task is generated, the data set of the specified target domain tasks is expanded, and the parameter update of the task network is combined with the new target domain tasks to improve the adaptability and accuracy of the model.

Benefits of technology

By generating new target domain tasks, this method provides more training data, helping the task network better adapt to target domain tasks, and improving the accuracy of the model and cross-domain generalization capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118586476B_ABST
    Figure CN118586476B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method for acquiring a task network in meta-learning, an electronic device, and a readable storage medium, and relates to the technical field of machine learning. The method for acquiring a task network in meta-learning includes: training an initial meta-network based on multiple source domain tasks and an initial task network included in a source domain task set to obtain a target meta-network; selecting at least one designated target domain task from multiple target domain tasks included in the target domain task set, and generating a new target domain task corresponding to the designated target domain task based on the task network initialized by the target meta-network and sample categories in multiple source domain tasks that are similar to each sample category in each designated target domain task; training the current task network corresponding to each target domain task based on the new target domain task corresponding to each target domain task to obtain a target task network for each target domain task. The present invention can improve the performance of the task network on the target task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine learning, and in particular to a method for acquiring a task network in meta-learning, an electronic device, and a readable storage medium. Background Art

[0002] Meta-learning is usually understood as "learning to learn", which refers to the process of improving learning algorithms in multiple learning stages. Meta-learning hopes to enable the model to acquire the ability to learn to adjust parameters so that it can quickly learn new tasks based on the existing knowledge.

[0003] Traditional meta-learning methods are suitable for small sample training tasks and test tasks that come from the same distribution, that is, the source domain and the target domain are consistent, which limits the generalization performance of the model on new domains. In some practical application scenarios, it is almost impossible to construct a large training dataset for rare classes, so it is very necessary to improve the generalization ability of the model to new domains. Therefore, the researchers further proposed cross-domain meta-learning.

[0004] In cross-domain meta-learning, the training tasks are sampled from the source domain, while the test tasks are sampled from the target domain, and there is a deviation between the source and target domains. When the deviation between domains is large, the model trained on the source domain often performs poorly on the target domain. How to improve the model's inter-domain generalization ability is the key to cross-domain meta-learning. Summary of the invention

[0005] The purpose of the present invention is to provide a method for acquiring a task network in meta-learning, an electronic device and a readable storage medium. For each specified target domain task, a new target domain task is generated through task interpolation between the source domain and the target domain, which is equivalent to expanding each specified target domain task, providing richer data for the task network training of the specified target domain task, and updating the parameters of the task network of the corresponding specified target domain task in combination with the new target domain task, which helps the task network to be more suitable for the target domain task and improves the accuracy of the acquired task network; at the same time, since the task interpolation is performed between the source domain and the target domain based on the category prototype, the performance of the task network on the target task can be improved.

[0006] To achieve the above-mentioned objectives, the present invention provides a method for acquiring a task network in meta-learning, comprising: training an initial meta-network based on multiple source domain tasks and an initial task network included in a source domain task set to obtain a target meta-network; selecting at least one designated target domain task from multiple target domain tasks included in the target domain task set, and generating a new target domain task corresponding to the designated target domain task based on the task network initialized by the target meta-network and sample categories in the multiple source domain tasks that are similar to sample categories in each of the designated target domain tasks; training a current task network corresponding to each of the target domain tasks based on the new target domain tasks corresponding to each of the target domain tasks to obtain a target task network for each of the target domain tasks.

[0007] The present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the task network acquisition method in meta-learning as described above.

[0008] The present invention also provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transient storage medium, on which a computer program is stored, and is characterized in that when the computer program is run by a processor, it executes the task network acquisition method in meta-learning as described above.

[0009] In one embodiment, training the initial meta-network based on multiple source domain tasks and the initial task network included in the source domain task set includes:

[0010] Based on a plurality of source domain tasks included in the source domain task set, the initial task network is trained respectively to obtain a first task network corresponding to each of the source domain tasks;

[0011] The initial meta-network is trained using the multiple source domain tasks and the first task network corresponding to each of the source domain tasks to obtain a target meta-network.

[0012] In one embodiment, before the initial meta-network is trained using the multiple source domain tasks and the first task network corresponding to each of the source domain tasks to obtain the target meta-network, the method further includes:

[0013] Determine at least one reference task pair including two selected source domain tasks from the multiple source domain tasks, and for each of the reference task pairs, mix the two selected source domain tasks in the reference task pair based on the first task network and the obtained first weight to obtain a new source domain task;

[0014] The step of training the initial meta-network using the plurality of source domain tasks and the first task network corresponding to each of the source domain tasks to obtain a target meta-network includes:

[0015] The initial meta-network is trained using the multiple source domain tasks, the first task networks corresponding to the source domain tasks, and the new source domain tasks to obtain a target meta-network.

[0016] In one embodiment, for each of the reference task pairs, two selected source domain tasks in the reference task pair are mixed based on the first task network and the obtained first weight to obtain a new source domain task, including:

[0017] For each of the reference task pairs, the category prototypes and query sets of the sample categories between the two selected source domain tasks in the reference task pair are mixed respectively based on the first weight to obtain a new source domain task corresponding to the reference task pair.

[0018] In one embodiment, for each of the reference task pairs, the category prototypes and query sets of the sample categories between the two selected source domain tasks in the reference task pair are mixed based on the first weights to obtain a new source domain task corresponding to the reference task pair, including:

[0019] For each of the reference task pairs, based on the first weight, the category prototypes of the two selected source domain tasks in the reference task pair at the first preset intermediate layer of the corresponding first task network are mixed correspondingly to obtain the category prototypes of each sample category of the new source domain task corresponding to the reference task pair at the first preset intermediate layer, wherein the first preset intermediate layer is any intermediate network layer of the first task network;

[0020] For each of the reference task pairs, the feature values ​​of each sample of the query set of the two selected source domain tasks in the reference task pair at the first preset intermediate layer are mixed respectively based on the first weight to obtain the feature value of each sample in the query set of the new source domain task corresponding to the reference task pair at the first preset intermediate layer;

[0021] The category prototypes of each sample category of the new source domain task corresponding to each reference task pair at the first preset intermediate layer and the feature values ​​of each sample in the query set are respectively input into the next network layer of the first preset intermediate layer in the first task network to the second to last network layer, so as to obtain the category prototypes of each sample category of the new source domain task and the feature values ​​of each sample in the query set.

[0022] In one embodiment, the initial meta-network is trained using the multiple source domain tasks, the new source domain task, and the first task network to obtain a target meta-network, including:

[0023] Obtaining a first classification loss of each of the first task networks on a query set of the corresponding source domain task;

[0024] For each of the new source domain tasks, based on the category prototypes of each sample category of the new source domain task and the feature values ​​of each sample in the query set, a second classification loss of the new source domain task is obtained;

[0025] The parameters of the initial meta-network are updated based on the first classification loss of each of the source domain tasks and the second classification loss of each of the new source domain tasks to obtain a target meta-network.

[0026] In one embodiment, based on the task network initialized by the target meta-network and sample categories in the multiple source domain tasks that are similar to sample categories in each of the designated target domain tasks, generating a new target domain task corresponding to the designated target domain task includes:

[0027] Based on each of the specified target domain tasks, the task network initialized by the target meta-network is trained to obtain a second task network corresponding to each of the specified target domain tasks;

[0028] For each of the specified target domain tasks, based on the obtained second weight, the feature values ​​of the samples of each sample category in the support set of the specified target domain task at the corresponding second preset intermediate layer of the second task network are mixed with the category prototypes of similar sample categories in the multiple source domain tasks, to obtain the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer, wherein the second preset intermediate layer is any intermediate network layer of the second task network;

[0029] The feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer are respectively input into the next network layer of the second preset intermediate layer of the corresponding second task network until the second to last network layer, so as to obtain the feature values ​​of each sample in the support set of the new target domain task.

[0030] In one embodiment, based on the obtained second weight, the feature values ​​of samples of each sample category in the support set of the specified target domain task at the second preset intermediate layer of the second task network are mixed with the category prototypes of similar sample categories in the multiple source domain tasks to obtain the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer, including:

[0031] For each sample category in the support set of the specified target domain task, calculate the category prototype of the sample category at the second preset intermediate layer, and select a source domain category prototype similar to the sample category from the category prototypes of each sample category of each source domain task at the second preset intermediate layer based on the category prototype of the sample category at the second preset intermediate layer;

[0032] For each sample category in the support set of the specified target domain task, the feature values ​​of each sample of the sample category in the specified target domain task at the second preset intermediate layer are mixed with similar source domain category prototypes based on the obtained second weight corresponding to the sample category, so as to obtain the feature values ​​of each sample of the sample category in the support set of the new target domain task at the second preset intermediate layer.

[0033] In one embodiment, the second weight corresponding to the sample category in the support set of the specified target domain task is obtained by generating it based on the similarity between the category prototype of the sample category in the support set of the specified target domain task and the similar category prototype of the source domain.

[0034] In one embodiment, for the specified target domain task, the classification loss of the target task network corresponding to the specified target domain task in the query set of the target domain sample task is obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 is a schematic diagram of a method for acquiring a task network in meta-learning according to a first embodiment of the present invention;

[0036] Figure 2 yes Figure 1 A specific flow chart of step 101 of the method for acquiring a task network in meta-learning;

[0037] Figure 3 yes Figure 1 A specific flow chart of step 102 of the method for acquiring a task network in meta-learning;

[0038] Figure 4 4 is a structural diagram of a method for acquiring a task network in meta-learning implemented by an electronic device according to a second embodiment of the present invention. DETAILED DESCRIPTION

[0039] The following will be described in detail with reference to the accompanying drawings to provide a clearer understanding of the purpose, features and advantages of the present invention. It should be understood that the embodiments shown in the accompanying drawings are not intended to limit the scope of the present invention, but are only intended to illustrate the essential spirit of the technical solution of the present invention.

[0040] In the following description, certain specific details are set forth for the purpose of illustrating various disclosed embodiments to provide a thorough understanding of the various disclosed embodiments. However, those skilled in the relevant art will recognize that the embodiments may be practiced without one or more of these specific details. In other cases, well-known devices, structures, and techniques associated with the present application may not be shown or described in detail to avoid unnecessarily obscuring the description of the embodiments.

[0041] Unless the context requires otherwise, throughout the specification and claims, the word "comprise" and variations such as "include" and "have" should be construed in an open, inclusive sense, ie, should be interpreted as "including, but not limited to."

[0042] References throughout the specification to "one embodiment" or "an embodiment" indicate that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of "in one embodiment" or "in an embodiment" in various places throughout the specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any manner in one or more embodiments.

[0043] As used in this specification and the appended claims, the singular forms "a", "an", and "the" include plural referents unless the context clearly dictates otherwise. It should be noted that the term "or" is generally employed in its sense including "or / and" unless the context clearly dictates otherwise.

[0044] In the following description, in order to clearly show the structure and working mode of the present invention, many directional words will be used for description, but the words "front", "back", "left", "right", "outside", "inside", "outward", "inward", "up", "down", etc. should be understood as convenient terms and should not be understood as restrictive terms.

[0045] The first embodiment of the present invention relates to a method for acquiring a task network in meta-learning, which is applied to an electronic device. The electronic device may be a common computer device, such as a desktop host, a laptop computer, etc., or a server.

[0046] like Figure 1 As shown in FIG, this is a specific flowchart of the method for obtaining task networks in meta-learning.

[0047] In the meta-learning process, a source domain training data set and a target domain test data set are first obtained, both of which include a number of samples of multiple sample categories (for example, images); then a meta-network is constructed, and the initial meta-network can be a neural network model, for example, a residual neural network with 12 convolutional layers; then the meta-network is initialized, for example, the meta-network includes L layers, denoted as 0 to L-1 layers, each network layer has a corresponding feature mapping function, and the meta-network is initialized, that is, the parameters θ of the L network layers of the random meta-network are set to obtain the initial meta-network.

[0048] Step 101: Train the initial meta-network based on multiple source domain tasks and the initial task network included in the source domain task set to obtain a target meta-network.

[0049] Specifically, the training of obtaining the target meta-network is a cyclic process, and step 101 is repeated to obtain a target meta-network that meets the requirements, such as a meta-loss of the target meta-network is less than a preset threshold.

[0050] The specific process of each cycle includes: training the initial task network based on multiple source domain tasks included in the source domain task set to obtain the first task network corresponding to each source domain task; using multiple source domain tasks and the first task network corresponding to each source domain task to train the initial meta-network to obtain the target meta-network.

[0051] Furthermore, in each cycle, the source domain task set can be expanded, that is, new source domain tasks are added to the source domain task set, and then the target meta-network is trained. Please refer to Figure 2 , step 101 comprises:

[0052] Sub-step 1011, training the initial task network respectively based on multiple source domain tasks included in the source domain task set to obtain a first task network corresponding to each source domain task.

[0053] Sub-step 1012, determining at least one reference task pair including two selected source domain tasks from multiple source domain tasks, and for each reference task pair, mixing the two selected source domain tasks in the reference task pair based on the first task network and the obtained first weight to obtain a new source domain task.

[0054] Sub-step 1013, using multiple source domain tasks, the first task network corresponding to each source domain task, and the new source domain task to train the initial meta-network to obtain a target meta-network.

[0055] The following is an example of the process of training a meta-network:

[0056] The source domain task set is obtained from the source domain training data set, that is, samples of N sample categories are selected from the source domain training data set each time, and then K samples + T samples are randomly selected from all samples of each category to form a single source domain task. Multiple source domain tasks form a source domain task set, and the source domain task is a small sample task; each source domain task includes: a support set and a query set. Where N is an integer greater than 1.

[0057] For example, the acquired source domain task set includes M source domain tasks, denoted as Then the i-th source domain task Support set Query Set Support Set and queryset contains samples of N sample categories, and the support set There are K samples for each sample category, and the query set There are T samples for each sample category. Support set The input data of the sample in Support set The category labels of the samples in , Represents a query set The input data of the sample in Represents a query set The label category of the sample in, K, T are both integers greater than 1, 1≤i≤M.

[0058] The initial task network is obtained based on the initial meta-network. The meta-network is used to share parameters with the task network. That is, the task network is initialized with the parameters θ of the initial meta-network to obtain the initial task network. That is, the parameters of the network layer of the initial task network are θ. The initial task network has the same structure as the initial meta-network, for example, both are residual neural networks with 12 convolutional layers.

[0059] For each source domain task, the initial task network is trained using the source domain task, and the parameters of the initial task network are updated to obtain a first task network trained by the source domain task; thereby, the first task network corresponding to each source domain task can be obtained.

[0060] For example, for the i-th source domain task Using source domain tasks When training the initial task network, the source domain task Support set The samples in the source domain are classified to obtain the classification results, and then the parameters of the initial task network are updated according to the classification loss reverse gradient propagation; specifically: during the training process, the initial task network is used to classify the source domain task Perform V steps of batch stochastic gradient descent, initial parameters of the initial task network V is an integer greater than 1; in the batch stochastic gradient descent of the v+1th step (v=0,1,…,V-1), the source domain task Support set The input data of the sample in Input to the task network obtained by batch stochastic gradient descent in step v The parameters of the task network are Task Network The output classification result is

[0061] The classification results of each sample are compared with the support set The label category of each sample in Compare and calculate the classification loss l is a loss function. For example, the preset tool for classification loss is cross entropy loss. However, it is not limited to this, and an existing loss function can be selected based on needs.

[0062] Then based on the classification loss The batch stochastic gradient descent method is used to update the parameters of the task network.

[0063] Repeat the above process V times to obtain the initial task network after the source domain task The trained first task network, source domain task The corresponding parameters of the first task network are Express it as

[0064] From the above, the initial task networks are trained for the M source domain tasks respectively, and the first task networks corresponding to the source domain tasks are obtained, which can be respectively recorded as

[0065] At least one reference task pair is determined from all source domain tasks included in the source domain task set, each reference task pair includes two selected source domain tasks, and source domain tasks between different reference task pairs do not overlap.

[0066] For each reference task pair, the category prototypes of the sample categories between the two selected source domain tasks in the reference task pair are mixed with the query set based on the first weight to obtain a new source domain task corresponding to the reference task pair, that is, for each reference task pair, a new source domain task can be generated accordingly; the specific process is as follows:

[0067] For each reference task pair, based on the first weight, the category prototypes of the two selected source domain tasks in the reference task pair at the first preset intermediate layer of the corresponding first task network are mixed accordingly to obtain the category prototypes of each sample category of the new source domain task corresponding to the reference task pair at the first preset intermediate layer, where the first preset intermediate layer is any intermediate network layer of the first task network.

[0068] For each reference task pair, the feature values ​​of each sample in the query set of the two selected source domain tasks in the reference task pair at the first preset intermediate layer are mixed respectively based on the first weight to obtain the feature values ​​of each sample in the query set of the new source domain task corresponding to the reference task pair at the first preset intermediate layer.

[0069] The category prototypes of each sample category of the new source domain task corresponding to each reference task pair at the first preset intermediate layer and the feature values ​​of each sample in the query set are respectively input into the next network layer from the first preset intermediate layer in the first task network to the second to last network layer, to obtain the category prototypes of each sample category of the new source domain task and the feature values ​​of each sample in the query set.

[0070] The following takes a reference task pair as an example to illustrate that the two selected source domain tasks included in the reference task pair are the i-th source domain task With the j-th source domain task i≠j, 1≤j≤M.

[0071] Calculate the source domain tasks separately Source domain tasks The category prototype of each sample category at the first preset intermediate layer of the corresponding first task network, the category prototype is the class average feature; the first preset intermediate layer is any intermediate network layer of the first task network, for example, the first task network has L network layers, which are respectively recorded as 1 to L layers, then the first preset intermediate layer is any network layer in the first task network except the 1st layer and the L-1th layer, that is, the first preset intermediate layer is any network layer between the 1st layer and the L-1th layer.

[0072] For source domain tasks For each sample category, use its corresponding first task network Extract source domain tasks Support set The samples of this sample category in the first task network The feature value at the first preset intermediate layer is input into the first task network. Get the first task network The output of the first preset intermediate layer is the eigenvalue of the sample at the first preset intermediate layer; then the eigenvalues ​​of all samples at the first preset intermediate layer are averaged to obtain the source domain task First Mission Network The first preset middle layer category prototype.

[0073] For example, the source domain task Support set The nth sample category in the first task network The category prototype at the first preset intermediate layer (layer l) The expression is as follows:

[0074]

[0075] in, Represents the first task network The input to the feature mapping function of the lth layer, It is a source domain task Support set The kth sample of the nth sample category in , n=1,2,…,N, k=1,2,…,K.

[0076] Based on the source domain task Support set Each sample category in the first task network The calculation process of the category prototype of the first preset intermediate layer can calculate the source domain task In the corresponding first task network The first preset middle layer category prototype.

[0077] For example, the source domain task Support set The nth sample category in the first task network The category prototype at the first preset intermediate layer (layer l) The expression is as follows:

[0078]

[0079] in, Represents the first task network The input to the feature mapping function of the lth layer, It is a source domain task Support set The kth sample of the nth sample category in , n=1,2,…,N, k=1,2,…,K.

[0080] A first weight λ is obtained, and the first weight λ is used to control the degree of interpolation between the category prototypes of each sample category of the two selected source domain tasks in the reference task pair; the first weight λ can be a preset value, and can also be generated when needed, such as generated based on a preset function, for example, the first weight is randomly sampled based on a preset Bernoulli distribution, then λ~Beta(α,β), where the preset values ​​of α and β are 1.

[0081] First, based on the first weight λ, the source domain task Source domain tasks The category prototypes of each sample category at the first preset middle layer are mixed respectively to obtain the category prototypes of each sample category at the first preset middle of the new source domain task corresponding to the reference task pair.

[0082] For example, the category prototype of the nth sample category in the support set of the new source domain task at the layer The expression is as follows:

[0083]

[0084] Then, the category prototypes of each sample category at the lth layer in the support set of the new source domain task are Input to source domain task The corresponding remaining layers after the first task network layer l Represents the first task network The feature mapping function from the l+1th layer to the L-1th layer (the second to last network layer) is used to obtain the category prototype P of each sample category in the support set of the new source domain task. new , whose expression is: Here, we can also use the category prototypes of each sample category at layer l in the support set of the new source domain task Input to source domain task The corresponding remaining layers after the first task network layer l Represents the first task network The feature mapping function from the l+1th layer to the L-1th layer (the penultimate network layer) can also be used to obtain the category prototype P of each sample category in the support set of the new source domain task. new .

[0085] Second, based on the first weight λ, the source domain task Source domain tasks The feature values ​​of each sample in the query set at the first preset intermediate layer are mixed one by one.

[0086] Specifically, the source domain task Query set Each sample in is input into the corresponding first task network In the first task network, get The output of the first preset intermediate layer of is the feature value of each sample at the first preset intermediate layer. Similarly, the source domain task Query set Each sample in is input into the corresponding first task network In the first task network, get The output of the first preset intermediate layer, that is, the feature value of each sample at the first preset intermediate layer.

[0087] Then, the source domain task is divided into Each sample in the query set and the source domain task The feature values ​​of each sample at the corresponding position in the query set of the first preset intermediate layer are mixed to obtain the query set of the new source domain task The expression is:

[0088]

[0089] in, Represents the source domain task The samples in the query set are input into the first task network After that, the first task network The characteristic value of the output of the lth layer; Represents the source domain task The samples in the query set are input into the first task network After that, the first task network The feature value of the l-th layer output.

[0090] For example, the feature value of the rth sample in the query set of the new source domain task at the first layer is The expression is:

[0091]

[0092] in, Represents the source domain task The rth sample in the query set is input into the first task network After that, the first task network The characteristic value of the output of the lth layer; Represents the source domain task The rth sample in the query set is input into the first task network After that, the first task network The feature value of the l-th layer output.

[0093] The new source domain task queries the feature values ​​of each sample in the first preset intermediate layer. Input to the source domain task The corresponding remaining layers after the first task network layer l Represents the first task network The feature mapping function from the l+1th layer to the L-1th layer (the second to last network layer) is used to obtain the feature values ​​of each sample in the query set of the new source domain task. Label categories and source domain tasks of each sample in the query set The labels of samples at corresponding positions are the same. Here, the feature values ​​of each sample in the query set of the new source domain task can also be Input to the source domain task The corresponding remaining layers after the first task network layer l Represents the first task network The feature mapping function from the l+1th layer to the L-1th layer (the second to last network layer) can also obtain the feature values ​​of each sample in the query set of the new source domain task

[0094] Based on the above process, we can get Source domain tasks The new source domain task obtained by mixing, the category prototype of each sample category in the support set of the new source domain task and the feature value of each sample in the query set are known, which can be used to train the initial meta-network later.

[0095] As can be seen from the above, each reference task pair can be used to generate a new source domain task, thereby obtaining at least one new source domain task. Subsequently, the initial meta-network is trained using multiple source domain tasks, the first task network corresponding to each source domain task, and the new source domain task to obtain the target meta-network, which specifically includes:

[0096] The first classification loss of each first task network on the query set of the corresponding source domain task is obtained; that is, for each source domain task, the samples in the query set of the source domain task are classified using the corresponding first task network to obtain the classification result, and the classification loss is calculated based on the comparison between the classification result and the label category of each sample in the query set, which is recorded as the first classification loss. In this way, the first classification loss of each first task network on the query set of the corresponding source domain task can be obtained.

[0097] For example, for the i-th source domain task Leveraging the First Task Network For source domain tasks Samples in the query set Classify and get According to the label category of each sample in the query set Calculate the first task network Tasks in the source domain The first classification loss on the query set Its expression is:

[0098] For each new source domain task, the second classification loss of the new source domain task is obtained based on the category prototype of each sample category of the new source domain task and the feature value of each sample in the query set.

[0099] For example, the category prototype P of N sample categories in the support set of the new source domain task new , whose expression is The feature values ​​of each sample in the query set Taking a sample in the query set as an example, we can calculate the probability that the sample belongs to each sample category among N sample categories, and select the category with the largest probability as the sample category of the sample; thus, we can obtain the classification results of all samples in the query set, and then compare the classification results of each sample with the label category of each sample in the query set; thus, we can calculate the classification loss of the query set, that is, the second classification loss; the second classification loss of the new source domain task on the query set can be expressed as:

[0100]

[0101] The meta-loss is then calculated to update the meta-network parameters Yuan loss It is equal to the sum of the first classification loss of all source domain tasks and the second classification loss of all new source domain tasks. Assuming there are M source domain tasks and Z new source domain tasks, the meta-loss is The expression is:

[0102]

[0103] Based on meta-loss Compute the meta-gradient g for initial meta-network parameter update θ , and update the parameters of the meta-network according to the preset gradient descent method (such as stochastic gradient descent). For example, if the parameters of the initial meta-network are θ, then the updated parameters are

[0104] After each training to obtain a meta-network, it is necessary to determine whether the meta-network parameters have converged. If the parameters have converged, the meta-network is used as the target meta-network. If the meta-network parameters have not converged, the aforementioned meta-network training process is repeated, that is, the source domain task set is obtained from the source domain training data set again, and then the training is completed to obtain a new meta-network, until a meta-network with converged parameters is obtained as the target meta-network. Whether the meta-network parameters have converged can also be determined by calculating the classification loss of the meta-network on the source domain task.

[0105] In the process of training to obtain the target meta-network, new source domain tasks are generated through source domain-source domain task interpolation, that is, the source domain tasks in the source domain task set are expanded to obtain richer and more diverse source domain training data, which simply and efficiently enhances the source domain training data of the meta-network, helps the meta-network to be more suitable for source domain tasks, that is, provides richer data for the training of the meta-network, makes the obtained meta-network model more accurate, and improves the task generalization ability of the meta-network.

[0106] Therefore, the target meta-network learns the prior knowledge shared between the source domain sample task set and the new source domain task, which can be used as the shared initialization parameters of the task network.

[0107] Step 102, selecting at least one designated target domain task from multiple target domain tasks included in the target domain task set, and generating a new target domain task corresponding to the designated target domain task based on the task network initialized by the target meta-network and sample categories in multiple source domain tasks that are similar to each sample category in each designated target domain task.

[0108] Please refer to Figure 3 , step 102 specifically includes the following sub-steps:

[0109] Sub-step 1021 : selecting at least one designated target domain task from a plurality of target domain tasks included in the target domain task set.

[0110] Sub-step 1022, based on each designated target domain task, the task network initialized by the target meta-network is trained to obtain a second task network corresponding to each designated target domain task.

[0111] Sub-step 1023, for each specified target domain task, based on the obtained second weight, the feature values ​​of samples of each sample category in the support set of the specified target domain task at the second preset intermediate layer of the corresponding second task network are mixed with the category prototypes of similar sample categories in multiple source domain tasks, so as to obtain the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer, wherein the second preset intermediate layer is any intermediate network layer of the second task network.

[0112] Sub-step 1024, input the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer into the next network layer of the second preset intermediate layer of the corresponding second task network until the second to last network layer, to obtain the feature values ​​of each sample in the support set of the new target domain task.

[0113] Specifically, a target domain task set is obtained from the target domain test data set, that is, samples of N sample categories are selected from the target domain training data set, and all samples in these N sample categories are divided into multiple target domain tasks. Multiple target domain tasks form a target domain task set, and the target domain tasks are small sample tasks; each target domain task includes: a support set and a query set. Where N is an integer greater than 1.

[0114] After obtaining the target domain task set, the task network initialized by the target meta-network is trained based on the multiple target domain tasks included in the target domain task set to obtain the second task network corresponding to each target domain task, specifically including:

[0115] At least one target domain task is selected from all the target domain tasks included in the target domain task set as the designated target domain task, that is, all the target domain tasks in the target domain task combination can be used as the designated target domain tasks, for example, all the target domain tasks can be selected as the designated target domain tasks.

[0116] Use the task selected as the specified target domain task to train the task network initialized by the target meta-network to obtain the second task network corresponding to each specified target domain task. The specific training process can refer to the source domain task. Of course, if all target domain tasks are selected as designated target domain tasks, the task network initialized by the target meta-network is trained based on the multiple target domain tasks included in the target domain task set to obtain the second task network corresponding to each target domain task.

[0117] Subsequently, for each sample category in the support set of the specified target domain task, the category prototype of the sample category at the second preset intermediate layer is calculated, and based on the category prototype of the sample category at the second preset intermediate layer, a source domain category prototype similar to the sample category is selected from the category prototypes of each sample category of each source domain task at the second preset intermediate layer; that is, for each specified target domain task, the category prototypes of each sample category in the support set of the specified target domain task at the second preset intermediate layer of the corresponding second task network are calculated.

[0118] For example, if the number of specified target domain tasks is F, then for the fth specified target domain task 1≤f≤F; using the specified target domain task The corresponding second task network extracts the specified target domain task The feature value of each sample category in the support set at the second preset intermediate layer of the corresponding second task network is obtained, that is, the sample is input into the corresponding second task network, and the output of the second preset intermediate layer of the second task network is obtained, which is the feature value of the sample at the second preset intermediate layer; then the feature values ​​of all samples at the second preset intermediate layer are averaged to obtain the specified target domain task The class prototype of the second preset intermediate layer of the corresponding second task network. The second preset intermediate layer is any intermediate network layer of the second task network. For example, the second task network has L network layers, which are recorded as 1 to L layers respectively. Then the second preset intermediate layer is any network layer in the second task network except the 1st layer and the L-1th layer, that is, the second preset intermediate layer is any network layer between the 1st layer and the L-1th layer.

[0119] It should be noted that, in this embodiment, the first task network and the second task network are both obtained based on a meta-network with the same structure and different parameters, that is, the first task network and the second task network have the same structure, such as the same number of network layers. The second task network is an L-layer network as an example.

[0120] In this embodiment, the second preset intermediate layer and the aforementioned first preset intermediate layer can be the same layer, that is, the second preset intermediate layer is also the lth layer of the second task network. Therefore, when searching for category prototypes similar to the sample categories of the target domain task in the source domain task in the subsequent source domain task, the category prototypes of the lth layer of the corresponding first task network of each source domain task calculated previously can be directly used; if the second preset intermediate layer and the aforementioned first preset intermediate layer are different layers, it is necessary to recalculate the category prototypes of the second preset intermediate layer of each source domain task in the corresponding first task network; the following is an example in which the second preset intermediate layer and the aforementioned first preset intermediate layer are the same layer:

[0121] For example, specifying the target domain task The category prototype of the nth sample category in the support set of the corresponding second task network at the lth layer The expression is:

[0122]

[0123] in, It is a task that specifies the target domain The kth sample of the nth sample category in the support set of Indicates the specified target domain task The corresponding feature mapping function of the second task network input to the lth layer, For sample After being input into the second task network, the feature value output by the lth layer of the second task network, K represents the target domain task The total number of samples of each sample category in the support set, K is an integer greater than 1.

[0124] Calculate the category prototype of each source domain task in the source domain task set in the corresponding first task network at the lth layer. The specific calculation process will not be repeated here, and can refer to the above content. Among them, the category prototype value of the sample category of the source domain task in the source domain task set can also be obtained using the target meta-network. The source domain task set used here is the source domain task set used when training the target meta-network.

[0125] Then, for each specified target domain task, a source domain category prototype similar to the category prototype of each sample category of the specified target domain task is searched in the source domain; taking any sample category as an example, the prototype category value of the sample category (referred to as the target domain prototype category value) is compared with the category prototype values ​​of the sample category of all source domain tasks in the source domain task set (referred to as the source domain prototype category value), and the source domain prototype category value closest to the target domain prototype category value of the sample category is found. For example, the cosine similarity between the target domain prototype category value and each source domain prototype category value can be calculated to find the closest source domain prototype category value, that is, the category prototype in the source domain that is most similar to the category prototype of the sample category.

[0126] This allows us to find similar category prototypes of all sample categories in the source domain for the support set of the specified target domain task; for example, The source domain prototype set formed by similar category prototypes of all sample categories in the source domain in the support set It can be expressed as:

[0127]

[0128] in, Indicates the specified target domain task The sample category 1 in the support set of is similar to the category prototype of the source domain at layer l, Indicates the specified target domain task The sample category 2 in the support set of is similar to the category prototype of the source domain at layer l, and so on. Represents and specifies the target domain task The sample category N in the support set is similar to the category prototype of the source domain at layer l.

[0129] Subsequently, for each sample category in the support set of the specified target domain task, the feature values ​​of each sample of the sample category in the specified target domain task at the second preset intermediate layer are mixed with similar source domain category prototypes based on the obtained second weight corresponding to the sample category, so as to obtain the feature values ​​of each sample of the sample category in the support set of the new target domain task at the second preset intermediate layer.

[0130] First, the second weight is obtained. The second weight corresponding to the sample category in the support set of the specified target domain task is obtained by: generating it based on the similarity between the category prototype of the sample category in the support set of the specified target domain task and the similar source domain category prototype; for example, cosine similarity is selected.

[0131] That is, for each specified target domain task, each sample category in the specified target domain task has a corresponding second weight u, which is determined by the similarity between the category prototype of the sample category and the similar category prototype in the source domain. The second weight u is used to control the interpolation degree between the samples of the sample category in the support set of the specified target domain task and the similar category prototype in the source domain; for example, a sample category w in the support set of the specified target domain task has a category prototype p in the lth layer of the corresponding second task network. l,w , whose similar source domain category prototype is Then the expression of the second weight u corresponding to the sample category w is:

[0132]

[0133] Wherein C is a preset value, which is greater than 0 and less than 1, for example, 0.5, and can also be adjusted according to needs.

[0134] For each sample category in the support set of the specified target domain task, the feature values ​​of each sample of the sample category in the specified target domain task at the second preset intermediate layer are mixed with similar source domain category prototypes based on the obtained second weight corresponding to the sample category, so as to obtain the feature values ​​of each sample of the sample category in the support set of the new target domain task at the second preset intermediate layer. That is, based on the second weight of each sample category in the support set of the specified target domain task, the feature values ​​of each sample category sample at the second preset intermediate layer of the corresponding second task network are mixed with similar source domain category prototypes, so as to obtain the feature values ​​of each sample category sample in the support set of the new target domain task at the second preset intermediate layer.

[0135] Taking the sample category w in the support set of the specified target domain task as an example, the second weight corresponding to the sample category w is denoted as u w , then the feature value of the kth sample of sample category w in the support set of the new target domain task at layer l can be expressed as

[0136]

[0137] in, represents the feature value of the kth sample in the sample category w in the support set of the specified target task in the lth layer of the corresponding second task network, is the source domain category prototype similar to the sample category w.

[0138] Then, the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer are respectively input into the next network layer of the second preset intermediate layer of the corresponding second task network until the second to last network layer, and the feature values ​​of each sample in the support set of the new target domain task are obtained; specifically, the feature values ​​of each sample in the support set of the specified target domain task are obtained. For example, for a specified target domain task The corresponding new target domain task The new target domain task The feature values ​​of each sample in the query set at the lth level Input into the specified target domain task respectively The corresponding remaining layers after the lth layer of the second task network Represents the second task network The feature mapping function from the l+1th layer to the L-1th layer is used to obtain the feature values ​​of each sample in the support set of the new target domain task. Supports label categories of each sample in the set and specified target domain tasks The label categories of samples at corresponding positions are the same.

[0139] Based on the aforementioned process, the support set of the new target domain tasks corresponding to each specified target domain task can be obtained.

[0140] Step 103: Train the current task network corresponding to each target domain task based on the new target domain task corresponding to each target domain task to obtain the target task network of each target domain task.

[0141] Specifically, in the aforementioned process, a corresponding new target domain task is generated for each designated target domain task, and then the support set of the new target domain task can be used to train the corresponding second task network of the designated target domain task, thereby updating the parameters of the second task network of each designated target domain task to obtain the target task network of each designated target domain task. Among them, the specific process of using the support set of the new target domain task to train the corresponding second task network of the designated target domain task is similar to the training process of the first task network and the second task network, and will not be repeated here; the parameters of the second task network of the designated target domain task can also be updated by combining the support set of the designated target domain task and the support set of the new target domain task corresponding to the designated target domain task.

[0142] Subsequently, for the specified target domain task, the classification loss of the target task network corresponding to the specified target domain task in the query set of the target domain sample task can be obtained; that is, the target task network of each specified target domain task is tested on the query set to determine the cross-domain generalization ability of the target task network. Taking a specified target domain task as an example, the target task network of the specified target domain task is used to classify each sample in the query set of the specified target domain task to obtain the classification results of all samples in the query set, and then the classification results of each sample are compared with the label category of each sample in the query set; thus, the classification loss of the target task network for the query set can be calculated, and the cross-domain generalization ability of the target task network can be determined based on the classification loss.

[0143] In this embodiment, for each specified target domain task, a new target domain task is generated through task interpolation between the source domain and the target domain, which is equivalent to expanding each specified target domain task and providing richer data for the task network training of the specified target domain task. The task network of the corresponding specified target domain task can be updated with parameters in combination with the new target domain task, which helps the task network to be more suitable for the target domain task and improves the accuracy of the acquired task network. At the same time, since the task interpolation between the source domain and the target domain is based on the category prototype, the performance of the task network on the target task can be improved.

[0144] A second embodiment of the present invention relates to an electronic device, which may be a common computer device, such as a desktop host, a notebook computer, etc., or a server.

[0145] The electronic device includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the task network acquisition method in meta-learning in the first embodiment.

[0146] like Figure 4 , which is a module structure diagram of an electronic device for implementing the method for acquiring a task network in meta-learning in the first embodiment.

[0147] Combined with the specific process of the method for acquiring the task network in meta-learning in the first embodiment, it can be seen that the whole process can be divided into two parts: the first part is the source domain meta-network training process described in step 101, the source domain task set is input into the task network, and the initial task network is trained respectively based on the multiple source domain tasks contained in the source domain task set to obtain the first task network corresponding to each source domain task, and each source domain task extracts the intermediate layer feature category prototype of each sample category by the corresponding first task network and sends it to the source domain interpolation module; the source domain-source domain interpolation weight generator is used to generate the first weight and send the first weight to the source domain interpolation module. After the task pair is selected, the source domain interpolation module mixes the two selected source domain tasks in the reference task pair based on the first task network and the obtained first weight to obtain a new source domain task, and then uses the multiple source domain tasks, the first task network corresponding to each source domain task, and the new source domain task to train the initial meta-network to obtain the target meta-network.

[0148] The second part is the target domain fine-tuning process of the task network described in step 102 and step 103. The target meta-network learns the prior knowledge shared between the source domain sample task set and the new source domain task, which can be the shared initialization parameters of the task network in the target domain fine-tuning process.

[0149] The target domain task set is input into the task network initialized by the target meta-network, and the selected designated target domain tasks respectively train the task networks initialized by the target meta-network based on the designated target domain tasks to obtain the second task networks corresponding to the designated target domain tasks; the second task networks corresponding to the designated target domain tasks extract the intermediate layer feature category prototypes of each sample category and send them to the target domain interpolation module; the source domain-target domain interpolation weight generator is used to generate the second weight of each sample category of each designated target domain task, and send the second weight of each sample category of each designated target domain task to the target domain interpolation module, and the source domain interpolation module interpolates the designated target domain task based on the obtained second weight. The feature values ​​of samples of each sample category in the support set at the second preset intermediate layer of the corresponding second task network are mixed with the category prototypes of similar sample categories in multiple source domain tasks to obtain the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer, and then the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer are input into the next network layer of the second preset intermediate layer of the corresponding second task network until the penultimate network layer to obtain the feature values ​​of each sample in the support set of the new target domain task; then the current task network corresponding to each target domain task is trained based on the new target domain task corresponding to each target domain task to obtain the target task network of each target domain task.

[0150] Furthermore, for the specified target domain task, the classification loss of the target task network corresponding to the specified target domain task in the query set of the target domain sample task is obtained; taking a specified target domain task as an example, the target task network of the specified target domain task is used to classify each sample in the query set of the specified target domain task, and the classification results of all samples in the query set are obtained, and then the classification results of each sample are compared with the label category of each sample in the query set; thereby, the classification loss of the target task network for the query set can be calculated, and the cross-domain generalization ability of the target task network can be determined based on the classification loss.

[0151] Since the first embodiment corresponds to this embodiment, this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and the technical effects that can be achieved in the first embodiment can also be achieved in this embodiment. In order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.

[0152] It should be noted that the memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage. Similarly, the processor may also be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0153] A third embodiment of the present invention relates to a computer-readable storage medium, which is a non-volatile storage medium or a non-transient storage medium, on which a computer program is stored, and is characterized in that when the computer program is executed by a processor, the method for obtaining a task network in meta-learning in the first embodiment is executed.

[0154] Since the first embodiment corresponds to this embodiment, this embodiment can be implemented in conjunction with the first embodiment. The relevant technical details mentioned in the first embodiment are still valid in this embodiment, and the technical effects that can be achieved in the first embodiment can also be achieved in this embodiment. In order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the first embodiment.

[0155] Preferred embodiments of the present invention have been described above in detail, but it should be understood that aspects of the embodiments can be modified, if necessary, to employ aspects, features and concepts of the various patents, applications and publications to provide further embodiments.

[0156] These and other changes can be made to the embodiments in light of the above detailed description.In general, in the claims, the terms used should not be considered limited to the specific embodiments disclosed in the specification and the claims, but should be construed to include all possible embodiments along with the full scope of equivalents to which these claims are entitled.

Claims

1. A method for acquiring a task network in meta-learning, characterized in that: include: Training an initial meta-network based on a plurality of source domain tasks and an initial task network included in a source domain task set to obtain a target meta-network, wherein each source domain task in the source domain task set includes image samples of N sample categories; Selecting at least one designated target domain task from a plurality of target domain tasks included in the target domain task set, and generating a new target domain task corresponding to the designated target domain task based on the task network initialized by the target meta-network and sample categories in the plurality of source domain tasks that are similar to each sample category in each of the designated target domain tasks, wherein each target domain task in the target domain task set includes image samples of N sample categories; Based on the new target domain tasks corresponding to the target domain tasks, the current task network corresponding to each of the target domain tasks is trained to obtain the target task network of each of the target domain tasks, wherein the target task network is used to classify the image samples in the corresponding target domain tasks; The initial meta-network is trained based on multiple source domain tasks and the initial task network included in the source domain task set, including: Based on a plurality of source domain tasks included in the source domain task set, the initial task network is trained respectively to obtain a first task network corresponding to each of the source domain tasks; Determine at least one reference task pair including two selected source domain tasks from the multiple source domain tasks, and for each of the reference task pairs, mix the two selected source domain tasks in the reference task pair based on the first task network and the obtained first weight to obtain a new source domain task; The initial meta-network is trained using the multiple source domain tasks, the first task networks corresponding to the source domain tasks, and the new source domain tasks to obtain a target meta-network.

2. The method for obtaining a task network in meta-learning according to claim 1, characterized in that: For each of the reference task pairs, two selected source domain tasks in the reference task pair are mixed based on the first task network and the obtained first weight to obtain a new source domain task, including: For each of the reference task pairs, the category prototypes and query sets of the sample categories between the two selected source domain tasks in the reference task pair are mixed respectively based on the first weight to obtain a new source domain task corresponding to the reference task pair.

3. The method for obtaining a task network in meta-learning according to claim 2, characterized in that: For each of the reference task pairs, the category prototypes and query sets of the sample categories between the two selected source domain tasks in the reference task pair are mixed based on the first weights to obtain a new source domain task corresponding to the reference task pair, including: For each of the reference task pairs, based on the first weight, the category prototypes of the two selected source domain tasks in the reference task pair at the first preset intermediate layer of the corresponding first task network are mixed correspondingly to obtain the category prototypes of each sample category of the new source domain task corresponding to the reference task pair at the first preset intermediate layer, wherein the first preset intermediate layer is any intermediate network layer of the first task network; For each of the reference task pairs, the feature values ​​of each sample of the query set of the two selected source domain tasks in the reference task pair at the first preset intermediate layer are mixed respectively based on the first weight to obtain the feature value of each sample in the query set of the new source domain task corresponding to the reference task pair at the first preset intermediate layer; The category prototypes of each sample category of the new source domain task corresponding to each reference task pair at the first preset intermediate layer and the feature values ​​of each sample in the query set are respectively input into the next network layer of the first preset intermediate layer in the first task network to the second to last network layer, so as to obtain the category prototypes of each sample category of the new source domain task and the feature values ​​of each sample in the query set.

4. The method for obtaining a task network in meta-learning according to claim 3, characterized in that: The initial meta-network is trained using the multiple source domain tasks, the new source domain task, and the first task network to obtain a target meta-network, including: Obtaining a first classification loss of each of the first task networks on a query set of the corresponding source domain task; For each of the new source domain tasks, based on the category prototypes of each sample category of the new source domain task and the feature values ​​of each sample in the query set, a second classification loss of the new source domain task is obtained; The parameters of the initial meta-network are updated based on the first classification loss of each of the source domain tasks and the second classification loss of each of the new source domain tasks to obtain a target meta-network.

5. The method for obtaining a task network in meta-learning according to claim 1, characterized in that: Based on the task network initialized by the target meta-network and the sample categories in the multiple source domain tasks that are similar to the sample categories in each of the designated target domain tasks, a new target domain task corresponding to the designated target domain task is generated, including: Based on each of the specified target domain tasks, the task network initialized by the target meta-network is trained to obtain a second task network corresponding to each of the specified target domain tasks; For each of the specified target domain tasks, based on the obtained second weight, the feature values ​​of the samples of each sample category in the support set of the specified target domain task at the corresponding second preset intermediate layer of the second task network are mixed with the category prototypes of similar sample categories in the multiple source domain tasks, to obtain the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer, wherein the second preset intermediate layer is any intermediate network layer of the second task network; The feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer are respectively input into the next network layer of the second preset intermediate layer of the corresponding second task network until the second to last network layer, so as to obtain the feature values ​​of each sample in the support set of the new target domain task.

6. The method for obtaining a task network in meta-learning according to claim 5, characterized in that: Based on the obtained second weight, the feature values ​​of samples of each sample category in the support set of the specified target domain task at the second preset intermediate layer of the second task network are mixed with the category prototypes of similar sample categories in the multiple source domain tasks to obtain the feature values ​​of each sample in the support set of the new target domain task at the second preset intermediate layer, including: For each sample category in the support set of the specified target domain task, calculate the category prototype of the sample category at the second preset intermediate layer, and select a source domain category prototype similar to the sample category from the category prototypes of each sample category of each source domain task at the second preset intermediate layer based on the category prototype of the sample category at the second preset intermediate layer; For each sample category in the support set of the specified target domain task, the feature values ​​of each sample of the sample category in the specified target domain task at the second preset intermediate layer are mixed with similar source domain category prototypes based on the obtained second weight corresponding to the sample category, so as to obtain the feature values ​​of each sample of the sample category in the support set of the new target domain task at the second preset intermediate layer.

7. The method for obtaining a task network in meta-learning according to claim 6, characterized in that: The second weight corresponding to the sample category in the support set of the specified target domain task is obtained by generating it based on the similarity between the category prototype of the sample category in the support set of the specified target domain task and the similar category prototype of the source domain.

8. The method for obtaining a task network in meta-learning according to claim 1, characterized in that: For the specified target domain task, the classification loss of the target task network corresponding to the specified target domain task in the query set of the target domain task is obtained.

9. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for acquiring a task network in meta-learning according to any one of claims 1 to 8.

10. A computer-readable storage medium, wherein the computer-readable storage medium is a non-volatile storage medium or a non-transient storage medium, and a computer program is stored thereon, wherein: When the computer program is executed by a processor, the method for acquiring a task network in meta-learning according to any one of claims 1 to 8 is executed.

Citation Information

Patent Citations

  • Infrared image target detection method based on deep transfer learning and extreme learning machine

    CN110427875A