A model training method and related equipment

Through the target incremental training method, the appropriate incremental training strategy is selected according to the distribution characteristics of the training samples, which solves the problems of data storage and computing power limitations and catastrophic forgetting in self-supervised learning, and achieves efficient model training and performance maintenance.

CN113191241BActive Publication Date: 2025-09-09HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110441864.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-23
Publication Date
2025-09-09
Estimated Expiration
2041-04-23

AI Technical Summary

Technical Problem

Existing self-supervised learning methods require all data to be trained jointly, which makes data storage and computing power become limiting factors. At the same time, incremental learning has a catastrophic forgetting problem, which leads to a decline in model performance.

Method used

A target incremental training method is adopted to select appropriate incremental training strategies according to the distribution characteristics of different batches of training samples, such as basic incremental training, incremental training based on parameter regularization, and incremental training based on training sample replay, to reduce the impact of catastrophic forgetting through self-supervised training.

Benefits of technology

On the premise of reducing training time and data storage space, a balance between model training efficiency and performance is achieved, the impact of catastrophic forgetting is reduced, and the adaptability and accuracy of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113191241B_ABST
    Figure CN113191241B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a model training method for application in the field of artificial intelligence, the method comprising: obtaining a first neural network model and M batches of training samples, where M is a positive integer greater than 1; determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples, and the target incremental training method is used to achieve resistance to catastrophic forgetting when incremental training is performed on the model; based on the M batches of training samples, the first neural network model is self-supervised trained by the target incremental training method to obtain a second neural network model. The present application achieves a balance between efficiency and performance while reducing training time and saving data storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to a model training method and related equipment. Background Art

[0002] Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that seeks to understand the essence of intelligence and develop new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.

[0003] In existing computer vision and natural language processing tasks, the prevailing paradigm is to first pre-train representation learning using big data, then fine-tune it on a specific dataset. Using self-supervised methods for pre-training can overcome the reliance on manual annotation for representation learning; however, current self-supervised learning methods still require joint training (JT) of all data, making data storage and computing power prominent constraints on self-supervised representation learning.

[0004] The ability to continuously process continuous information flows in the real world, retaining, even integrating, and optimizing old knowledge while absorbing new knowledge, is known as incremental learning. Specifically, sequential training (ST) involves training a model on a continuous data stream. Over time, more data becomes available, while older data may become unavailable due to storage limitations or privacy concerns. Furthermore, the type and number of learning tasks are not predefined (for example, the number of categories in a classification task). Compared to joint training, incremental training can significantly save computational and storage resources, but it can lead to degraded model performance due to catastrophic forgetting. Summary of the Invention

[0005] In a first aspect, the present application provides a model training method, the method comprising:

[0006] Obtain a first neural network model and M batches of training samples, where M is a positive integer greater than 1;

[0007] The first neural network model may be a pre-trained model or a model obtained by fine-tuning the pre-trained model;

[0008] Each batch of training samples in the M batches of training samples is used as a training sample required for performing a batch model training on the first neural network, and then the M batches of training samples are used as training samples required for performing M batch model training on the first neural network;

[0009] The M batches of training samples can be image data, text data, or audio data, which is not limited here;

[0010] determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of batch training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples, and the target incremental training method is used to achieve resistance to catastrophic forgetting when incremental training is performed on the model;

[0011] Catastrophic forgetting refers to the phenomenon where a model forgets previously learned knowledge after learning new information. When a trained model is trained on a new task and then tested on an old task, the accuracy of the old task will be much lower than before learning the new task. As the number of tasks increases, the accuracy of the old tasks gradually decreases, a phenomenon known as forgetting. Therefore, it is necessary to address catastrophic forgetting as much as possible based on the existing model, at the lowest possible cost.

[0012] The sample distribution characteristics between batches of training samples can include sample increment, random category increment, semantic difference category increment, and style shift.

[0013] According to the M batches of training samples, the first neural network model is self-supervised trained by the target incremental training method to obtain a second neural network model.

[0014] In one possible implementation, the greater the degree of catastrophic forgetting generated, the greater the degree of anti-catastrophic forgetting effect achieved by the target incremental training method when performing incremental training of the model.

[0015] In an embodiment of the present application, some feature training samples may cause catastrophic forgetting in the model during incremental training. For example, when the semantic differences between batch samples are too large or they come from different fields, in this case, in order to ensure the accuracy of the model, some anti-catastrophic forgetting methods are needed to reduce the degree of catastrophic forgetting in the model during incremental learning. The greater the degree of catastrophic forgetting, the greater the degree of anti-catastrophic forgetting effect achieved by the target incremental training method during incremental training of the model.

[0016] In one possible implementation, the target incremental training method includes at least one of the following:

[0017] Basic incremental training, incremental training based on parameter regularization, incremental training based on training sample replay;

[0018] The basic incremental training means sequentially using each batch of training samples in the M batches of training samples to perform self-supervised training; the basic incremental training considers unlabeled data. Among them, M is the total number of batches, D m is the data of the mth batch. Specifically, in the bth incremental training, the network model obtained by the (b-1)th training can be As the initial value, only the data D of batch b is used. m To update the model. When the b-th training is completed, the network model f θ Will be saved as the initial value for the next training, and the data D m It will not be saved.

[0019] The parameter-regularized incremental training means that when performing the self-supervised training, the loss function of the self-supervised training includes regularization constraints; the parameter-regularized incremental learning protects old knowledge from being overwritten by new knowledge by imposing constraints on the loss function of the new task. Specifically, taking the example of implementing parameter regularization through memory-aware synapses (MAS), for each task, after training the task, each parameter θ in the network model is calculated. i,j The importance of this task i,j (importance weight), and used in subsequent tasks of training. Whenever a new task comes in to train it, for Ω i,j Large parameter θ i,j , try to minimize its change in gradient descent, because this parameter is important for a certain task in the past and its value needs to be retained to avoid catastrophic forgetting. i,j A relatively small parameter θ i,j , it can be updated with a larger gradient to obtain better performance or accuracy on the new task. In the specific training process, the importance of Ω i,j Added to the loss function as a regularization term.

[0020] Incremental training based on training sample replay means that during self-supervised training, the training samples used in each batch model training include some of the training samples used in the previous batch model training. Incremental training based on training sample replay retains a portion of the representative old data when training a new task and uses it to review previously learned knowledge. For example, in the b-th training run, 10% of the data from the (b-1)th batch (the percentage here is just an example) will be added to the training of the current batch.

[0021] In a possible implementation, determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples includes:

[0022] According to the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples satisfying a first preset condition, it is determined that the target incremental training method is the basic incremental training, and when the first neural network model is self-supervised trained by the target incremental training method, the loss function of the self-supervised training does not include a regularization constraint; wherein the first preset condition includes: the categories of the training samples included in each batch of batch training samples are the same.

