Data processing method, device, computer equipment, medium and program product

By constructing alternating updates of reference network models and metanets and dynamically adjusting the association relationship, the problem of poor generalization ability of models in the existing technology is solved, the ability to maintain old task knowledge when learning new tasks is realized, and the generalization ability of models is improved.

CN114358250BActive Publication Date: 2025-08-15TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111671024.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-08-15
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

The existing playback-based model learning methods are prone to overfitting on old tasks, resulting in poor generalization ability of the model in practical applications.

Method used

Build a reference network model, combine the meta-image sample set and the training image sample set, update the meta-network in the target model, iterate the main network through association relationships, realize bilateral alternation updates, and dynamically adjust the association relationship between new and old tasks.

Benefits of technology

The generalization ability of the model is improved, and it can maintain knowledge of past tasks while learning new tasks, avoid forgetting, and achieve better task adaptability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114358250B_ABST
    Figure CN114358250B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a data processing method, apparatus, computer equipment, medium and program product, which includes: constructing a reference network model according to a target model, the reference network model including a reference main network; obtaining a meta-image sample set, and training the reference network model with a training image sample set and a meta-image sample set to obtain a meta-loss, and using the meta-loss to update the meta-network in the target model to obtain an updated meta-network; performing recognition processing on the training image sample set according to the updated meta-network and the main network after one or more trainings to obtain the association relationship between sample images of different tasks included in the training image sample set; iteratively updating the main network after one or more trainings based on the association relationship until a trained target model is obtained, and the trained target model is used for image recognition processing. Through the embodiment of the present application, the generalization ability of the model can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data processing method, apparatus, computer equipment, medium, and program product. Background Art

[0002] With the continuous advancement of computer technology, models can be trained by learning from sample data. This trained model can then be used for subsequent data processing, improving user efficiency during the data processing phase. Currently, due to the large number of samples required for model training, continuous learning methods can be used to improve model performance. Continuous learning requires that the model avoid forgetting knowledge from previously learned tasks while learning new ones. Therefore, current continuous learning-based model training methods are typically rehearsal-based, such as experience replay. Replay-based model learning methods retain a small amount of data from past tasks as a memory cache, which can then be combined with data from new tasks for model training. However, practice has shown that current replay-based model learning methods are prone to overfitting on old tasks, resulting in poor generalization of the learned models in practical applications. Summary of the Invention

[0003] The embodiments of the present application provide a data processing method, apparatus, computer equipment, medium, and program product, which can effectively improve the generalization ability of the model.

[0004] In one aspect, an embodiment of the present application provides a data processing method, comprising:

[0005] Construct a reference network model based on the target model. The reference network model includes a reference main network. The reference main network is obtained by copying the main network after one or more training of the target model. The main network of the target model is trained one or more times using the training image sample set.

[0006] Obtaining a meta-image sample set, and using the training image sample set and the meta-image sample set to train the reference network model to obtain a meta-loss, and using the meta-loss to update the meta-network in the target model to obtain an updated meta-network;

[0007] Performing recognition processing on the training image sample set based on the updated meta-network and the main network after one or more trainings, and obtaining the association relationship between the sample images of different tasks included in the training image sample set;

[0008] Based on the association relationship, the main network after one or more trainings is iteratively updated until a trained target model is obtained. The trained target model is used for image recognition processing.

[0009] In one aspect, an embodiment of the present application provides a data processing device, comprising:

[0010] A construction module is used to construct a reference network model based on the target model. The reference network model includes a reference main network. The reference main network is obtained by copying the main network after one or more training of the target model. The main network of the target model is trained one or more times using a training image sample set.

[0011] An acquisition module, used for acquiring a meta-image sample set;

[0012] A training module is used to train the reference network model using the training image sample set and the meta-image sample set to obtain a meta-loss, and to update the meta-network in the target model using the meta-loss to obtain an updated meta-network;

[0013] a processing module, configured to perform recognition processing on the training image sample set based on the updated meta-network and the main network after one or more trainings, and obtain association relationships between sample images of different tasks included in the training image sample set;

[0014] The training module is also used to iteratively update the main network after one or more trainings based on the association relationship until a trained target model is obtained. The trained target model is used for image recognition processing.

[0015] On the one hand, an embodiment of the present application provides a computer device, comprising: a processor, a memory, and a network interface; the processor is connected to the memory and the network interface, wherein the network interface is used to provide network communication functions, the memory is used to store program code, and the processor is used to call the program code to execute the data processing method in the embodiment of the present application.

[0016] Accordingly, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the data processing method in the embodiment of the present application is executed.

[0017] Accordingly, embodiments of the present application provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the data processing method provided in one aspect of the embodiments of the present application.

[0018] The data processing solution provided in this application can help update the meta-network by constructing a reference network model and combining the meta-image sample set and the training image sample set. The updated meta-network is combined with the main network after one or more trainings to intelligently mine the correlation between sample images of different tasks. The correlation between sample images of different tasks changes dynamically with the change of network parameters of the meta-network rather than being fixed. In this way, the correlation between tasks can be better obtained through the correlation relationship, and the main network of the target model is iteratively updated according to the correlation relationship. It can be seen that the establishment of the reference network model can also realize the alternating update of the main network and the meta-network. The bilateral optimization alternation method can better adjust the correlation relationship in the iterative update of the meta-network and the main network, help the main network to be optimally optimized, and thus achieve better generalization effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0020] Figure 1a This is a schematic diagram of a processing principle of experience replay provided by an exemplary embodiment of the present application;

[0021] Figure 1b This is a schematic diagram of another processing principle of experience replay provided by an exemplary embodiment of the present application;

[0022] Figure 2 is an architectural diagram of a data processing system provided by an exemplary embodiment of the present application;

[0023] Figure 3 is a flowchart of a data processing method provided by an exemplary embodiment of the present application;

[0024] Figure 4 is a flowchart of a method for training a main network provided by an exemplary embodiment of the present application;

[0025] Figure 5 is a schematic diagram of a main network update of a target model provided by an exemplary embodiment of the present application;

[0026] Figure 6 is a flowchart of another data processing method provided by an exemplary embodiment of the present application;

[0027] Figure 7This is a schematic diagram of the relationship between gradient direction and loss weight provided by an exemplary embodiment of the present application;

[0028] Figure 8 is a schematic diagram of a reference network model assisted meta-network update provided by an exemplary embodiment of the present application;

[0029] Figure 9 This is a schematic diagram of a model training algorithm process provided by an exemplary embodiment of the present application;

[0030] Figure 10 is a structural diagram of a residual module provided by an exemplary embodiment of the present application;

[0031] Figure 11a This is a data comparison result diagram provided by an exemplary embodiment of the present application;

[0032] Figure 11b is another data comparison result diagram provided by an exemplary embodiment of the present application;

[0033] Figure 11c This is another data comparison result diagram provided by an exemplary embodiment of the present application;

[0034] Figure 12 It is a structural diagram of a data processing device provided by an exemplary embodiment of the present application;

[0035] Figure 13 It is a structural diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0037] In order to better understand the solutions of the embodiments of the present application, the relevant terms and concepts that may be involved in the embodiments of the present application are first introduced below.

[0038] (1) Continual Learning: This means that the model can continuously learn new tasks while retaining information about previously learned tasks.

[0039] (2) Catastrophic Forgetting: This is the main problem in continuous learning. It means that when the model learns a new task, it will pay too much attention to the new task and almost completely forget the tasks it has learned in the past.

[0040] (3) Memory Buffer: A small amount of data from past tasks is selected and stored in the cache. Usually, the size of the memory buffer is pre-set and remains fixed, regardless of the number of past tasks.

[0041] (4) Experience Replay: This is a basic model for continuous learning. It combines the memory cache with new task data and trains the model using the same method, thus preventing the model from forgetting past tasks. Both ER and DER (Dark Experience Replay) are algorithms based on memory cache replay. The following briefly introduces these two algorithms.

[0042] (4.1) ER is a basic algorithm for continuous learning. The specific processing principle is as follows: Figure 1a As shown, the classification neural network is defined as Where θ represents the parameters of the neural network, and c(t) represents the number of categories that the model has seen when the tth task arrives. The basic idea of ER is to train the data in the memory cache together with the new task to avoid forgetting. Its objective function can be written as:

[0043]

[0044] in, Represents the new task loss The weight of Indicates memory cache loss The weight of is an n-dimensional row vector of all ones, and λ is a pre-set hyperparameter. The new task loss and the memory cache loss both use cross-entropy loss (CE Loss), which can be calculated using the corresponding predicted labels and true labels.

[0045] (4.2) Compared with ER, DER introduces Mean Square Error Loss (MSE Loss) to further avoid forgetting. The specific processing principle is as follows Figure 1b Specifically, DER retains the probability prediction values output by the network trained on past tasks, and hopes that when the model trains a new task, the probability prediction values output on the memory cache are close to the corresponding retained probability values (the MSE loss of the two is small). Its objective function can be expressed as:

[0046]

[0047] Among them, the weight of the new task loss is consistent with ER, that is, The weight of memory cache loss is Among them, λ CE and λ MSE It is a manually preset hyperparameter.

[0048] However, these two experience replay methods are not very effective for continuous learning. This is because the memory cache retains a small number of samples, the model has overfitting problems on old tasks, and the above solutions do not explore the relationship between new and old tasks well.

[0049] (5) Meta-learning: It is to guide network learning through constructed meta-data to enhance the generalization and stability of the model.

[0050] (6) Artificial Intelligence (AI): A theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to achieve the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is also the study of the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is an interdisciplinary subject that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.

[0051] Computer vision (CV) is the science of making machines "see." Specifically, it refers to machine vision, which uses cameras and computers to replace the human eye in identifying and measuring objects, and then further processes the images to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, aiming to build artificial intelligence systems that can extract information from images or multidimensional data. Computer vision technologies generally include image processing, image recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping, autonomous driving, and smart transportation. It also includes common biometric recognition technologies such as facial recognition and fingerprint recognition. Machine learning (ML) is a multidisciplinary interdisciplinary field that involves probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning generally include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by formula. In the solution provided in this application, the recognition processing of sample images and meta-sample images by calling the network in the corresponding model can use image recognition in computer vision technology, and the target model is trained using a training image sample set of a mixture of new and old tasks, which belongs to the continuous learning included in machine learning and deep learning.

[0052] The architecture of the data processing system provided in the embodiments of the present application will be introduced below with reference to the accompanying drawings.

[0053] See Figure 2 , Figure 2 This is a structural diagram of a data processing system provided by an exemplary embodiment of the present application. Figure 2 As shown, it includes a database 200 and a data processing device 201. The data processing device 201 and the database 200 can be connected to each other in a wired or wireless manner.

[0054] Database 200 can be a local database of data processing device 201 or a cloud database accessible to data processing device 201. Database 200 can be used to store a training image sample set, which includes sample images of multiple categories, each sample image carrying a category label. The training image sample set can be a public image classification dataset such as CIFAR-10, CIFAR-100, Tiny ImageNet, etc., or a user-defined image classification dataset, such as an image classification dataset created using image data collected from the internet.

[0055] The data processing device 201 can be a terminal device or a server. In one embodiment, the terminal device can be a smartphone, tablet computer, smart wearable device, smart voice interaction device, smart home appliance, personal computer, vehicle-mounted terminal, etc., without limitation. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Without limitation.

[0056] The data processing device 201 can be used to carry the target model and the reference network model, and the target model and the reference network model can be used to alternately optimize and update the main network and the meta-network. The interaction process between the data processing device 201 and the database 200 is as follows:

[0057] 1) Data processing device 201 obtains a training image sample set from database 200. In one embodiment, the training image sample set can be divided into image sample subsets according to N tasks, where N is an integer greater than or equal to 1. That is, each image sample subset corresponds to one task and includes one or more sample images from at least one category. Subsequent processing selects sample images from the training batch based on the task and inputs them into the target model or reference network model for calculation.

[0058] 2) Data processing device 201 uses the training image sample set to train the main network in the target model one or more times. In one embodiment, a training batch of sample images from the new and old tasks in the training image sample set can be extracted to train the main network once. The one or more training sessions can include training the main network a smaller number of times (e.g., 1, 3, or 5 times), with each training session selecting data from different training batches. These training batches of data can be pre-selected or acquired in real time.

[0059] 3) After one or more training sessions, the master network of the target model that has been trained one or more times is copied and used together with the meta-network to construct a reference network model. The copied master network that has been trained one or more times is called the reference master network.

[0060] 4) Data processing device 201 obtains a meta-image sample set and uses the meta-image sample set and the training image sample set to update the meta-network in the target model using the reference network model, thereby obtaining an updated meta-network. In other words, the meta-network update is implemented within the constructed reference network model. In one embodiment, the meta-image sample set is obtained by balanced sampling from one or more sample images included in different tasks and can be considered a subset of the training image sample set.

[0061] 5) Data processing device 201 invokes the updated meta-network and the primary network, which has been trained once or multiple times, to perform recognition processing on the training image sample set and obtain associations between sample images for different tasks. In one embodiment, invoking the updated meta-network and the primary network, which has been trained once or multiple times, to process data together can be conditional, for example, requiring the invocation only after the meta-network has been updated a preset number of times. Otherwise, the associations here are manually set using the preset associations. Based on the associations, the primary network, which has been trained once or multiple times, is then iteratively updated for processing the training image sample set. The specific iterative update method is similar or identical to the one or more training processes.

[0062] Repeat steps 3) to 5) above, including building a reference network model based on the current latest target model, obtaining a meta-image sample set, updating the meta-network in the target model, and updating the main network of the target model using the updated meta-network and training image sample set, until a trained target model is obtained.

[0063] It can be seen that the data processing system provided in the embodiment of the present application, after the main network and meta-network are updated in sequence, starts training the main network again, and then iteratively updates the main network and meta-network in a subsequent cycle. It can dynamically adjust the correlation between the meta-network output during the training process, and further explore the relationship between different tasks. Among them, the target model and the reference network model are a continuous learning model based on meta-learning. It can construct a balanced metadata dataset to train the meta-network during the training of new tasks. The correlation between sample images of different tasks is evaluated through meta-learning, taking into account the relationship between different tasks, which can effectively improve the generalization ability of the model.