[0023] In one possible implementation, when the data stream distribution of M batches of training samples is in the form of the above-mentioned sample increments (this embodiment of the present application may also be referred to as training samples that meet the first preset condition), since the impact of catastrophic forgetting on the model is relatively small when incremental learning is performed on the model based on training samples of the sample increment type, the target incremental training method can be determined to be the basic incremental training, and when self-supervised training is performed on the first neural network model through the target incremental training method, the loss function of the self-supervised training does not include regularization constraints.

[0024] In a possible implementation, determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples includes:

[0025] According to the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples satisfying the second preset condition, the target incremental training method is determined to be the basic incremental training, and when the first neural network model is self-supervised trained by the target incremental training method, the loss function of the self-supervised training does not include a regularization constraint, and the second preset condition includes: the training samples included in each batch of batch training samples have the same semantics but different categories.

[0026] In a possible implementation, when the data stream distribution of M batches of training samples is the above-mentioned random category increments (this embodiment of the present application may also be referred to as training samples that meet the second preset condition), since the impact of catastrophic forgetting on the model is relatively small when the model is incrementally learned based on the training samples of the random category increment type, the target incremental training method can also be determined to be the basic incremental training, and when the first neural network model is self-supervised trained using the target incremental training method, the loss function of the self-supervised training does not include regularization constraints.

[0027] In a possible implementation, determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples includes:

[0028] According to the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples satisfying the third preset condition, the target incremental training method is determined to be the basic incremental training and the incremental training based on parameter regularization, and the third preset condition includes: the semantics of the training samples included in each batch of batch training samples are different.

[0029] In a possible implementation, determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples includes:

[0030] According to the fact that the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples meet the fourth preset condition, the target incremental training method is determined to be the basic incremental training and the incremental training based on training sample playback, and the fourth preset condition includes: the training samples included in each batch of batch training samples come from different fields.

[0031] In one possible implementation, when the data stream distribution of M batches of training samples is the above-mentioned semantic difference category increments (this embodiment of the present application may also be referred to as training samples that meet the third preset condition), since the impact of catastrophic forgetting on the model is relatively large when the model is incrementally learned based on the training samples of the semantic difference category increments, the target incremental training method can be determined as the basic incremental training and the incremental training based on parameter regularization.

[0032] In a possible implementation, the first neural network model is a pre-trained model or is obtained by fine-tuning the pre-trained model.

[0033] In one possible implementation, when the data stream distribution of M batches of training samples is the above-mentioned style transition (this embodiment of the present application may also be referred to as training samples that meet the fourth preset condition), since the impact of catastrophic forgetting on the model is relatively large when the model is incrementally learned based on training samples of style transition, the target incremental training method can be determined as the basic incremental training and the incremental training based on training sample playback.

[0034] In one possible implementation, the method further includes:

[0035] Obtain data to be processed, and process the data to be processed through the second neural network model to obtain a processing result; wherein the data to be processed is image data, text data or audio data.

[0036] In a second aspect, the present application provides a model training device, comprising:

[0037] An acquisition module is used to obtain a first neural network model and M batches of training samples, where M is a positive integer greater than 1;

[0038] a determination module, configured to determine a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples, and the target incremental training method is configured to achieve resistance to catastrophic forgetting when incremental training is performed on the model;

[0039] A model training module is used to perform self-supervised training on the first neural network model through the target incremental training method based on the M batches of training samples to obtain a second neural network model.

[0040] In a possible implementation, the greater the degree of catastrophic forgetting generated, the greater the degree of anti-catastrophic forgetting effect achieved by the target incremental training device when performing incremental training of the model.

[0041] In one possible implementation, the target incremental training device includes at least one of the following:

[0042] Basic incremental training, incremental training based on parameter regularization, incremental training based on training sample replay;

[0043] The basic incremental training means sequentially using each batch of training samples in the M batches of training samples to perform self-supervised training;

[0044] The parameter regularization-based incremental training means that when performing the self-supervised training, the loss function of the self-supervised training includes a regularization constraint;

[0045] The incremental training based on training sample playback means that when performing the self-supervised training, the training samples used in each batch model training include part of the training samples used in the previous batch model training.

[0046] In one possible implementation, the determination module is used to determine that the target incremental training device is the basic incremental training based on that the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples meet a first preset condition, and when the first neural network model is self-supervised trained through the target incremental training device, the loss function of the self-supervised training does not include a regularization constraint; wherein the first preset condition includes: the categories of the training samples included in each batch of batch training samples are the same.

[0047] In one possible implementation, the determination module is used to determine that the target incremental training device is the basic incremental training based on that the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples meet a second preset condition, and when the first neural network model is self-supervised trained through the target incremental training device, the loss function of the self-supervised training does not include a regularization constraint, and the second preset condition includes: the training samples included in each batch of batch training samples have the same semantics but different categories.

[0048] In one possible implementation, the determination module is used to determine that the target incremental training device is the basic incremental training and the parameter regularization-based incremental training based on the sample distribution characteristics between each batch of batch training samples in the M batch training samples satisfying a third preset condition, and the third preset condition includes: the semantics of the training samples included in each batch of batch training samples are different.

[0049] In one possible implementation, the determination module is used to determine that the target incremental training device is the basic incremental training and the incremental training based on training sample playback based on the sample distribution characteristics between each batch of batch training samples in the M batch training samples satisfying a fourth preset condition, and the fourth preset condition includes: the training samples included in each batch of batch training samples come from different fields.

[0050] In a possible implementation, the first neural network model is a pre-trained model or is obtained by fine-tuning the pre-trained model.

[0051] In a possible implementation, the apparatus further includes:

[0052] The data processing module is used to obtain the data to be processed and process the data to be processed through the second neural network model to obtain a processing result; wherein the data to be processed is image data, text data or audio data.

[0053] In a third aspect, an embodiment of the present application provides an execution device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to execute the above-mentioned second neural network model.

[0054] In a fourth aspect, an embodiment of the present application provides a training device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to perform the first aspect and any optional method thereof.

[0055] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method thereof.

[0056] In a sixth aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above-mentioned first aspect and any optional method thereof.

[0057] In a seventh aspect, the present application provides a chip system comprising a processor for supporting an execution device or a training device in implementing the functions described in the aforementioned aspects, such as transmitting or processing data or information described in the aforementioned methods. In one possible design, the chip system further comprises a memory for storing program instructions and data necessary for the execution device or the training device. The chip system may consist of a single chip or may include a chip and other discrete components.

[0058] An embodiment of the present application provides a model training method, the method comprising: obtaining a first neural network model and M batches of training samples, where M is a positive integer greater than 1; determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples, and the target incremental training method is used to achieve resistance to catastrophic forgetting when incremental training is performed on the model; based on the M batches of training samples, the first neural network model is self-supervised trained by the target incremental training method to obtain a second neural network model. The present application proposes to adopt an incremental training paradigm for self-supervised learning, and to determine different target incremental training methods based on different sample distribution characteristics, thereby achieving a balance between efficiency and performance while reducing training time and saving data storage space. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 A structural diagram of the main framework of artificial intelligence;