[0064] The following is a detailed description of the specific implementation of the data processing method proposed in the embodiment of the present application in conjunction with the accompanying drawings. Figure 3 , Figure 3This is a flow chart of a data processing method provided by an exemplary embodiment of the present application. The method can be performed by a computer device (e.g. Figure 2 The data processing method includes but is not limited to the following steps.

[0065] S301: Construct a reference network model according to the target model.

[0066] The reference network model includes a reference main network, which is obtained by copying the main network of the target model after one or more trainings, and the main network of the target model is trained one or more times using a training image sample set.

[0067] That is to say, the main network of the target model is first trained once or multiple times using the training image sample set to obtain the main network after one or more trainings. Then, the main network after one or more trainings is copied and used as the reference main network. The reference main network and the meta-network in the target model are together constructed as a reference network model.

[0068] The training image sample set can be a public image classification dataset obtained from a database, such as one or more of CIFAR-10, CIFAR-100, Tiny ImageNet, etc., or a user-defined image classification dataset, for example, an image classification dataset created by labeling image data collected from the internet. The training image sample set includes sample images of multiple categories, each of which carries a category label. In one embodiment, the training image sample set can be divided into image sample subsets according to N tasks, i.e., each image sample subset corresponds to a task, and each image sample subset includes one or more sample images of at least one category.

[0069] The main network (Main Net) of the target model can be any commonly used basic network, such as residual network ResNet, convolutional neural network (CNN), recursive neural network, etc. The main network of the target model is denoted as f(·; θ), where θ represents the network parameters of the main network. The main network in the target model can be trained once or multiple times using the training image sample set. The one or more trainings of the main network are generally a small number of trainings, for example, the main network may be trained once, or it may be trained multiple times (for example, 5 times, 6 times), and the number of trainings can be customized. For the detailed process of one or more trainings, please refer to Figure 4The introduction in the corresponding embodiment will not be described in detail here. The meta-network (Meta Net) of the target model can be a fully connected layer MLP (Multilayer Perceptron, also known as a multi-layer perceptron, which belongs to a multi-layer fully connected neural network model), and the meta-network is denoted as g(·; φ), where φ represents the network parameters of the meta-network.

[0070] The main network after one or more trainings is copied to obtain a reference main network, also known as a temporary main network. The network parameters of the reference main network are the same as those of the main network after one or more trainings. For example, the network parameters of the main network obtained by training in step p are θ p , then the network parameters of the reference main network are also θ p , that is, the two networks are identical. The reference main network is used as a reference network model to facilitate subsequent updating of the auxiliary meta-network. For details, see step S302 below.

[0071] It should be noted that the network parameters of the copied reference master network can be adjusted to facilitate meta-learning. However, since the reference network model primarily serves to facilitate meta-network updates, updates to the reference master network do not affect the subsequent network parameters of the master network in the target model. For the meta-network, during one or more training runs of the target model's master network, the meta-network in the target model maintains its initialized network parameters. After one or more training runs are complete, the reference network model can be constructed in conjunction with the master network after one or more training runs to update the initialized meta-network.

[0072] S302, obtaining a meta-image sample set, and using the training image sample set and the meta-image sample set to train the reference network model to obtain a meta-loss, and using the meta-loss to update the meta-network in the target model to obtain an updated meta-network.

[0073] Since in the setting of continuous learning, only the data in the memory cache can be used to avoid forgetting, and no additional data sets can be used, the data in the meta-image sample set includes data collected from the memory cache. In one embodiment, the obtained meta-image sample set includes multiple meta-sample images, and the meta-image sample set is obtained by balancing the current sample images included in the new task and the historical sample images included in the old task. Among them, the new task and the old task are both tasks in the training image sample set, the difference is whether the target model has learned them. Specifically, the new task refers to the task that the target model is learning, and the old task is the task that the target model has already learned. Here, the sample image included in the new task is referred to as the current sample image, and the sample image included in the old task is referred to as the historical sample image. Optionally, the meta-image sample set is also called the meta-data set, and the training image sample set is also called the training data set.

[0074] A balanced collection method can be to collect an equal number of sample images from each learned and currently learned task. For example, the training image sample set includes 10 tasks, the new task being learned is the fifth task, and the previously learned tasks include four tasks. Each task includes 20 sample images from two categories. Six sample images can be collected in equal quantities from each of the five tasks and combined into a meta-image sample set, i.e., the meta-image sample set includes 30 meta-sample images. Because the meta-image sample set is obtained through balanced collection, the distribution of sample images for different tasks is uniform, which can guide the meta-network to extract correlations between sample images from different tasks.

[0075] For the training of the reference network model, the reference main network included in the reference network model can be iteratively updated using the training image sample set and the meta-network. Then, the iteratively updated reference main network is used to process the meta-image sample set to obtain the meta-loss. The meta-loss here can be the total loss or average loss of each meta-sample image in the meta-image sample set. Then, the meta-loss can be back-propagated to the meta-network, and the meta-loss can be used to perform gradient descent calculation to update the meta-network. For more details, please refer to the following Figure 6 The corresponding embodiments are not described in detail here.

[0076] After the meta-network in the target model is updated according to the above method, the updated meta-network can also be synchronized to the target model. The updated meta-network can then better assist the main network in iterative updates. For details, see the following steps.

[0077] S303: performing recognition processing on the training image sample set according to the updated meta-network and the main network after one or more trainings, and obtaining association relationships between sample images of different tasks included in the training image sample set.

[0078] The updated meta-network can be synchronized to the target model, and combined with the main network that has been trained once or multiple times in the target model to perform recognition processing on the training image sample set. In one embodiment, the main network that has been trained once or multiple times is first used to perform recognition processing on the training image sample set to obtain a recognition result. According to the recognition result and the updated meta-network, an association relationship can be determined. The association relationship is used to characterize the correlation between sample images of different tasks, where different tasks refer to new tasks and old tasks. For example, the knowledge of dogs in past tasks (i.e., old tasks) may be helpful for the recognition of cats in new tasks (both are animal categories), but may not be helpful for the classification of cars in the new task. Therefore, the cat in the new task and the dog in the old task are related categories, that is, the sample images of the new and old tasks are related, and are characterized by a specific association relationship. For the specific implementation of this step, please refer to the following Figure 6 The corresponding embodiments will not be described in detail here.

[0079] In one embodiment, a warm-up condition can be set for the updated meta-network in this step: that is, the number of meta-network updates reaches a preset number of updates. If this condition is not met, this step can only use the main network after one or more trainings to perform recognition processing on the training image sample set. The specific processing process is similar to the one or more training stages. That is, the iterative update of the main network after one or more trainings does not rely on the association relationships obtained with the participation of the meta-network. This is because in the early stages of training, the meta-network's estimation of the association relationships is unstable. After a certain period of training, this instability can be reduced, improving the overall training effect of the model.

[0080] S304, iteratively updating the main network after one or more trainings based on the association relationship until a trained target model is obtained.

[0081] Based on the associations obtained by processing the training image sample set using the updated meta-network in conjunction with the master network after one or more training cycles, these associations can be applied to the backpropagation parameters corresponding to the master network after one or more training cycles to adjust the network parameters of the master network after one or more training cycles. In one embodiment, when the number of iterative updates of the master network after one or more training cycles meets a set update condition, the reference master network included in the reference network model is updated based on the updated master network after one or more training cycles. The set update condition can be a threshold for the number of iterative updates. Here, updating the reference master network simply replaces the network parameters of the reference master network with those of the updated master network after one or more training cycles, rather than performing complex calculations based on the reference master network. That is, after multiple updates to the master network after one or more training cycles, the iteratively updated master network can also be copied to the reference network model to update the reference master network in the reference network model, thereby achieving better generalization of the iteratively updated master network in processing the meta-image sample set. In this way, the reference network model includes the latest updated reference main network, which can further update the updated meta-network and repeat the above steps S303 and S304. That is, the two networks are updated alternately in different models to finally obtain the trained target model.

[0082] In one embodiment, the trained target model is used to perform image recognition processing. For example, when an image of a cat is input, the trained target model can quickly identify the category of the image as a cat.

[0083] It should be noted that during any of the aforementioned network training processes, the training data can be randomly flipped, rotated, and so on, while keeping its labels unchanged, thereby achieving data augmentation. This operation can increase the diversity of the dataset and, to a certain extent, avoid model overfitting.

[0084] This solution can be used in open environments and tasks. In reality, models often need to continuously learn and adapt to a variety of scenarios. Limited by data storage or privacy restrictions, only a small amount of past data is available. This requires the model to adapt to new environments while not forgetting previously learned knowledge. For example, an e-commerce platform can continuously learn new product preferences from users while retaining past preferences.

[0085] In the solution provided in the embodiment of the present application, the two networks included in the target model, namely the main network and the meta-network, are optimized bilaterally by constructing a reference network model. This bilateral alternating optimization method iteratively updates the main network included in the target model, and iteratively updates the meta-network in the target model with the assistance of the reference network model. During the training process, the correlation between new and old tasks can be dynamically adjusted as the network parameters change, thereby deeply exploring the correlation between new and old tasks, so that the model achieves better generalization.

[0086] See Figure 4 , is a flowchart of a method for training a main network once or multiple times provided by an exemplary embodiment of the present application, specifically involving an introduction to a method of training a main network of a target model once or multiple times using a training image sample set, and obtaining a main network after one or more trainings. The method can be performed by a computer device (e.g. Figure 2 The method is executed by the data processing device 201 shown in the figure, and includes but is not limited to the following steps.

[0087] S401: Obtain a training image sample set.

[0088] The training image sample set includes sample images of N tasks, and the sample images of each task can include one or more sample images of the same category or different categories. The tasks here can be manually divided tasks or automatically divided tasks. For example, the public image classification dataset CIFAR-10 (containing 10 categories, each class has 50,000 training images and 10,000 test images) is divided into 5 tasks, each task is a binary classification problem. For example, CIFAR-100 (containing 100 categories) is divided into 10 tasks, each task is a multi-classification problem (1 to 10 categories or 1 to 20 categories). The training image sample set here is based on the task because the goal of meta-learning can be regarded as treating tasks as samples. By learning from multiple tasks, the meta-network can quickly and accurately learn new tasks.

[0089] S402: Acquire a training image sample subset from the training image sample set, and input one or more sample groups included in the training image sample subset into a target model.

[0090] The training image sample subset is a training batch of sample images collected from the training image sample set. The specific collection principle can be to collect equal amounts of sample images from the new task and the memory cache respectively. The number of sample images collected equally from the new task and the memory cache is recorded as b. A training batch includes 2b sample images. The training image sample subset is recorded as D train =D t ∪M t-1 ,in and represents the new task (i.e., the t-th task), represents the old task (i.e., the previous t-1 tasks), D t Includes sample images belonging to the new task, M t-1 Including sample images belonging to old tasks. It should be noted that since the sample images in the memory cache are obtained from some sample images in the old tasks, the sample images included in the memory cache can be regarded as a subset of all old tasks. Therefore, the M collected from the memory cache t-1 are still sample images belonging to the old task. In some cases, the It is equivalent to memory cache.

[0091] During one or more training runs of the target model's main network, a new training batch of sample images is collected at each iteration. Each batch of sample images is trained once through the main network (i.e., one forward pass and one backward pass). The network parameters are updated with each iteration, and each iteration is called an iteration. Using a small number of sample images (e.g., 2b data) from the new task and the memory cache as a training batch allows the main network to both learn new knowledge and retain old knowledge, thus ensuring continuous learning.

[0092] For the input of a batch of sample images, in this embodiment, it is a training image sample subset, specifically, the sample images included are divided into one or more sample groups and input into the target model. In one embodiment, a sample group includes a current sample image obtained from the new task and a historical sample image obtained from the memory cache; the historical sample images in the memory cache come from one or more historical sample images of the old task. The current sample image is also the sample image in the new task, and the historical sample image is also the sample image in the old task. The sample group can be a combination of a sample image of a new task and a sample image of an old task. For the 2b sample images in the training image sample subset, one current sample image (i.e., new task data) can be input each time. and historical sample images (i.e. memory cache data) Form a sample group (i.e., data pair) as the input of the target model.

[0093] S403: Call the main network of the target model to perform recognition processing on one or more sample groups to obtain training loss.

[0094] The main network of the target model recognizes and processes the sample images included in each sample group, and can obtain the training loss corresponding to each sample group, and then can know the loss of all sample images in the training image sample subset. Recognizing and processing the sample group and obtaining the training loss are the results of the main network's forward calculation of the sample images.

[0095] Training image sample subset D train Including 2b sample images, according to the above method, the sample group can be recorded as Each sample group is processed by the main network of the target model, and the training loss corresponding to the sample group is recorded as Therefore, each sample image in the training image sample subset has a corresponding loss, which is recorded as The loss calculation for any sample image can be as follows:

[0096]

[0097] Among them, l train (·,·) represents the training loss function, y i is the true category label of the i-th sample image, x i represents the i-th sample image, f(x i ; θ) represents the predicted label or predicted category probability value obtained by the main network f(·; θ) for the i-th sample image. Optionally, the training loss function can adopt one or more of the cross entropy loss function (CrossEntropyLoss, CELoss) or the mean squared error (MSE) loss function, or other loss functions, which are not limited here.

[0098] S404: train the main network of the target model one or more times using the training loss, and obtain the main network after the one or more trainings.

[0099] The process of training the main network one or more times using training loss, i.e., optimizing the main network, is considered backpropagation. Specifically, the training loss can be used to calculate gradient descent, obtaining updated gradients for iterative updates of the main network, and subsequently adjusting the network parameters of the main network. In one possible embodiment, a more detailed implementation of this step includes: ① obtaining preset associations for the sample images included in each sample group and updating the training loss using the preset associations; ② using the updated training loss to adjust the network parameters of the main network of the target model, thereby obtaining the main network after one or more training cycles.

[0100] The preset association relationship set for the sample images in the sample group can be a manually set loss weight pair. In one embodiment, in each batch of data sampled during training, a manually set loss weight can be pre-assigned to each data. This loss weight will be subsequently weighted to the corresponding training loss. The preset association relationship set for the sample images included in each sample group is denoted as Λ pre =(λ k ,λ b+k ) pre ,k=1,…,b, the preset association relationship of each sample group can be combined with the training loss of each sample group One-to-one correspondence, combining the loss weight of each sample group with the training loss can achieve optimization of the main network.

[0101] Specifically, the training loss can be updated by using the preset association relationship, that is, the training loss can be updated by using the loss weight. According to the above expression, Λ pre ·L trainThat is, it can be used as the updated training loss, and then the updated training loss can be used to calculate the average loss of the training image sample subset. The specific expression is as follows (Equation 2):

[0102]

[0103] Among them, |D train | represents the number of samples in the current training batch (here corresponding to the training image sample subset); Represents the training loss of the i-th sample image in the current training batch; since the meta-network in the target model is temporarily not used during one or more training processes, Represents the manually set loss weight.

[0104] The objective function for optimizing the main network is as follows (Equation 3):

[0105]

[0106] Use the average loss to calculate the current training batch data D train By performing a step of gradient descent, we can obtain the updated parameters of the main network, as shown in Equation 4):

[0107]

[0108] Among them, θ p+1 represents the network parameters after the main network is adjusted, θ p Indicates the current network parameters of the main network,

[0109] According to the above principles, in one embodiment, the main network after one or more trainings can be obtained by training once using the current training batch (i.e., a subset of training image samples), that is, the main network after the network parameters are adjusted once. In another embodiment, the main network after one or more trainings can also be the main network after the network parameters of the main network are adjusted multiple times. The above steps S402 to S404 can be repeated for each adjustment of the network parameters, that is, each time a new iteration is entered, a new training batch (i.e., a new subset of training image samples) is collected from the training image sample set, and in the same manner, the network parameters of the main network obtained based on the previous iteration are adjusted once using the training image sample subset. When the number of updates of the main network reaches a set number threshold (the set number threshold is recorded as interval, for example, interval = 5), the main network after the latest network parameter adjustment can be used as the main network after one or more trainings.

[0110] For the above process, please refer to Figure 5The schematic diagram of the main network update of a target model is shown in FIG, wherein the loss weight output by the meta-network is a manually set loss weight. After the meta-network is updated, the updated meta-network can be used to estimate the loss weight and help the main network find the most appropriate update gradient, that is, the loss weight and loss are combined to update the main network. The specific introduction of this method can be found in the following Figure 6 An introduction to the corresponding embodiment.

[0111] The solution provided by the embodiment of the present application combines a sample image of a new task and a sample image of an old task into a sample group. This sample group can associate the data of the new task and the old task, and input them into the main network for recognition processing, so that the main network learns new knowledge and remembers old knowledge; in addition, by assigning a preset association relationship to each sample group, the accuracy of the iterative update of the main network in the early stage of training can be guaranteed, and then an accurate reference network model can be constructed based on the main network of the target model, so that the results of the reference network model processing the training image sample set and the meta-image sample set have as little deviation as possible, so as to better assist the meta-network in updating.

[0112] The above embodiment mainly introduces the process of training the main network of the target model once or multiple times. This embodiment will focus on the update method of the meta-network and the process of using the updated meta-network to help the main network continue training after one or more trainings. Figure 6 , is a flow chart of another data processing method provided by an exemplary embodiment of the present application, including but not limited to the following steps.

[0113] S601: Construct a reference network model according to the target model.

[0114] S602: Acquire a meta-image sample set, and acquire a reference training image sample subset from the training image sample set.

[0115] The meta-image sample set is obtained by balancing the data of the new task and the old task. The reference training image sample subset is a training batch of data collected from the training image sample set. The specific collection principle can be the same as that of the training image sample subset described above, that is, an equal number of sample images are randomly collected from the new task and the memory cache, respectively, and combined into the reference training image sample subset. It should be noted that the reference training image sample subset and the training image sample subset are applied at different times. For example, the training image sample subset is used for the fourth iteration update of the main network in the target model, and the reference training image sample subset is used for the fifth iteration update of the main network in the target model. Since the reference network model has been constructed, it is specifically the first iteration update of the reference main network in the reference network model. The reference training image sample subset and the training image sample subset are data from different training batches, and the sample images contained in each may be completely different.

[0116] S603: Input each sample group included in the reference training image sample subset into the reference main network to obtain a reference loss and acquire a loss weight corresponding to the reference loss.

[0117] The reference primary network is a temporary primary network that is identical to the primary network after one or more training cycles. It can be obtained by copying the network parameters of the primary network in step 1 of the target model. Similar to the training image sample subsets, the reference training image sample subsets can also be input into the reference primary network for recognition processing in the form of sample groups to obtain a reference loss. A sample group includes a current sample image obtained from the new task and a historical sample image obtained from the memory cache. A reference loss is associated with each sample group and can include the loss of the new task and the loss of the previous task.

[0118] For the convenience of description, the sample images of a training batch collected from the training image sample set in the subsequent training stage are all D train =D t ∪M t-1 Marking, including the iterative image sample subset mentioned below, is just in different update stages, D train The sample images included may be different. For example, if the reference training image sample subset includes 2b data, the sample group can be divided into b groups. The relationship between each sample group and the reference loss is as follows (Equation 5):

[0119]

[0120] Among them, θ l Indicates the parameters of the reference main network (i.e. temporary main network), represents a sample image of the new task in a subset of reference training image samples, Represents sample images of old tasks in the sample subset of reference training images.

[0121] After obtaining the reference loss of each sample group, it can be used as the input of the meta-network in the target model, and the loss weight Λ corresponding to the reference loss of each sample group can be estimated by the meta-network. i ,λ b+i ), that is, the loss weight is obtained by inputting the reference loss into the meta-network of the target model. The mathematical expression of the meta-network's processing of the sample group is as follows (Equation 6):

[0122]

[0123] in, l train (·,·) represents the reference iterative loss function, such as the cross entropy loss function or the mean squared error loss function.

[0124] The basis for the meta-network to obtain the loss weight is as follows: if the memory cache data contains some information that is similar or semantically related to the new task data, then more attention can be paid to the new task, that is, the sample image assigned to the new task Larger loss weight λ i , so that the model learns the difference between new categories and old categories. On the contrary, if the semantic information of the memory cache data is very different from that of the new task data, then more attention can be paid to the old task, that is, the sample images in the memory cache are given Larger loss weight λ i+b , preventing the model from forgetting previously learned knowledge. The paired data used here (i.e., the loss weights corresponding to the sample groups) helps the meta-network explore the relationship between the sample images of the new and old tasks. This relationship refers to the semantic similarity between the new and old task data, that is, whether the two sample images are similar. This relationship is represented by the loss weights output by the meta-network. The loss weights output by the meta-network here help the updated reference main network achieve better generalization on the meta-image sample set.

[0125] Theoretically, the weight of the loss of the new and old tasks is Λ=[Λ D ,Λ M ] directly controls the gradient direction during model optimization (see Figure 7 ), that is, the gradient direction of each sampled batch of training data is directly determined by the weight of the loss of the new and old tasks. If the loss weights are always manually set and kept fixed during training, the relationship between tasks cannot be better explored. Therefore, a meta-network is used here to help the main network of the target model optimize towards the most appropriate gradient direction. This is because the loss weights of the new and old tasks can be dynamically adjusted during the iterative update process, further exploring the relationship between the new and old tasks. The loss weight determines the optimized gradient direction. By dynamically adjusting the loss weights, the most appropriate gradient direction can be found, thereby achieving better generalization of the model.