[0060] Figure 2 This is a schematic diagram of an application scenario system;

[0061] Figure 3 A schematic diagram of a system;

[0062] Figure 4 This is a schematic diagram of an application scenario system;

[0063] Figure 5 This is a schematic diagram of an application scenario system;

[0064] Figure 6 This is an example of a model training method provided in an embodiment of the present application;

[0065] Figure 7 This is an example of a model training method in the embodiments of the present application;

[0066] Figure 8 This is a diagram of the data distribution of a training sample;

[0067] Figure 9 This is an illustration of the effects of the embodiments of the present application;

[0068] Figure 10 This is an illustration of the effects of the embodiments of the present application;

[0069] Figure 11 A schematic diagram of the structure of the model training device provided in an embodiment of the present application;

[0070] Figure 12A schematic diagram of the structure of an execution device provided in an embodiment of the present application;

[0071] Figure 13 A schematic diagram of the structure of the training device provided in an embodiment of the present application;

[0072] Figure 14 A schematic diagram of the structure of the chip provided in an embodiment of the present application. DETAILED DESCRIPTION

[0073] The following describes the embodiments of the present invention in conjunction with the accompanying drawings. The terms used in the embodiments of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.

[0074] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0075] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0076] First, the overall workflow of the artificial intelligence system is described. Figure 1 , Figure 1 The following diagram illustrates a structural diagram of the AI ​​framework. This framework is explained below from two perspectives: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects the entire process from data acquisition to processing. For example, it encompasses the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. Throughout this process, data undergoes a condensed progression from "data-information-knowledge-wisdom." The "IT value chain," encompassing the entire process from the underlying infrastructure of human intelligence, information (provided and processed by technology), to the system's industrial ecosystem, reflects the value that AI brings to the information technology industry.

[0077] (1) Infrastructure

[0078] Infrastructure provides computing power for AI systems, enabling communication with the outside world and supporting this through a foundational platform. External communication occurs through sensors; computing power is provided by intelligent chips (CPUs, NPUs, GPUs, ASICs, FPGAs, and other hardware accelerators). The foundational platform includes a distributed computing framework and network-related platform guarantees and support, including cloud storage and computing, and interconnected networks. For example, sensors communicate with the outside world to acquire data, which is then fed into the intelligent chips within the distributed computing system provided by the foundational platform for computation.

[0079] (2) Data

[0080] Data above the infrastructure layer represents data sources for AI. This data includes graphics, images, voice, and text, as well as IoT data from traditional devices. This includes business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.

[0081] (3) Data processing

[0082] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.

[0083] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.

[0084] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.

[0085] Decision-making refers to the process of making decisions after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.

[0086] (4) General ability

[0087] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.

[0088] (5) Smart products and industry applications

[0089] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical application. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.

[0090] This application can be applied to the fields of natural language processing, image processing, and audio and video processing in the field of artificial intelligence. Taking the image processing field as an example, the following will introduce multiple application scenarios that have been implemented in products.

[0091] In order to better understand the solution of the embodiment of the present application, Figures 2 to 3 A brief introduction to possible application scenarios of the embodiments of the present application is given.

[0092] Application Scenario 1: ADAS / ADS Visual Perception System

[0093] like Figure 2 As shown in the figure, ADAS and ADS require real-time detection of multiple types of 2D objects, including dynamic obstacles (pedestrians, cyclists, tricycles, cars, trucks, and buses), static obstacles (traffic cones, traffic sticks, fire hydrants, motorcycles, and bicycles), and traffic signs (traffic signs, guide signs, billboards, red traffic lights (TrafficLight_Red), yellow traffic lights (TrafficLight_Yellow), green traffic lights (TrafficLight_Green), and black traffic lights (TrafficLight_Black). Furthermore, to accurately determine the area occupied by dynamic obstacles in 3D space, 3D estimation of the dynamic obstacles is required, and 3D bounding boxes are output. To fuse the data with the LiDAR, it is necessary to obtain a mask for dynamic obstacles, thereby filtering out the laser point cloud that hits them. To accurately park a car, it is necessary to simultaneously detect the four key points of the parking space. To perform composition positioning, it is necessary to detect the key points of static targets. The second neural network model trained in the embodiments of this application is used to complete all or part of the above functions.

[0094] Application scenario 2: mobile phone beauty function

[0095] In a mobile phone, the second neural network model provided by the embodiment of the present application can detect the mask and key points of the human body, and can zoom in and out the corresponding parts of the human body, such as performing waist-tightening and buttock-beautifying operations, thereby outputting a beautified image.

[0096] Application scenario 3: Image classification scenario:

[0097] After acquiring the image to be classified, the object recognition device uses the object recognition method of the present application to obtain the category of the object in the image to be classified, and then classifies the image to be classified based on the category of the object in the image to be classified. Photographers take many photos every day, including animals, people, and plants. Using the second neural network model, photos can be quickly classified according to their content into photos containing animals, photos containing people, and photos containing plants.

[0098] When there are a large number of images, manual classification is inefficient, and people are prone to fatigue when dealing with the same thing for a long time, and the classification results will have large errors. However, the second neural network model can quickly classify images without errors.

[0099] Application scenario 4: Product classification:

[0100] After the object recognition device captures an image of a product, it uses a second neural network model to identify the product category within the image and then classify the product accordingly. For large shopping malls or supermarkets with a wide variety of products, this second neural network model can quickly classify the products, reducing time and labor costs.

[0101] The following combination Figure 3 The system architecture provided in the embodiments of the present application is introduced in detail. Figure 3 This is a schematic diagram of the system architecture provided by an embodiment of the present application. Figure 3 As shown, the system architecture 500 includes an execution device 510 , a training device 520 , a database 530 , a client device 540 , a data storage system 550 , and a data collection system 560 .

[0102] The execution device 510 includes a calculation module 511, an I / O interface 512, a pre-processing module 513, and a post-processing module 514. The calculation module 511 may include the target model / rule 501, and the pre-processing module 513 and the post-processing module 514 are optional.

[0103] Data acquisition device 560 is used to collect training data. After collecting the training data, data acquisition device 560 stores the training data in database 530. Training device 520 trains target model / rule 501 based on the training data maintained in database 530 (e.g., M batches of training samples in the embodiment of the present application) (e.g., training the first neural network model in the embodiment of the present application to obtain a second neural network model).

[0104] It should be noted that, in actual applications, the training data maintained in the database 530 may not all be collected by the data acquisition device 560, but may also be received from other devices. It should also be noted that the training device 520 may not train the target model / rule 501 entirely based on the training data maintained by the database 530, but may also obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.

[0105] The target model / rule 501 obtained by training the training device 520 can be applied to different systems or devices, such as Figure 3 The execution device 510 shown in the figure can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR) device, a vehicle terminal, etc. It can also be a server or a cloud. Figure 3 In the embodiment, the execution device 510 is configured with an input / output (I / O) interface 512 for data interaction with an external device. A user can input data to the I / O interface 512 through a client device 540 .