[0126] S604: Update the reference main network using the reference loss and the corresponding loss weight to obtain an updated reference main network.

[0127] The reference loss of the sample group of the reference training image sample subset obtained according to the above steps, and the loss weight obtained by inputting the reference loss into the meta-network, are the same as in formula 2 above, and the corresponding parameters are replaced with the parameters in this implementation. Specifically, the reference loss is weighted and summed according to the loss weight of each sample group to obtain the total loss of the reference training image sample subset. In order to further reduce the amount of calculation and increase the update speed of the reference main network, the total loss of the reference training image sample subset is averaged according to the number of sample images to obtain the average loss of the reference training image sample subset, and it is used in the calculation of gradient descent. The network parameters of the reference main network are updated by gradient descent to obtain the updated reference main network. The formula for gradient descent can be found in the following formula 7).

[0128]

[0129] Among them, θ l The parameters of the reference main network (i.e., the temporary main network) are copied from the network parameters of the main network in step 1, η θ Represents the learning rate, which can determine the speed of updating the model parameters. The updated parameters can be used as an estimate of θ * (φ), the estimated θ * (φ) refers to the updated network parameters of the reference main network.

[0130] S605: Input the meta-image sample set into the updated reference main network and obtain a meta-loss, so as to update the meta-network using the meta-loss to obtain an updated meta-network.

[0131] The updated reference main network, obtained after gradient descent through the reference main network, can be used to process the meta-image sample set. Unlike processing the reference training image sample subset in the training image sample set, no loss weight is configured for each meta-sample image in the meta-image sample set. Therefore, the meta-image sample set can be processed as a sample group or in other ways. Ultimately, the loss of each meta-sample image is obtained, and then the meta-loss of the meta-image sample set is obtained. Optionally, the mathematical expression of the meta-loss can be seen in the following formula 8):

[0132]

[0133] Among them, |D meta | represents the number of samples in the meta-image sample set, Represents the updated reference main network The loss obtained by processing the i-th meta-sample image in the meta-image sample set.

[0134] The optimization objective function of the meta-network is as follows:

[0135]

[0136] It can be seen that in the embodiment of the present application, optimization objective functions are designed for both the main network and the meta-network optimization. Among them, the optimization of the main network is also applicable to the update of the reference main network in the reference network model. The optimization of the meta-network is implemented in the constructed reference network model. Here, the above formulas 3) and 9) are collectively referred to as bilateral optimization objective functions.

[0137] Since the optimization of the meta-network requires the use of the latest updated parameters of the reference main network, the updated parameters of the reference main network can be used. As the estimated θ * (φ).

[0138] In one embodiment, the updated gradient of the meta-network can be calculated by the chain rule, specifically as shown in the following equation 10a):

[0139]

[0140] The above Substitute the gradient descent formula into is equivalent to the following

[0141] Formula 10b):

[0142]

[0143] Here you can remember:

[0144]

[0145] From the expression of G(j), we can see that the gradient of the meta-network update depends largely on the inner product distance between the gradient of the j-th sample image in the current training batch with respect to the main network and the average gradient of the meta-sample image with respect to the main network. In other words, if the average gradient of the sample image and the meta-sample image with respect to the main network is very similar, then the sample image is likely to be more useful for training the main network.

[0146] The above expression is organized using G(j), and the meta-network is updated using normal gradient descent, as shown in Equation 10d):

[0147]

[0148] where η φ represents the learning rate of the meta-network, φ l represents the network parameters obtained by the last update of the meta-network. The meanings of other parameters in Equations 10a) to 10d) can be found in the explanations in the above expressions and will not be repeated here.

[0149] The above steps update the meta-network through the meta-image sample set. Due to the adjustment of network parameters, the corresponding weights of the new and old task losses Λ=[Λ D ,Λ M ] can be adjusted dynamically and solved by bilateral optimization strategy to obtain better performance during testing. Combined with the above updates to the reference main network and meta-network, you can refer to Figure 8 Schematic diagram of reference network model assisted meta-network update.

[0150] S606 , performing recognition processing on the training image sample set according to the updated meta-network and the main network after one or more trainings, to obtain association relationships between sample images of different tasks included in the training image sample set.

[0151] In one embodiment, before executing step S606, it can be determined whether the number of updates of the reference network model auxiliary meta-network has reached an update threshold. If so, step S606 is executed. If not, a manually set preset association relationship is obtained, and the main network in the target model is updated in a similar manner to the one or more trainings of the main network. In other words, after a meta-network in the target model is updated once, it is not necessarily possible to combine it with the main network after one or more trainings to obtain the association relationship between sample images of different tasks. This setting is to ensure that the association relationship obtained by the meta-network is relatively accurate data, so that the main network can be better optimized and the overall performance can be effectively improved.

[0152] Looking at the aforementioned processing steps, it can be seen that the meta-image sample set can be used to guide the meta-network to extract the correlation, i.e., the association relationship, between the sample images of different tasks in the training image sample set. In one embodiment, the association relationship is a loss weight, which can be back-propagated with the iterative loss obtained by inputting the sample group of the new and old task combinations into the main network, and updating the main network through gradient descent calculation. This can help the main network find the appropriate gradient direction for optimization, thereby achieving better generalization. More detailed implementation steps may include the following 1) to 3):