[0106] Preprocessing module 513 and preprocessing module 514 are used to preprocess the input data received by I / O interface 512. It should be understood that preprocessing module 513 and preprocessing module 514 may be absent or only one preprocessing module may be present. If preprocessing module 513 and preprocessing module 514 are absent, computing module 511 may be used directly to process the input data.

[0107] When the execution device 510 preprocesses the input data, or when the computing module 511 of the execution device 510 performs calculations and other related processing, the execution device 510 can call the data, code, etc. in the data storage system 550 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 550.

[0108] Finally, the I / O interface 512 presents the processing result, such as the processing result obtained after processing, to the client device 540, thereby providing it to the user.

[0109] exist Figure 3In the illustrated case, the user can manually input data, and this "manual input data" can be operated through the interface provided by I / O interface 512. In another case, client device 540 can automatically send input data to I / O interface 512. If the automatic transmission of input data by client device 540 requires user authorization, the user can set the corresponding permissions in client device 540. The user can view the results output by execution device 510 on client device 540, and the specific presentation form can be a display, sound, action, etc. Client device 540 can also serve as a data acquisition terminal, collecting input data input into I / O interface 512 and output results from I / O interface 512 as new sample data and storing them in database 530. Of course, collection can also be performed without client device 540, and instead the I / O interface 512 directly stores the input data input into I / O interface 512 and output results from I / O interface 512 as new sample data in database 530.

[0110] It is worth noting that Figure 3 This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, Figure 3 In the embodiment, the data storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510.

[0111] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.

[0112] (1) Neural Network

[0113] A neural network can be composed of neural units. A neural unit can refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input. The output of the operation unit can be:

[0114]

[0115] Where s = 1, 2, ... n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal of the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.

[0116] (2) Deep Neural Networks

[0117] Deep Neural Network (DNN), also known as multi-layer neural network, can be understood as a neural network with many hidden layers. There is no special metric for "many" here. Based on the position of different layers in DNN, the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer. Although DNN looks complicated, the work of each layer is actually not complicated. Simply put, it is the following linear relationship expression: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since there are many DNN layers, the coefficient W and the offset vector The definition of these parameters in DNN is as follows: Take the coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscript corresponds to the output of the third layer index 2 and the input of the second layer index 4. In summary, the coefficient from the kth neuron in the L-1th layer to the jth neuron in the Lth layer is defined as It's important to note that the input layer has no W parameter. In deep neural networks, more hidden layers allow the network to better capture complex real-world situations. Theoretically, a model with more parameters has higher complexity and greater "capacity," meaning it can handle more complex learning tasks. Training a deep neural network is essentially the process of learning the weight matrix, with the ultimate goal of obtaining the weight matrices for all layers of a trained deep neural network (a weight matrix formed by the vectors W across many layers).

[0118] (3) Self-supervised learning

[0119] Machine learning, as a key branch of AI, has been widely applied in numerous fields. Based on learning methods, machine learning can be categorized into supervised learning, self-supervised learning, semi-supervised learning, and reinforcement learning. Supervised learning involves learning an algorithm or establishing a pattern based on training data, and then using this algorithm or pattern to infer new instances. Training data, also known as training samples, consists of input data and expected outputs. The machine learning model, also known as the machine learning model, has an expected output, called a label, which can be a predicted classification result (called a classification label). Self-supervised learning differs from supervised learning in that the training samples in self-supervised learning are not labeled. The machine learning model analyzes the training samples to achieve certain results. In semi-supervised learning, some training samples are labeled, while others are unlabeled, with unlabeled data far more abundant than labeled data. Reinforcement learning involves repeated attempts in an environment to maximize expected benefits, using rewards and penalties provided by the environment to generate choices that maximize benefits.

[0120] Self-supervised learning can be seen as an ideal state of machine learning, where the model learns directly from unlabeled data, without the need for data annotation. The core of self-supervised learning lies in how to automatically generate labels for data.

[0121] (4) Incremental training

[0122] The current training methods of machine learning algorithms are divided into offline learning and online learning.

[0123] In offline learning (also known as offline training), a machine learning model is trained by batching samples from a training set. This requires a large amount of data. Offline learning is typically used to train large or complex models, so the training process is often time-consuming and requires a large amount of data.

[0124] In online learning (also known as online training), models are trained using samples from a training set in small batches or one by one, requiring relatively small amounts of data. Online learning is often used in scenarios where immediacy is crucial. Incremental learning (also known as incremental training) is a special type of online learning approach that requires not only the ability to learn new patterns instantly but also the ability to resist forgetting. This means that the model must be able to both remember previously learned patterns and learn new ones.

[0125] Sequential training refers to training a model using a continuous data stream. As time goes by, more data becomes available, while old data may become unavailable due to storage limitations or privacy protection, and the type and number of learning tasks are not predefined (such as the number of categories in a classification task).

[0126] (5) Joint training

[0127] Joint training refers to training the model on all known data, which is the most effective and is generally considered to be the upper bound of incremental learning performance. However, it takes a long time to train, requires a large amount of data storage space, and is costly.

[0128] Reference Figure 6 , Figure 6 The embodiment of the present invention provides a model training method. The embodiment of the present invention provides a model training method that can be applied to terminal devices such as mobile phones, tablets, laptops, smart wearable devices, or applied to cloud-side servers, such as Figure 6 As shown, the embodiment of the present application provides a model training method, including:

[0129] 601. Obtain a first neural network model and M batches of training samples, where M is a positive integer greater than 1.

[0130] In an embodiment of the present application, a first neural network model can be obtained, wherein the first neural network model can be a pre-trained model or a model obtained by fine-tuning the pre-trained model.

[0131] Among them, you can first train a task to obtain a set of model parameters, which can be used as a pre-trained model. Then, use the pre-trained model for initialization, and then use the pre-trained model to train other tasks to obtain models adapted to other tasks (this process can also be called fine-tuning).

[0132] In some scenarios, the cloud-side server can deploy a pre-trained model or a model obtained by fine-tuning the pre-trained model on the tenant side. In some scenarios, the model deployed on the tenant side needs to be updated, for example, incremental training of the model is required for training samples related to new tasks, such as Figure 4 As shown in , different cloud tenants can use their own application data for unsupervised incremental training to improve the public pre-trained model. The training data used for incremental training can include application data feedback from tenants, tenant return data, and public unlabeled training data, such as Figure 5 As shown in the figure, the public cloud maintains a shared pre-trained model. The training data used for incremental training can include tenants' return visit data, public unlabeled training data, and so on.

[0133] In an embodiment of the present application, the first neural network model can be a pre-trained model deployed on the tenant side or a model obtained by fine-tuning the pre-trained model, and the M batches of training samples are the training data used for model training of the first neural network model.

[0134] Among them, each batch of batch training samples in the M batch training samples is used as a training sample required for a batch model training of the first neural network, and then the M batch training samples are used as the training samples required for the M batch model training of the first neural network.

[0135] In a possible implementation, the M batches of training samples may be image data, text data, or audio data, which is not limited here.

[0136] 602. Determine a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of batch training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on the batch training samples, and the target incremental training method is used to achieve resistance to catastrophic forgetting when incremental training is performed on the model.

[0137] Incremental training can cause catastrophic forgetting in models. Catastrophic forgetting refers to the phenomenon where a model forgets previously learned knowledge after learning new information. When training a trained model on a new task and then testing it on an old task, the accuracy of the old task will be significantly lower than before the new task was learned. As the number of tasks increases, the accuracy of the old tasks gradually decreases, a phenomenon known as forgetting. Therefore, it is important to address catastrophic forgetting as much as possible within the existing model, with minimal effort and cost.

[0138] In an embodiment of the present application, the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples can be determined based on the sample distribution characteristics between the batches of training samples.

[0139] In the embodiment of the present application, the sample distribution characteristics between each batch of training samples may include sample increment, random category increment, semantic difference category increment, and style change. The following describes these four sample distribution characteristics respectively:

[0140] Reference Figure 8 Instance incremental is a classic data flow form in incremental learning. During training, independent and identically distributed data is divided into multiple batches, that is, the training samples included in each batch are of the same category. The training samples in each batch are used for model training in turn, and only the data of the current batch is visible during each training.

[0141] Reference Figure 8 Random class incremental is also a common data flow in incremental training. During training, training samples are divided into multiple batches and used sequentially for model training. The categories of training samples in each batch do not overlap, and the categories that appear in each training are new. In other words, each batch of training samples includes training samples with the same semantics but different categories. During each training, only the training samples in the current batch are visible.

[0142] Reference Figure 8 Distant class incremental means that the semantics of the training samples in each batch are as unrelated as possible. In other words, each batch of training samples contains training samples with different semantics. For example, if the first batch contains animals and the second batch contains plants, there is no related semantics in the semantic tree.

[0143] Reference Figure 8 Incremental style shift refers to the practice of training samples in each batch from different domains. Taking DomainNet data as an example, the first batch of training samples can be natural images, the second batch of training samples can be simple drawings, and the third batch of training samples can be cartoon images.

[0144] In the embodiment of the present application, the degree of catastrophic forgetting caused by the semantic difference category incremental training data and the style change category training data to the model during incremental training is much greater than that of the sample incremental training data and the random category incremental training data.

[0145] In one possible implementation, the greater the degree of catastrophic forgetting generated by the model when performing incremental training based on the batches of training samples, the greater the degree of anti-catastrophic forgetting effect achieved by the target incremental training method when performing incremental training of the model.

[0146] In an embodiment of the present application, some feature training samples may cause catastrophic forgetting in the model during incremental training. For example, when the semantic differences between batch samples are too large or they come from different fields, in this case, in order to ensure the accuracy of the model, some anti-catastrophic forgetting methods are needed to reduce the degree of catastrophic forgetting in the model during incremental learning. The greater the degree of catastrophic forgetting, the greater the degree of anti-catastrophic forgetting effect achieved by the target incremental training method during incremental training of the model.

[0147] Next, several examples of the target incremental training method in the embodiments of the present application are described:

[0148] In the embodiment of the present application, the target incremental training method may include at least one of the following: basic incremental training, incremental training based on parameter regularization, and incremental training based on training sample playback;

[0149] The basic incremental training means sequentially using each batch of training samples in the M batches of training samples to perform self-supervised training.

[0150] For details, please refer to Figure 7 , basic incremental training considers unlabeled data Among them, M is the total number of batches, D m is the data of the mth batch. Specifically, in the bth incremental training, the network model obtained by the (b-1)th training can be As the initial value, only the data D of batch b is used. m To update the model. When the b-th training is completed, the network model f θ Will be saved as the initial value for the next training, and the data D m It will not be saved.

[0151] The parameter regularization-based incremental training indicates that when performing the self-supervised training, the loss function of the self-supervised training includes a regularization constraint.

[0152] Specifically, incremental learning based on parameter regularization protects old knowledge from being overwritten by new knowledge by imposing constraints on the loss function of the new task. Specifically, taking the example of parameter regularization through memory aware synapses (MAS), for each task, after training the task, each parameter θ in the network model is calculated. i,j The importance of this task i,j (importance weight), and used in subsequent tasks of training. Whenever a new task comes in to train it, for Ω i,j Large parameter θ i,j , try to minimize its change in gradient descent, because this parameter is important for a certain task in the past and its value needs to be retained to avoid catastrophic forgetting. i,j A relatively small parameter θ i,j , it can be updated with a larger gradient to obtain better performance or accuracy on the new task. In the specific training process, the importance of Ω i,j Added to the loss function as a regularization term.

[0153] The incremental training based on training sample playback means that when performing the self-supervised training, the training samples used in each batch model training may include part of the training samples used in the previous batch model training.

[0154] Specifically, when training a new task with incremental training based on training sample replay, a portion of representative old data is retained and used to review the model's previously learned knowledge. For example, in the b-th training run, 10% of the data in the (b-1)th batch is added to the training of the current batch.

[0155] In one possible implementation, when the data stream distribution of M batches of training samples is in the form of the above-mentioned sample increments (this embodiment of the present application may also be referred to as training samples that meet the first preset condition), since the impact of catastrophic forgetting on the model is relatively small when incremental learning is performed on the model based on training samples of the sample increment type, the target incremental training method can be determined to be the basic incremental training, and when self-supervised training is performed on the first neural network model through the target incremental training method, the loss function of the self-supervised training does not include regularization constraints.

[0156] In a possible implementation, when the data stream distribution of M batches of training samples is the above-mentioned random category increments (this embodiment of the present application may also be referred to as training samples that meet the second preset condition), since the impact of catastrophic forgetting on the model is relatively small when the model is incrementally learned based on the training samples of the random category increment type, the target incremental training method can also be determined to be the basic incremental training, and when the first neural network model is self-supervised trained using the target incremental training method, the loss function of the self-supervised training does not include regularization constraints.

[0157] In one possible implementation, when the data stream distribution of M batches of training samples is the above-mentioned semantic difference category increments (this embodiment of the present application may also be referred to as training samples that meet the third preset condition), since the impact of catastrophic forgetting on the model is relatively large when the model is incrementally learned based on the training samples of the semantic difference category increments, the target incremental training method can be determined as the basic incremental training and the incremental training based on parameter regularization.