[0153] 1) Obtain an iterative image sample subset from the training image sample set.

[0154] The iterative image sample subset is a training batch of sample images collected from the training image sample set, including sample images of different tasks. It should be noted that the iterative image sample subset, the training image sample subset, and the reference training image sample subset are sample images from different training batches. The training image sample subset and the iterative image sample subset are both samples for training the main network of the target model. The reference training image sample subset is used to perform a gradient descent on the reference main network. In one or more training phases, a new training image sample subset is collected for each training, and the loss obtained is combined with the manually set loss weight to train the main network of the target network; when the iterative image sample subset is used to train the main network, the updated meta-network is used to dynamically adjust the loss weight of the sample image to train the main network.

[0155] 2) Input each sample group included in the iterative image sample subset into the main network after one or more trainings to obtain the iterative loss.

[0156] Since the update of the reference main network of the reference network model does not affect the update of the main network in the target model, after the meta-network in the target model is updated, the iterative image sample subset can be used to update the main network after one or more trainings (i.e., continue training), obtaining an iterative loss. This iterative loss is used to adjust the network parameters of the main network after one or more trainings. The iterative loss here is calculated in the same way as the aforementioned training loss and reference loss, and will not be elaborated here. It should be noted that since the sample images are input at different training stages, the network parameters of the main network are different, and therefore the loss obtained is also different.

[0157] The iterative loss includes a first loss corresponding to a current sample image included in the corresponding sample group, and a second loss corresponding to a historical sample image included therein; the current sample image belongs to the new task, and the historical sample image belongs to the old task. The first loss corresponds to the current sample image of the new task, and the second loss corresponds to the historical sample image of the old task, specifically the historical sample image in the memory cache. Optionally, the first loss can be a cross-entropy loss, and the second loss can include one or both of a cross-entropy loss and a mean squared error loss. That is, the iterative loss includes the cross-entropy loss or the mean squared error loss for both the current sample image and the historical sample image, or the iterative loss includes the cross-entropy loss or the mean squared error loss for either the current sample image or the historical sample image, or the iterative loss includes the cross-entropy loss of the current sample image, the mean squared error loss of the historical sample image, and the cross-entropy loss of the historical sample image. Preferably, because the mean squared error loss is more suitable for regression problems, the mean squared error loss can be used for the historical sample images, so that the model strengthens its memory of knowledge of the old task.

[0158] 3) Inputting the first loss and the second loss into the updated meta-network to obtain the loss weight of the first loss and the loss weight of the second loss, respectively. The loss weight of the first loss and the loss weight of the second loss are used to indicate the association relationship between a corresponding current sample image and a corresponding historical sample image.

[0159] Corresponding to the contents included in the first loss and the second loss, the loss weight of the second loss may include one or two; in one embodiment, the loss weight corresponding to the iterative loss is (λ i ,λ i+b ), which can be applied to experience replay ER. In another embodiment, the loss weight corresponding to the iterative loss can also be That is, the loss weight of the first loss is λ i , the loss weight of the second loss can include two, recorded as: Represent the loss weights corresponding to the cross entropy loss and the mean square error loss, respectively, and can be applied to the experience replay DER. Optionally, the loss weights corresponding to the first loss and the second loss can also be a combination of any two of the above three, for example

[0160] The loss weight corresponding to the iterative loss can indicate the correlation between the current sample image and the historical sample image. The loss weight is (λ i ,λ i+b ) as an example, the association relationship is as follows: i >λ i+b When , it means that more attention is paid to the new task. According to the processing principle of the aforementioned meta-network, it can be inferred that the current sample image and the historical sample image contain semantically similar information. This is done to allow the model to learn the difference between the new task and the old task; when λ i <λ i+b When , it means that more attention is paid to the memory cache, that is, to the old tasks. Similarly, we can know that the similarity between the current sample image and the historical sample image is not great. This setting is to avoid forgetting old knowledge while learning new knowledge.

[0161] S607, iteratively updating the main network after one or more trainings based on the association relationship until a trained target model is obtained, and the trained target model is used for image recognition processing.

[0162] In one embodiment, the association relationship is the loss weight of the iterative loss obtained above. The specific implementation of iteratively updating the main network after one or more trainings based on the loss weight can be: performing weighted summation processing on the iterative losses based on the loss weight to obtain the total loss, and averaging the loss based on the number of samples in the iterative image sample subset to speed up the gradient calculation and the convergence of the main network. After the main network after one or more trainings is iteratively updated a certain number of times, the latest updated main network is copied as the reference main network in the reference network model, and then the same processing steps as above are used to update the main network and the meta-network. In other words, the update of the main network in the target model has an impact on the reference main network in the reference network model, and such an impact is the basis for achieving bilateral optimization.

[0163] In an embodiment of the present application, since the loss weight output by the meta-network mines the correlation relationship between the sample images of the new and old tasks, the reference main network is updated based on the correlation relationship, which can help the updated reference main network achieve the best generalization effect on the meta-image sample set. The meta-loss obtained by processing the meta-image sample set by the updated reference main network can be used to more accurately adjust the network parameters of the meta-network itself. Subsequently, the updated meta-network is applied to the target model, which can avoid overfitting to a certain extent.

[0164] Based on the content introduced in the above embodiment, the process involved in the overall training algorithm is briefly summarized as follows: Figure 9 The solution provided in this embodiment is called a relational experience replay training algorithm, which can be applied to ER or DER (ie, a relational ER / DER training algorithm).

[0165] The input parameters used by the target model and the reference network model include: new task data Memory cache data The maximum number of iterations of a task Iter max , training interval Iterval, number of iterations of evaluating the meta-network Iter meta , preset hyperparameter Λ pre The output includes: the parameters of the two networks θ, φ

[0166] The specific algorithm flow is as follows:

[0167] When the new task data is not empty (that is, the goal of the entire algorithm is to train a new task), the network parameters of the two networks included in the target model are initialized, which are θ 0 ,φ 0 , and the number of iterations inter=0;

[0168] When inter <Iter max , that is, before the network iteration number reaches the set maximum number of iterations, the following content is executed cyclically:

[0169] 1) Collect a training batch of data from the training image sample set

[0170] 2) Check if inter%Iterval is 0, that is, whether inter is divisible by Iterval. This means that every time the main network reaches the training interval, it will execute the following:

[0171] Copy the network parameters θ of the main network (inter) To the temporary main network;

[0172] Get the updated parameters according to the principle of main network update And update the temporary main network;

[0173] According to the principle of meta-network update, the update parameter φ is obtained (inter+1) , and the current network parameters φ of the meta-network (inter) Make updates;

[0174] 3) If the number of iterations inter>Iter meta , that is, the update of the meta-network reaches the preset number of iterations, then the loss weight Λ is estimated by the meta-network;

[0175] 4) According to the optimization of the main network in the bilateral optimization objective function, the updated network parameters θ are obtained (inter+1) , perform an iterative update on the main network; add 1 to the number of iterative updates.

[0176] Combined with the above content, Figure 9 Lines 5-9 marked with the row labels in represent the steps of updating the meta-network. Because bilateral optimization is usually slow, the meta-network is updated once after an update interval (interval, that is, a few steps of gradient descent) of the main network, that is, the meta-network is updated once after each update of the main network in the target model. In addition, when encountering a new task, this technical solution also uses a warm-up step (lines 10-14 in Algorithm 1) because the meta-network needs to be trained several times before a stable estimate of the loss weight is obtained. Specifically, in the first Iter meta The loss weight Λ used in the optimization of the main network parameters in the step iteration pre is manually preset. After a soft start, Λ is estimated by the meta-network.

[0177] For the design of the main network in the target model, any commonly used basic network can be used. In the embodiment of the present application, ResNet-18 is used as the main network as an example. An example of the detailed design of the model is shown in Table 1.

[0178] Table 1 Model detailed design example

[0179]

[0180]

[0181] The stride of the first layer of Conv3_x and Conv4_x is 2. Each convolution layer is followed by a ReLU (activation function) layer and a Batch Normalization (batch normalization) layer. The structure of each module (block) is as follows Figure 10 As shown, the last layer of the network is a fully connected layer (MLP), whose output dimension is the number of classified categories.