[0158] In one possible implementation, when the data stream distribution of M batches of training samples is the above-mentioned style transition (this embodiment of the present application may also be referred to as training samples that meet the fourth preset condition), since the impact of catastrophic forgetting on the model is relatively large when the model is incrementally learned based on training samples of style transition, the target incremental training method can be determined as the basic incremental training and the incremental training based on training sample playback.

[0159] 603. Based on the M batches of training samples, perform self-supervised training on the first neural network model using the target incremental training method to obtain a second neural network model.

[0160] In an embodiment of the present application, after determining the target incremental training method, the first neural network model can be self-supervised trained using the target incremental training method based on the M batches of training samples to obtain a second neural network model.

[0161] Regarding how to perform self-supervisory training on the first neural network model, reference can be made to existing self-supervised learning implementations, which is not limited here.

[0162] In an embodiment of the present application, the trained second neural network model can be used for reasoning. Specifically, data to be processed can be obtained, and the data to be processed can be processed by the second neural network model to obtain a processing result; wherein the data to be processed is image data, text data or audio data.

[0163] For example, using self-supervised continuous learning on the public ImageNet dataset, we divided ImageNet into four subsets based on the WordNet tree to simulate semantically differentiated category increments while maximizing the semantic differences between subsets. In the experiment, under the nine-level classification method, data labels in different subsets had no common parent nodes. The specific data divisions are shown in the table below:

[0164]

[0165] The self-supervised learning method MoCo-v2 is used for incremental self-supervised pre-training. MoCo-v2 uses a twin network consisting of two encoders for contrastive learning and uses InfoNCE (a contrastive loss function) to maximize the similarity of positive samples and minimize the similarity of negative samples.

[0166] For basic incremental training, the MoCo-v2 training paradigm is adopted, using the standard Resnet-50 backbone network. Considering unlabeled data Among them, M is the total number of batches, D m is the data of the mth batch. Specifically, in the bth incremental training, the backbone network obtained by the (b-1)th training can be used. As the initial value, only the data D of batch b is used. m To update the backbone network. When the b-th training is completed, the backbone network f θ Will be saved as the initial value for the next training, and the data D m It will not be saved.

[0167] For incremental training based on training sample replay. Since the dataset is an incremental scenario for semantically differentiating categories, it is necessary to incorporate training sample replay into the basic incremental training algorithm. When training a new task, 10% of the data in the (b-1)th batch can be added to the training of the current batch.

[0168] For incremental training based on parameter regularization, in incremental training, parameter regularization is achieved through memory-aware synapses (MAS). For each task, after training the task, each parameter θ in the network model is calculated. i,j The importance of this task i,j (importance weight), and used in subsequent tasks of training. Whenever a new task comes in to train it, for Ω i,j Large parameter θ i,j, try to minimize its change in gradient descent, because this parameter is important for a certain task in the past and its value needs to be retained to avoid catastrophic forgetting. i,j A relatively small parameter θ i,j , it can be updated with a larger gradient to obtain better performance or accuracy on the new task. In the specific training process, the importance of Ω i,j Added to the loss function as a regularization term.

[0169] We evaluate the transfer performance of pre-trained models across three different downstream tasks: linear classification, few-shot classification, and detection. For classification, we consider 12 image classification datasets, including Food-101, CIFAR10, CIFAR100, Birdsnap, SUN397, Standard Cars, FGVC Aircraft, VOC2007, DTD, Oxford-IIIT Pets, Caltech-101, and Oxford 102 Flowers. For detection, we evaluate the performance of pre-trained models on the PASCAL VOC detection dataset. The training data for detection comes from VOC2007 and VOC2012, and the test data comes from VOC2007.

[0170] The comparison between the incremental self-supervised pre-training model (ST) and joint training (JT) can be shown as follows Figure 9 As shown in the figure, the performance gap between incremental self-supervised pre-training and joint training is small. After adding MAS and MAS+ replay (MAS+), the gap with joint training is further narrowed.

[0171] Refer to the table below and Figure 10 , the following table and Figure 10 We compared the training efficiency and data storage of incremental pre-training (ST) and joint training (JT). The experimental results show that self-supervised incremental pre-training can significantly improve model training efficiency, reduce training time by 75%, and save 75% of data storage space, while maintaining relatively unchanged model performance.

[0172]

[0173] An embodiment of the present application provides a model training method, the method comprising: obtaining a first neural network model and M batches of training samples, where M is a positive integer greater than 1; determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples, and the target incremental training method is used to achieve resistance to catastrophic forgetting when incremental training is performed on the model; based on the M batches of training samples, the first neural network model is self-supervised trained by the target incremental training method to obtain a second neural network model. The present application proposes to adopt an incremental training paradigm for self-supervised learning, and to determine different target incremental training methods based on different sample distribution characteristics, thereby achieving a balance between efficiency and performance while reducing training time and saving data storage space.

[0174] Reference Figure 11 , the embodiment of the present application also provides a model training device 1100, such as Figure 11 As shown, the model training device 1100 provided in the embodiment of the present application includes:

[0175] An acquisition module 1101 is configured to acquire a first neural network model and M batches of training samples, where M is a positive integer greater than 1.

[0176] For a detailed description of the acquisition module 1101 , reference may be made to the description of step 601 in the above embodiment, which will not be repeated here.

[0177] a determination module 1102 configured to determine a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model during incremental training based on each batch of training samples, and the target incremental training method is configured to achieve resistance to catastrophic forgetting during incremental training of the model;

[0178] For a detailed description of the determination module 1102 , reference may be made to the description of step 602 in the above embodiment, which will not be repeated here.

[0179] The model training module 1103 is used to perform self-supervised training on the first neural network model according to the M batches of training samples through the target incremental training method to obtain a second neural network model.

[0180] For the specific description of the model training module 1103, please refer to the description of step 603 in the above embodiment, which will not be repeated here.

[0181] In a possible implementation, the greater the degree of catastrophic forgetting generated, the greater the degree of anti-catastrophic forgetting effect achieved by the target incremental training device when performing incremental training of the model.

[0182] In one possible implementation, the target incremental training device includes at least one of the following:

[0183] Basic incremental training, incremental training based on parameter regularization, incremental training based on training sample replay;

[0184] The basic incremental training means sequentially using each batch of training samples in the M batches of training samples to perform self-supervised training;

[0185] The parameter regularization-based incremental training means that when performing the self-supervised training, the loss function of the self-supervised training includes a regularization constraint;

[0186] The incremental training based on training sample playback means that when performing the self-supervised training, the training samples used in each batch model training include part of the training samples used in the previous batch model training.

[0187] In one possible implementation, the determination module is used to determine that the target incremental training device is the basic incremental training based on that the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples meet a first preset condition, and when the first neural network model is self-supervised trained through the target incremental training device, the loss function of the self-supervised training does not include a regularization constraint; wherein the first preset condition includes: the categories of the training samples included in each batch of batch training samples are the same.

[0188] In one possible implementation, the determination module is used to determine that the target incremental training device is the basic incremental training based on that the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples meet a second preset condition, and when the first neural network model is self-supervised trained through the target incremental training device, the loss function of the self-supervised training does not include a regularization constraint, and the second preset condition includes: the training samples included in each batch of batch training samples have the same semantics but different categories.

[0189] In one possible implementation, the determination module is used to determine that the target incremental training device is the basic incremental training and the parameter regularization-based incremental training based on the sample distribution characteristics between each batch of batch training samples in the M batch training samples satisfying a third preset condition, and the third preset condition includes: the semantics of the training samples included in each batch of batch training samples are different.

[0190] In one possible implementation, the determination module is used to determine that the target incremental training device is the basic incremental training and the incremental training based on training sample playback based on the sample distribution characteristics between each batch of batch training samples in the M batch training samples satisfying a fourth preset condition, and the fourth preset condition includes: the training samples included in each batch of batch training samples come from different fields.

[0191] In a possible implementation, the first neural network model is a pre-trained model or is obtained by fine-tuning the pre-trained model.

[0192] In a possible implementation, the apparatus further includes:

[0193] The data processing module is used to obtain the data to be processed and process the data to be processed through the second neural network model to obtain a processing result; wherein the data to be processed is image data, text data or audio data.

[0194] An embodiment of the present application provides a model training device, the device comprising: an acquisition module for acquiring a first neural network model and M batches of training samples, where M is a positive integer greater than 1; a determination module for determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples, and the target incremental training method is used to achieve resistance to catastrophic forgetting when incremental training is performed on the model; a model training module for performing self-supervised training on the first neural network model through the target incremental training method based on the M batches of training samples to obtain a second neural network model. The present application proposes to adopt an incremental training paradigm for self-supervised learning, and to determine different target incremental training methods based on different sample distribution characteristics, thereby achieving a balance between efficiency and performance while reducing training time and saving data storage space.

[0195] Next, we will introduce an execution device provided by the embodiment of the present application. Figure 12 , Figure 12This is a structural diagram of an execution device provided in an embodiment of the present application. The execution device 1200 can be specifically manifested as a virtual reality VR device, a mobile phone, a tablet, a laptop, a smart wearable device, a monitoring data processing device or a server, etc., which is not limited here. Specifically, the execution device 1200 includes: a receiver 1201, a transmitter 1202, a processor 1203 and a memory 1204 (wherein the number of processors 1203 in the execution device 1200 can be one or more, Figure 12 (taking one processor as an example), the processor 1203 may include an application processor 12031 and a communication processor 12032. In some embodiments of the present application, the receiver 1201, the transmitter 1202, the processor 1203 and the memory 1204 may be connected via a bus or other means.

[0196] The memory 1204 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1203. A portion of the memory 1204 may also include non-volatile random access memory (NVRAM). The memory 1204 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.

[0197] Processor 1203 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.

[0198] The methods disclosed in the above embodiments of the present application can be applied to or implemented by the processor 1203. The processor 1203 can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits or software instructions in the processor 1203. The above processor 1203 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor, or a microcontroller, and can further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The processor 1203 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 1204, and processor 1203 reads the information in memory 1204 and, in conjunction with its hardware, completes the steps of the above method.

[0199] Receiver 1201 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 1202 can be used to output digital or character information through the first interface. Transmitter 1202 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 1202 can also include a display device such as a display screen.

[0200] In one embodiment of the present application, the processor 1203 is configured to execute Figure 6 The second neural network model is obtained by training using the model training method described in the corresponding embodiment.

[0201] The present application also provides a training device. Figure 13 , Figure 13This is a structural diagram of a training device provided in an embodiment of the present application. Specifically, the training device 1300 is implemented by one or more servers. The training device 1300 may have relatively large differences due to different configurations or performances. It may include one or more central processing units (CPUs) 1324 (for example, one or more processors) and memory 1332, and one or more storage media 1330 (for example, one or more mass storage devices) storing application programs 1342 or data 1344. Among them, the memory 1332 and the storage medium 1330 can be short-term storage or persistent storage. The program stored in the storage medium 1330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processing unit 1324 can be configured to communicate with the storage medium 1330 to execute a series of instruction operations in the storage medium 1330 on the training device 1300.

[0202] The training device 1300 may also include one or more power supplies 1326, one or more wired or wireless network interfaces 1350, one or more input and output interfaces 1358; or, one or more operating systems 1341, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0203] In the embodiment of the present application, the central processing unit 1324 is used to execute Figure 6 The model training method described in the corresponding embodiment.

[0204] An embodiment of the present application also provides a computer program product, which, when running on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

[0205] A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.

[0206] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.

[0207] For details, please refer to Figure 14 , Figure 14 A schematic diagram of the structure of a chip provided in an embodiment of the present application, which can be represented as a neural network processor NPU 1400. NPU 1400 is mounted on the host CPU as a coprocessor and is assigned tasks by the host CPU. The core of the NPU is arithmetic circuit 1403, which is controlled by controller 1404 to extract matrix data from memory and perform multiplication operations.

[0208] In some implementations, the arithmetic circuit 1403 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 1403 is a two-dimensional systolic array. The arithmetic circuit 1403 can also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1403 is a general-purpose matrix processor.

[0209] For example, assume there are input matrix A, weight matrix B, and output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from weight memory 1402 and caches it on each PE in the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from input memory 1401 and performs a matrix operation on matrix B. The partial or final matrix result is stored in accumulator 1408.

[0210] Unified memory 1406 is used to store input and output data. Weight data is directly transferred to weight memory 1402 through the Direct Memory Access Controller (DMAC) 1405. Input data is also transferred to unified memory 1406 through the DMAC.

[0211] BIU stands for Bus Interface Unit, i.e., bus interface unit 1410 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 1409 .

[0212] The bus interface unit 1410 (BIU) is used for the instruction fetch memory 1409 to obtain instructions from the external memory, and is also used for the storage unit access controller 1405 to obtain the original data of the input matrix A or the weight matrix B from the external memory.

[0213] DMAC is mainly used to move input data in the external memory DDR to the unified memory 1406 or move weight data to the weight memory 1402 or move input data to the input memory 1401.

[0214] The vector calculation unit 1407 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.

[0215] In some implementations, the vector calculation unit 1407 can store the processed output vector to the unified memory 1406. For example, the vector calculation unit 1407 can apply a linear function or a nonlinear function to the output of the operation circuit 1403, such as linear interpolation of the feature plane extracted by the convolution layer, or accumulate a vector of values ​​to generate an activation value. In some implementations, the vector calculation unit 1407 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1403, for example, for use in subsequent layers in a neural network.

[0216] An instruction fetch buffer 1409 connected to the controller 1404 is used to store instructions used by the controller 1404;

[0217] Unified memory 1406, input memory 1401, weight memory 1402, and instruction fetch memory 1409 are all on-chip memories. External memories are private to the NPU hardware architecture.