[0182] Specific training parameter settings: For the main network optimization, stochastic gradient descent (SGD) is used, and the initial learning rate is set to 0.03; for the meta-network optimization, Adam algorithm is used, and its initial learning rate is set to 0.001, and weight decay is set to 10 -4 .

[0183] Training dataset: The public CIFAR-10, CIFAR-100, and Tiny ImageNet classification datasets are used as training datasets.

[0184] Using the above settings and combining the processing logic of this solution, the final specific data is compared with the data obtained by currently commonly used ER and DER processing, which can be seen in Figures 11a to 11b , Figure 11a The table shown in the table compares the proposed technology (RER and RDER) with existing commonly used methods on the CIFAR-10 and TinyImageNet datasets, and with different memory cache sizes. Figure 11b The table shown in the table compares the current technical solution (RER and RDER) with the existing commonly used methods on the CIFAR-100 dataset and with different memory cache sizes. Figure 11c The table shown in is the comparison result of this technical solution on the CIFAR-10 dataset when the memory cache is small.

[0185] Will Figure 11a and Figure 11bThe comparison of the tables shown shows that in the continuous learning scenario, the relationship between new and old tasks is dynamically adjusted through meta-learning, so that the model can be optimized along a more reasonable gradient direction, and achieve better generalization in the test phase, thereby improving the accuracy of the model; Figure 11c From the comparison of the tables shown, it can be found that when the memory cache is very small, this method can significantly improve the performance and greatly avoid the overfitting problem. That is, when the number of samples retained in the memory cache is small, this scheme can show better generalization.

[0186] The solution provided by the embodiments of this application can be applied in continuous learning scenarios. By dynamically adjusting the relationship between new and old tasks through meta-learning, the model can be optimized along a more reasonable gradient direction, achieving better generalization and improving model accuracy during the testing phase. Furthermore, given that the memory cache capacity is often limited and can only store a small amount of data, this solution can effectively identify and process this data, avoiding overfitting.

[0187] See Figure 12 , Figure 12 This is a structural diagram of a data processing device provided by an exemplary embodiment of the present application. The above-mentioned data processing device can be a computer program (including program code) running on a computer device, for example, the data processing device is an application software; the data processing device can be used to execute the corresponding steps of the method provided by the embodiment of the present application. Figure 12 As shown, the data processing device 1200 may include: a construction module 1201, an acquisition module 1202, a training module 1203, and a processing module 1204.

[0188] A construction module 1201 is configured to construct a reference network model based on the target model. The reference network model includes a reference main network, which is obtained by copying the main network of the target model after one or more trainings. The main network of the target model is trained one or more times using a training image sample set.

[0189] An acquisition module 1202 is configured to acquire a meta-image sample set;

[0190] A training module 1203 is configured to train the reference network model using the training image sample set and the meta-image sample set to obtain a meta-loss, and to update the meta-network in the target model using the meta-loss to obtain an updated meta-network;

[0191] The processing module 1204 is configured to perform recognition processing on the training image sample set based on the updated meta-network and the main network after one or more trainings, and obtain association relationships between sample images of different tasks included in the training image sample set;

[0192] The training module 1203 is further used to iteratively update the main network after one or more trainings based on the association relationship until a trained target model is obtained. The trained target model is used for image recognition processing.

[0193] In one embodiment, the training module 1203 is further used to: obtain a training image sample set; obtain a training image sample subset from the training image sample set, and input one or more sample groups included in the training image sample subset into the target model; call the main network of the target model to perform recognition processing on the one or more sample groups to obtain a training loss; use the training loss to train the main network of the target model one or more times, and obtain the main network after one or more trainings.

[0194] In one embodiment, the training module 1203 is specifically used to: obtain a preset association relationship set for the sample images included in each sample group, and use the preset association relationship to update the training loss; use the updated training loss to adjust the network parameters of the main network of the target model to obtain the main network after one or more trainings.

[0195] In one embodiment, the training module 1203 is specifically used to: obtain a reference training image sample subset from the training image sample set; input each sample group included in the reference training image sample subset into the reference main network to obtain a reference loss, and obtain a loss weight corresponding to the reference loss, where the loss weight is obtained after inputting the reference loss into the meta-network of the target model; use the reference loss and the corresponding loss weight to update the reference main network to obtain an updated reference main network; input the meta-image sample set into the updated reference main network, and obtain the meta-loss.

[0196] In one embodiment, the processing module 1204 is specifically used to: obtain an iterative image sample subset from a training image sample set; input each sample group included in the iterative image sample subset into the main network after one or more training to obtain an iterative loss; the iterative loss includes a first loss corresponding to a current sample image included in the corresponding sample group, and a second loss corresponding to a historical sample image included; the current sample image belongs to a new task, and the historical sample image belongs to an old task; the first loss and the second loss are input into the updated meta-network to obtain a loss weight of the first loss and a loss weight of the second loss, respectively; wherein the loss weight of the first loss and the loss weight of the second loss are used to indicate the association relationship between a corresponding current sample image and a corresponding historical sample image.

[0197] In one embodiment, a sample group includes a current sample image obtained from a new task and a historical sample image obtained from a memory cache; the historical sample images in the memory cache come from one or more historical sample images of an old task; the meta-image sample set includes multiple meta-sample images; and the meta-image sample set is obtained by balanced collection of the current sample image included in the new task and the historical sample images included in the old task.

[0198] In one embodiment, the processing module 1204 is further configured to: when the number of iterative updates of the main network after one or more trainings meets the set update condition, update the reference main network included in the reference network model according to the updated main network after one or more trainings.

[0199] It is understood that the functions of the various functional modules of the data processing device described in the embodiments of the present application can be specifically implemented according to the methods in the above-mentioned method embodiments. The specific implementation process can refer to the relevant description of the above-mentioned method embodiments and will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated.

[0200] See Figure 13 , Figure 13 1300 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device 1300 may include an independent device (such as one or more of a server, a node, a terminal, etc.), or may include components within an independent device (such as a chip, a software module, or a hardware module, etc.). The computer device 1300 may include at least one processor 1301 and a communication interface 1302. Further, optionally, the computer device 1300 may also include at least one memory 1303 and a bus 1304. The processor 1301, the communication interface 1302, and the memory 1303 are connected via a bus 1304.

[0201] Among them, the processor 1301 is a module that performs arithmetic operations and / or logical operations, and can specifically be a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor unit (MPU), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), a complex programmable logic device (CPLD), a coprocessor (assisting the central processing unit to complete corresponding processing and applications), a microcontroller unit (MCU), and other processing modules, or a combination of multiple thereof.

[0202] The communication interface 1302 can be used to provide information input or output for at least one processor. And / or, the communication interface 1302 can be used to receive data sent externally and / or send data externally. It can be a wired link interface such as an Ethernet cable, or a wireless link interface (Wi-Fi, Bluetooth, general wireless transmission, vehicle-mounted short-range communication technology, other short-range wireless communication technologies, etc.).

[0203] Memory 1303 is used to provide storage space for storing data such as the operating system and computer programs. Memory 1303 can be one or a combination of random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or compact disc read-only memory (CD-ROM).

[0204] At least one processor 1301 in the computer device 1300 is used to call a computer program stored in at least one memory 1303 to execute the aforementioned data processing method, such as the aforementioned Figure 3 、 Figure 4 、 Figure 6 The data processing method described in the illustrated embodiment.

[0205] In one possible embodiment, the processor 1301 in the computer device 1300 is used to call a computer program stored in at least one memory 1303 to perform the following operations: construct a reference network model according to the target model, the reference network model includes a reference main network, the reference main network is obtained by copying the main network in the target model after one or more trainings, and the main network of the target model is trained one or more times using a training image sample set; obtain a meta-image sample set, and train the reference network model using the training image sample set and the meta-image sample set to obtain a meta-loss, and use the meta-loss to update the meta-network in the target model to obtain an updated meta-network; perform recognition processing on the training image sample set according to the updated meta-network and the main network after one or more trainings to obtain an association relationship between sample images of different tasks included in the training image sample set; iteratively update the main network after one or more trainings based on the association relationship until a trained target model is obtained, and the trained target model is used for image recognition processing.