[0218] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.

[0219] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.

[0220] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.

[0221] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.

[0222] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website, a computer, a training device or a data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

Claims

1. A model training method, characterized in that: The method comprises: Obtain a first neural network model and M batches of training samples, where M is a positive integer greater than 1, and the M batches of training samples are image data, text data, or audio data; determining a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of batch training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples, and the target incremental training method is used to achieve resistance to catastrophic forgetting when incremental training is performed on the model; According to the M batches of training samples, the first neural network model is self-supervised trained by the target incremental training method to obtain a second neural network model.

2. The method according to claim 1, characterized in that The greater the degree of catastrophic forgetting generated, the greater the degree of anti-catastrophic forgetting effect achieved by the target incremental training method when performing incremental training of the model.

3. The method according to claim 1 or 2, characterized in that The target incremental training method includes at least one of the following: Basic incremental training, incremental training based on parameter regularization, incremental training based on training sample replay; The basic incremental training means sequentially using each batch of training samples in the M batches of training samples to perform self-supervised training; The parameter regularization-based incremental training means that when performing the self-supervised training, the loss function of the self-supervised training includes a regularization constraint; The incremental training based on training sample playback means that when performing the self-supervised training, the training samples used in each batch model training include part of the training samples used in the previous batch model training.

4. The method according to claim 3, characterized in that The determining of a target incremental training method according to sample distribution characteristics between each batch of training samples in the M batches of training samples includes: According to the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples satisfying a first preset condition, it is determined that the target incremental training method is the basic incremental training, and when the first neural network model is self-supervised trained by the target incremental training method, the loss function of the self-supervised training does not include a regularization constraint; wherein the first preset condition includes: the categories of the training samples included in each batch of batch training samples are the same.

5. The method according to claim 3, characterized in that The determining of a target incremental training method according to sample distribution characteristics between each batch of training samples in the M batches of training samples includes: According to the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples satisfying the second preset condition, the target incremental training method is determined to be the basic incremental training, and when the first neural network model is self-supervised trained by the target incremental training method, the loss function of the self-supervised training does not include a regularization constraint, and the second preset condition includes: the training samples included in each batch of batch training samples have the same semantics but different categories.

6. The method according to claim 3, characterized in that The determining of a target incremental training method according to sample distribution characteristics between each batch of training samples in the M batches of training samples includes: According to the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples satisfying the third preset condition, the target incremental training method is determined to be the basic incremental training and the incremental training based on parameter regularization, and the third preset condition includes: the semantics of the training samples included in each batch of batch training samples are different.

7. The method according to claim 3, characterized in that The determining of a target incremental training method according to sample distribution characteristics between each batch of training samples in the M batches of training samples includes: According to the fact that the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples meet the fourth preset condition, the target incremental training method is determined to be the basic incremental training and the incremental training based on training sample playback, and the fourth preset condition includes: the training samples included in each batch of batch training samples come from different fields.

8. The method according to any one of claims 1 to 7, characterized in that: The first neural network model is a pre-trained model or is obtained by fine-tuning the pre-trained model.

9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: Obtain data to be processed, and process the data to be processed through the second neural network model to obtain a processing result; wherein the data to be processed is image data, text data or audio data.

10. A model training device, characterized in that: The device comprises: An acquisition module is configured to acquire a first neural network model and M batches of training samples, where M is a positive integer greater than 1, and the M batches of training samples are image data, text data, or audio data; a determination module, configured to determine a target incremental training method based on sample distribution characteristics between each batch of training samples in the M batches of training samples, wherein the sample distribution characteristics are related to the degree of catastrophic forgetting generated by the model when incremental training is performed based on each batch of training samples, and the target incremental training method is configured to achieve resistance to catastrophic forgetting when incremental training is performed on the model; A model training module is used to perform self-supervised training on the first neural network model through the target incremental training method based on the M batches of training samples to obtain a second neural network model.

11. The device according to claim 10, characterized in that The greater the degree of catastrophic forgetting generated, the greater the degree of anti-catastrophic forgetting effect achieved by the target incremental training device when performing incremental training of the model.

12. The device according to claim 10 or 11, characterized in that The target incremental training device includes at least one of the following: Basic incremental training, incremental training based on parameter regularization, incremental training based on training sample replay; The basic incremental training means sequentially using each batch of training samples in the M batches of training samples to perform self-supervised training; The parameter regularization-based incremental training means that when performing the self-supervised training, the loss function of the self-supervised training includes a regularization constraint; The incremental training based on training sample playback means that when performing the self-supervised training, the training samples used in each batch model training include part of the training samples used in the previous batch model training.

13. The device according to claim 12, characterized in that The determination module is used to determine that the target incremental training device is the basic incremental training based on the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples satisfying a first preset condition, and when the first neural network model is self-supervised trained by the target incremental training device, the loss function of the self-supervised training does not include a regularization constraint; wherein the first preset condition includes: the categories of the training samples included in each batch of batch training samples are the same.

14. The device according to claim 12, characterized in that The determination module is used to determine that the target incremental training device is the basic incremental training based on that the sample distribution characteristics between each batch of batch training samples in the M batches of batch training samples meet the second preset condition, and when the first neural network model is self-supervised trained by the target incremental training device, the loss function of the self-supervised training does not include a regularization constraint, and the second preset condition includes: the training samples included in each batch of batch training samples have the same semantics but different categories.

15. The device according to claim 12, characterized in that The determination module is used to determine that the target incremental training device is the basic incremental training and the parameter regularization-based incremental training based on the sample distribution characteristics between each batch of batch training samples in the M batch training samples satisfying a third preset condition, and the third preset condition includes: the semantics of the training samples included in each batch of batch training samples are different.

16. The device according to claim 12, characterized in that The determination module is used to determine that the target incremental training device is the basic incremental training and the incremental training based on training sample playback based on whether the sample distribution characteristics between each batch of batch training samples in the M batch training samples meet a fourth preset condition, and the fourth preset condition includes: the training samples included in each batch of batch training samples come from different fields.

17. The device according to any one of claims 10 to 16, characterized in that The first neural network model is a pre-trained model or is obtained by fine-tuning the pre-trained model.

18. The device according to any one of claims 10 to 17, characterized in that The device further comprises: The data processing module is used to obtain the data to be processed and process the data to be processed through the second neural network model to obtain a processing result; wherein the data to be processed is image data, text data or audio data.

19. A model training device, characterized in that: The device includes a memory and a processor; the memory stores codes, and the processor is configured to obtain the codes and execute the method according to any one of claims 1 to 9.

20. A computer storage medium, characterized in that The computer storage medium stores one or more instructions, which, when executed by one or more computers, enable the one or more computers to implement the method according to any one of claims 1 to 9.

21. A computer program product, characterized in that The computer program product comprises codes for implementing the steps of the method according to any one of claims 1 to 9 when the codes are executed.