[0206] In one embodiment, the processor 1301 is further used to: obtain a training image sample set; obtain a training image sample subset from the training image sample set, and input one or more sample groups included in the training image sample subset into a target model; call a main network of the target model to perform recognition processing on the one or more sample groups to obtain a training loss; use the training loss to train the main network of the target model one or more times, and obtain the main network after one or more trainings.

[0207] In one embodiment, the processor 1301 is specifically used to: obtain a preset association relationship set for the sample images included in each sample group, and use the preset association relationship to update the training loss; use the updated training loss to adjust the network parameters of the main network of the target model to obtain the main network after one or more trainings.

[0208] In one embodiment, the processor 1301 is specifically configured to: obtain a reference training image sample subset from a training image sample set; input each sample group included in the reference training image sample subset into a reference main network to obtain a reference loss, and obtain a loss weight corresponding to the reference loss, where the loss weight is obtained by inputting the reference loss into a meta-network of a target model; update the reference main network using the reference loss and the corresponding loss weight to obtain an updated reference main network; input the meta-image sample set into the updated reference main network to obtain the meta-loss.

[0209] In one embodiment, the processor 1301 is specifically used to: obtain an iterative image sample subset from a training image sample set; input each sample group included in the iterative image sample subset into the main network after one or more training to obtain an iterative loss; the iterative loss includes a first loss corresponding to a current sample image included in the corresponding sample group, and a second loss corresponding to a historical sample image included; the current sample image belongs to a new task, and the historical sample image belongs to an old task; the first loss and the second loss are input into the updated meta-network to obtain a loss weight of the first loss and a loss weight of the second loss, respectively; wherein the loss weight of the first loss and the loss weight of the second loss are used to indicate the association relationship between a corresponding current sample image and a corresponding historical sample image.

[0210] In one embodiment, a sample group includes a current sample image obtained from a new task and a historical sample image obtained from a memory cache; the historical sample images in the memory cache come from one or more historical sample images of an old task; the meta-image sample set includes multiple meta-sample images; and the meta-image sample set is obtained by balanced collection of the current sample image included in the new task and the historical sample images included in the old task.

[0211] In one embodiment, the processor 1301 is further configured to: when the number of iterative updates of the main network after one or more trainings meets the set update condition, update the reference main network included in the reference network model according to the updated main network after one or more trainings.

[0212] It should be understood that the computer device 1300 described in the embodiment of the present application can execute the description of the data processing method in the above corresponding embodiment, and can also execute the above Figure 12 The description of the data processing device 1200 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here either.

[0213] In addition, it should be noted that an exemplary embodiment of the present application further provides a storage medium that stores a computer program for the aforementioned data processing method. The computer program includes program instructions. When one or more processors load and execute the program instructions, the data processing method described in the embodiment can be implemented. The description of the beneficial effects of using the same method is not repeated here. It is understood that the program instructions can be deployed on one or multiple computer devices that can communicate with each other for execution.

[0214] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0215] In one aspect of the present application, a computer program product or computer program is provided. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in one aspect of the embodiments of the present application.

[0216] In one aspect of the present application, another computer program product is provided, which includes a computer program or computer instructions, and when the computer program or computer instructions are executed by a processor, the steps of the data processing method provided in the embodiment of the present application are implemented.

[0217] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data processing method, characterized in that: include: Constructing a reference network model based on the target model, the reference network model including a reference main network, the reference main network being obtained by copying a main network of the target model that has been trained once or multiple times, the main network of the target model being trained once or multiple times using a training image sample set; Obtaining a meta-image sample set, and training the reference network model using the training image sample set and the meta-image sample set to obtain a meta-loss, and using the meta-loss to update the meta-network in the target model to obtain an updated meta-network; wherein the meta-loss is obtained after iteratively updating a reference main network included in the reference network model using the training image sample set and the meta-network, and then inputting the meta-image sample set into the updated reference main network for processing; performing recognition processing on the training image sample set according to the updated meta-network and the main network after one or more trainings, to obtain association relationships between sample images of different tasks included in the training image sample set; The main network after the one or more trainings is iteratively updated based on the association relationship until a trained target model is obtained, and the trained target model is used for image recognition processing.

2. The method according to claim 1, wherein Methods of training the main network of the target model one or more times using the training image sample set and obtaining the main network after one or more trainings include: Obtain a training image sample set; Acquire a training image sample subset from the training image sample set, and input one or more sample groups included in the training image sample subset into the target model; Calling the main network of the target model to perform recognition processing on the one or more sample groups to obtain a training loss; The main network of the target model is trained one or more times using the training loss, and the main network after the one or more trainings is obtained.

3. The method according to claim 2, wherein The adopting the training loss to train the main network of the target model one or more times and obtaining the main network after one or more trainings includes: Acquire a preset association relationship set for the sample images included in each sample group, and update the training loss using the preset association relationship; The updated training loss is used to adjust the network parameters of the main network of the target model to obtain the main network after one or more trainings.

4. The method according to claim 1, wherein The step of training the reference network model using the training image sample set and the meta-image sample set to obtain a meta-loss includes: Acquire a reference training image sample subset from the training image sample set; Inputting each sample group included in the reference training image sample subset into the reference main network to obtain a reference loss, and obtaining a loss weight corresponding to the reference loss, wherein the loss weight is obtained after inputting the reference loss into the meta-network of the target model; Updating the reference main network using the reference loss and the corresponding loss weight to obtain an updated reference main network; The meta-image sample set is input into the updated reference main network to obtain the meta-loss.

5. The method according to claim 1, wherein The performing recognition processing on the training image sample set according to the updated meta-network and the main network after one or more trainings to obtain the association relationship between sample images of different tasks included in the training image sample set includes: Acquire an iterative image sample subset from the training image sample set; Inputting each sample group included in the iterative image sample subset into the main network after one or more trainings to obtain an iterative loss; the iterative loss includes a first loss corresponding to a current sample image included in the corresponding sample group and a second loss corresponding to a historical sample image included in the sample group; the current sample image belongs to the new task, and the historical sample image belongs to the old task; Inputting the first loss and the second loss into the updated meta-network to obtain a loss weight of the first loss and a loss weight of the second loss, respectively; The loss weight of the first loss and the loss weight of the second loss are used to indicate the association relationship between a corresponding current sample image and a corresponding historical sample image.

6. The method according to any one of claims 2 to 5, wherein: A sample group includes a current sample image obtained from a new task and a historical sample image obtained from a memory cache; the historical sample image in the memory cache comes from one or more historical sample images of an old task; The meta-image sample set includes multiple meta-sample images; and the meta-image sample set is obtained by balancing the current sample images included in the new task and the historical sample images included in the old task.

7. The method according to claim 1, wherein The method further comprises: When the number of iterative updates of the main network after the one or more trainings meets the set update condition, the reference main network included in the reference network model is updated according to the updated main network after the one or more trainings.

8. A data processing device, characterized in that: include: A construction module is used to construct a reference network model based on the target model. The reference network model includes a reference main network. The reference main network is obtained by copying the main network of the target model after one or more trainings. The main network of the target model is trained one or more times using a training image sample set. An acquisition module, used for acquiring a meta-image sample set; a training module configured to train a reference network model using a training image sample set and a meta-image sample set to obtain a meta-loss, and to update a meta-network in a target model using the meta-loss to obtain an updated meta-network; wherein the meta-loss is obtained by iteratively updating a reference main network included in the reference network model using the training image sample set and the meta-network, and then inputting the meta-image sample set into the updated reference main network for processing; a processing module, configured to perform recognition processing on the training image sample set based on the updated meta-network and the main network after one or more trainings, and obtain association relationships between sample images of different tasks included in the training image sample set; The training module is also used to iteratively update the main network after one or more trainings based on the association relationship until a trained target model is obtained, and the trained target model is used for image recognition processing.

9. A computer device, characterized in that: include: processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a network communication function, the memory is used to store program code, and the processor is used to call the program code to execute the data processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the data processing method according to any one of claims 1 to 7 is executed.

11. A computer program product, characterized in that The computer program product comprises a computer program or computer instructions, which implement the steps of the data processing method according to any one of claims 1 to 7 when the computer program or computer instructions are executed by a processor.