Model training method and device for incremental learning, medium and electronic equipment

By selecting a set of data to be replayed in the machine learning model and training it with a new dataset, the problems of accuracy decline and resource consumption when the model is converted from an old dataset to a new dataset are solved. This achieves the goal of maintaining the information of the old dataset on the new dataset while reducing the demand for computing resources, and is suitable for various machine learning applications.

CN115456195BActive Publication Date: 2025-12-19GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211053917.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-31
Publication Date
2025-12-19
Estimated Expiration
2042-08-31

AI Technical Summary

Technical Problem

Existing technologies cause a decrease in accuracy on old datasets when machine learning models are transferred from old datasets to new datasets, and the model training process requires a large amount of computing resources, increasing hardware costs.

Method used

By obtaining a first model, training a second model using a second dataset, and selecting a data group to be replayed on the first dataset, training a third model using the second dataset and the data group to be replayed, we can ensure that the model achieves ideal accuracy on both the old and new datasets, while reducing the amount of data to reduce the consumption of computing resources.

Benefits of technology

It achieves the goal of preserving information from old datasets during incremental learning, improving the model's accuracy on new datasets, and reducing the overhead and hardware cost of model training, making it suitable for any machine learning scenario.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115456195B_ABST
    Figure CN115456195B_ABST
Patent Text Reader

Abstract

The present disclosure provides a model training method, device, medium and electronic equipment for incremental learning, relating to the technical field of artificial intelligence and computer. The method comprises: obtaining a first model; the first model is obtained by training a base model using a first data set; training the first model using a second data set to obtain a second model; obtaining m data groups in the first data set, determining a second loss function value of the second model on each data group; m is a positive integer not less than 2; selecting one or more to-be-playback data groups from the m data groups according to the second loss function value of the second model on each data group; training the first model using the second data set and the to-be-playback data group to obtain a third model. The present disclosure effectively realizes incremental learning, reduces the overhead of the model training process and the occupation of computer resources, and is conducive to controlling hardware costs.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of artificial intelligence and computer technology, and in particular, to a model training method for incremental learning, a model training device for incremental learning, a computer readable storage medium and an electronic device. BACKGROUND

[0002] When a machine learning model is trained on a new data set after being trained on an old data set, the accuracy on the old data set often decreases.

[0003] To solve the above problem, in related technologies, the model is trained after mixing the new data set and the old data set. However, due to the increase in the amount of sample data, the model training process needs to occupy more computer resources, and the hardware cost increases. SUMMARY

[0004] The present disclosure provides a model training method for incremental learning, a model training device for incremental learning, a computer readable storage medium and an electronic device to at least partially solve the problem of the model training process occupying more computer resources in related technologies.

[0005] According to a first aspect of the present disclosure, a model training method for incremental learning is provided, comprising: obtaining a first model; the first model is obtained by training a base model using a first data set; training the first model using a second data set to obtain a second model; obtaining m data groups in the first data set, and determining a second loss function value of the second model on each data group; m is a positive integer not less than 2; selecting one or more to-be-playback data groups from the m data groups according to the second loss function value of the second model on each data group; and training the first model using the second data set and the to-be-playback data groups to obtain a third model.

[0006] According to a second aspect of the present disclosure, a model training device for incremental learning is provided, comprising: a model obtaining module configured to obtain a first model; the first model is obtained by training a base model using a first data set; a first training module configured to train the first model using a second data set to obtain a second model; a loss function value determining module configured to obtain m data groups in the first data set, and determine a second loss function value of the second model on each data group; m is a positive integer not less than 2; a to-be-playback data group selecting module configured to select one or more to-be-playback data groups from the m data groups according to the second loss function value of the second model on each data group; and a second training module configured to train the first model using the second data set and the to-be-playback data groups to obtain a third model.

[0007] According to a third aspect of the present disclosure, a computer readable storage medium is provided, which stores a computer program, the computer program being executed by a processor to implement the model training method of the first aspect and possible implementation manners thereof.

[0008] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the model training method of the first aspect and possible implementation manners thereof by executing the executable instructions.

[0009] The technical solution of the present disclosure has the following beneficial effects:

[0010] On the one hand, a scheme capable of realizing incremental learning is provided, the first model is trained by using the second data set and the to-be-playback data group in the first data set, so that the first model does not forget the information of the first data set while learning the information of the second data set, and the third model trained can achieve a relatively ideal accuracy on both the first data set and the second data set, effectively realizing the training goal of incremental learning. On the other hand, in the process of training the first model to obtain the third model, the second data set and the to-be-playback data group are used, and the entire first data set is not used, thereby reducing the data amount of samples, reducing the overhead of the model training process and the occupation of computer resources, which is conducive to controlling the hardware cost. On the other hand, the present scheme has no limitation on the type and task of the model, and has high universality, and can be applied to any scene related to machine learning. BRIEF DESCRIPTION OF DRAWINGS

[0011] Figure 1 A flowchart of a model training method for incremental learning in the present exemplary embodiment is shown;

[0012] Figure 2 A sub-flowchart of the model training method in the present exemplary embodiment is shown;

[0013] Figure 3 A schematic diagram of the model training method in the present exemplary embodiment is shown;

[0014] Figure 4 A flowchart of a training method of an image processing model in the present exemplary embodiment is shown;

[0015] Figure 5 A schematic diagram of incremental learning and image processing in the present exemplary embodiment is shown;

[0016] Figure 6 A schematic diagram of the system architecture of the operating environment of the present exemplary embodiment is shown;

[0017] Figure 7FIG. 1 shows a schematic diagram of a model training device for incremental learning according to an example embodiment of the present disclosure.

[0018] Figure 8 FIG. 2 shows a schematic diagram of an electronic device according to an example embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] Example embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings.

[0020] The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this application, illustrate certain non-limiting embodiments of the present disclosure. The illustrated embodiments are intended to explain the present disclosure and not to impose limitations on the scope of the present disclosure. In the drawings:

[0021] In the related art, a model is trained after mixing a new data set with an old data set. As the amount of data of the samples is increased, the overhead of the model training process is increased, and more computer resources are required. For example, a larger data set will occupy more storage resources, each batch or epoch of the training process will consume more processor resources, and the read-write overhead will be increased, etc. Thus, the hardware cost is increased.

[0022] Incremental learning is a method of learning a machine learning model on a new data set while not causing a significant decrease in accuracy on an old data set. However, the incremental learning scheme in the related art has limitations or it is difficult to achieve a relatively ideal accuracy. For example, in an incremental learning scheme, samples in the old data set that are close to the mean value of the class features (these samples have strong representativeness) are added to the new data set for training the model. This scheme cannot be applied to model training scenarios other than classification models, and has great limitations.

[0023] In view of one or more of the above problems, an example embodiment of the present disclosure provides a model training method for incremental learning. Figure 1 A flow of the model training method is shown, which can include the following steps S110-S150:

[0024] Step S110, obtaining a first model; the first model is obtained by training a base model by using a first data set;

[0025] Step S120, training the first model by using a second data set to obtain a second model;

[0026] Step S130, obtaining m data groups in the first data set, and determining a second loss function value of the second model on each data group; m is a positive integer not less than 2;

[0027] Step S140, selecting one or more to-be-playback data groups from the m data groups according to the second loss function value of the second model on each data group;

[0028] Step S150, training the first model by using the second data set and the to-be-playback data groups to obtain a third model.

[0029] The first model can be a model before incremental learning, the second model is an intermediate model used in the process of incremental learning, and the third model is a model obtained through incremental learning. The first data set can be regarded as an old data set in incremental learning, and the second data set can be regarded as a new data set in incremental learning. The third model can achieve a relatively ideal accuracy on both the first data set and the second data set.

[0030] Based on the above method, on the one hand, a scheme capable of realizing incremental learning is provided, the first model is trained by using the second data set and the to-be-playback data groups in the first data set, so that the first model does not forget the information of the first data set while learning the information of the second data set, and the third model trained can achieve a relatively ideal accuracy on both the first data set and the second data set, effectively realizing the training goal of incremental learning. On the other hand, in the process of training the first model to obtain the third model, the second data set and the to-be-playback data groups are used, and the entire first data set is not used, thereby reducing the data amount of samples, reducing the overhead of the model training process and the occupation of computer resources, and being conducive to controlling the hardware cost. On the other hand, the scheme has no limitation on the type and task of the model, has high universality, and can be applied to any scene related to machine learning.

[0031] The following will be specifically described. Figure 1

[0032] Referring to Figure 1 In step S110, the first model is obtained; the first model is obtained by training a base model by using a first data set.

[0033] ​The base model can be an initially constructed machine learning model, or a model at an arbitrary training stage, such as a pre-trained model. The base model is trained on the first data set to obtain a first model. That is, the base model is a model before training on the first data set, and the first model is a model after training on the first data set. Generally, the first model and the base model can be of the same type and perform the same task. In the example embodiment, the base model can be a machine learning model of any type and for any task. For example, the base model can be a neural network model for image processing, and the first model can also be a neural network model for image processing.

[0034] The first data set is used to train the first model. The data type and specific content of the first data set are related to the type and task of the base model or the first model.

[0035] In an embodiment, the first data set can be an image data set, which can include first sample images and first label images corresponding to the first sample images. The first label images can be images obtained by performing manual image processing on the first sample images. The first model obtained by training on the first data set can be an image processing model, which can achieve an effect equivalent to or close to manual image processing.

[0036] In an embodiment, the process of obtaining the first model from the base model can be regarded as a process of incremental learning. The base model can be a model trained on a certain old data set different from the first data set. The first data set can be a new data set compared to the old data set, and the first model can be a model obtained by performing incremental learning on the new data set.

[0037] Continuing to refer to Figure 1 In step S120, the first model is trained using the second data set to obtain a second model.

[0038] In the example embodiment, the training target of the incremental learning (i.e., the training target of the entire training process) is to enable the first model to achieve a relatively ideal accuracy on both the first data set and the second data set after training. Therefore, the second data set can be a new data set compared to the first data set. It should be understood that the old data set and the new data set are relative concepts rather than absolute concepts. For example, in the above embodiment, the process of obtaining the first model from the base model is regarded as a process of incremental learning. The first data set is a new data set in the process of incremental learning, and the first data set is an old data set compared to the second data set.

[0039] The first data set and the second data set are two different data sets, so that the machine learning model can learn different information from the two data sets. The data types of the two data sets can be the same, for example, the first data set is an image data set, and the second data set is also an image data set. Therefore, the difference between the two data sets can be reflected in the specific content, for example, the specific numerical values of the samples in the two data sets are different, which can cause the two data sets to provide different information for the model training process.

[0040] For example, the first data set is an image data set, and the second data set is an image data set different from the first data set, which can include a second sample image and a second label image corresponding to the second sample image. The second label image can be an image obtained by at least manually processing the second sample image. The manual image processing in the second data set can be different from the manual image processing in the first data set, for example, the manual image processing in the first data set can be implemented by a first user (which can be a general end user or a professional art personnel) or based on a first image style (such as a first filter); the manual image processing in the second data set can be implemented by a second user or based on a second image style (such as a second filter). This makes the first data set and the second data set have different image processing characteristics, and the machine learning model can learn different information from the two data sets.

[0041] The first model is trained on the second data set to obtain a second model. This training process actually simulates the way of conventional training, that is, in the case of obtaining a new data set (i.e., the second data set), the old data set (the first data set) is not used, and only the new data set is used to train the model. Such a training method will cause the model to lose part of the information of the old data set, which is referred to herein as "forgetting" the information of the old data set, which is the fundamental reason for the decrease in accuracy of the model on the old data set after learning the new data set. Since the second model can forget the information in the first data set, the accuracy on the first data set can be poor. Therefore, the second model is not the desired model and can be regarded as an intermediate model required in the incremental learning process.

[0042] The training process in step S120 can be regarded as a "virtual" training process, that is, the parameters of the first model are not directly overwritten in the training process, and the first model is retained while the second model is trained. For example, a copy of the first model can be made first, and the copy is trained using the second data set to obtain the second model while the first model is retained.

[0043] In an implementation, a target can be set for the training process of step S120. For example, the target can be that the first model is trained using the second dataset so that the loss function value of the first model on the second dataset is lower than a preset first threshold, or the loss function value of the first model on the second dataset converges, or the accuracy of the first model on the validation set (or the test set) of the second dataset reaches a preset second threshold, or the training process reaches a preset number of iterations, etc. The first threshold and the second threshold can be set according to experience or specific circumstances. When the target is reached in the training process, the training can be ended, and the second model can be obtained.

[0044] In an implementation, the first model does not need to be fully trained in step S120, but only needs to learn the information of the second dataset. For example, the first model can be trained for one epoch on the second dataset, so that each sample in the second dataset is actually substituted into the first model for training, and the first model learns the information of each sample. Regardless of the training result after one epoch, the training can be ended, and the second model can be obtained. In this way, the training process of step S120 can be simplified, and the efficiency can be improved.

[0045] With reference to the foregoing description of the first model and the second model, the first model can be trained using the first dataset, and the second model can be trained using the second dataset. Figure 1 In step S130, m data groups in the first dataset are obtained, and the second loss function value of the second model on each data group is determined; m is a positive integer not less than 2.

[0046] A data group is a data unit in a dataset, and can include a batch of data in the dataset. For example, a data group can be a batch of data. m data groups in the first dataset are obtained, and m is a positive integer not less than 2. The value of m can be set according to experience or specific requirements. In an implementation, the m data groups can be all data groups in the first dataset. For example, assuming that m is 100, the first dataset is divided into 100 batches, and thus 100 data groups are obtained, which cover the entire first dataset. In this way, the data group to be played back can be selected in the range of the entire first dataset, and a part of data groups is avoided to be missed.

[0047] In the case of obtaining m data groups, each data group can be substituted into the second model, and the loss function value can be calculated. In order to distinguish the first loss function value in the following description, the loss function value of the second model on each data group is referred to as the second loss function value. The loss function of the second model is not limited in the disclosure, and can be, for example, an L1 loss function, an L2 loss function, a cross-entropy, etc.

[0048] Each of the data groups can include a number of first sample images and corresponding first label images. The first sample images are input into the second model, and a loss function value is calculated between images output by the second model and the first label images. An average of the loss function values on each data group is calculated to obtain a second loss function value of the second model on each data group.

[0049] With reference to the foregoing Figure 1 In step S140, one or more data groups to be played back are selected from the m data groups according to the second loss function value of the second model on each data group.

[0050] The second model can have forgotten information in the first data set, and the second loss function value of the second model on each data group can represent the degree of forgetting of the second model on each data group. In the example embodiment, one or more data groups to be played back are selected from the m data groups according to the second loss function value. The data groups to be played back can be data groups with a higher degree of forgetting of the second model, and can be used for data playback training in incremental learning.

[0051] In an embodiment, k data groups to be played back can be selected from the m data groups in descending order of the second loss function value; k is a positive integer less than m, and the value of k can be set according to experience or specific requirements. For example, k is 3, and the three data groups with the highest second loss function value are selected from the m data groups as the data groups to be played back.

[0052] In an embodiment, a third threshold value of the second loss function value can be set in advance, and the third threshold value can be determined according to experience or specific circumstances. Data groups with a second loss function value greater than the third threshold value are selected from the m data groups as the data groups to be played back.

[0053] In an embodiment, after the m data groups in the first data set are obtained, the model training method can further include the following steps:

[0054] A first loss function value of the first model on each of the data groups is determined.

[0055] Each data group can be substituted into the first model to calculate the loss function value and obtain the first loss function value. The disclosure does not limit the loss function of the first model, which can be, for example, an L1 loss function, an L2 loss function, a cross-entropy, etc. The first loss function value and the second loss function value can be the same type of loss function, such as both being an L1 loss function.

[0056] Exemplarily, each of the data groups can include a certain number of first sample images and corresponding first label images. The first sample images are input into the first model, and the loss function value is calculated between the image output by the first model and the first label images. The average value of the loss function value is calculated on each data group to obtain the first loss function value of the first model on each data group.

[0057] In an implementation, in the case of determining the first loss function value and the second loss function value, reference is made to Figure 2 As shown, selecting one or more to-be-played data groups from the m data groups according to the second loss function value of the second model on each data group can include the following steps S210 and S220.

[0058] Step S210, obtaining the loss function difference value corresponding to each data group according to the difference between the first loss function value of the first model on each data group and the second loss function value of the second model on each data group.

[0059] The loss function difference value can be the difference between the second loss function value and the first loss function value, or the absolute value of the difference between the first loss function value and the second loss function value. Exemplarily, the loss function difference value can be as follows:

[0060]

[0061] wherein x i represents any data group in the m data groups, s(x i ) represents the loss function difference value corresponding to x i . represents the first model, represents the first loss function value of the first model on x i . represents the second model, represents the second loss function value of the second model on x i . Formula (1) represents that the first loss function value and the second loss function value corresponding to the same data group are subtracted and the absolute value is taken to obtain the loss function difference value corresponding to the data group.

[0062] Step S220, selecting one or more to-be-played data groups from the m data groups based on the loss function difference value corresponding to each data group, and the loss function difference value corresponding to the to-be-played data group is greater than the loss function difference value corresponding to the data group not selected.

[0063] The loss function difference value reflects the performance difference of the first model and the second model on each data group. Since the first model has sufficiently learned the information of each data group in the first data set, the higher the loss function difference value corresponding to a data group, the higher the degree of forgetting of the second model for the data group after the training in step S120. The data group to be played back can be selected according to the loss function difference value. Generally, the data group with a higher loss function difference value is preferentially selected as the data group to be played back, and the loss function difference value corresponding to the data group to be played back should be greater than the loss function difference value corresponding to other unselected data groups.

[0064] Compared with the second loss function value, the loss function difference value can more accurately reflect the performance difference of the second model and the first model on each data group, and further represent the degree of forgetting of the second model for each data group. Therefore, selecting the data group to be played back based on the loss function difference value can ensure that the selected data group to be played back is more accurate.

[0065] In an embodiment, the above selecting one or more data groups to be played back from the m data groups based on the loss function difference value corresponding to each data group can include the following steps:

[0066] Selecting k data groups to be played back from the m data groups in the order from high to low of the loss function difference value; k = z-m, z is a preset proportion value in the range of (0, 1).

[0067] The value of z can be determined according to experience or specific circumstances, for example, z can be 1 / 2. Selecting the data group to be played back according to the preset proportion value can make the number of data groups to be played back adapt to the size of the first data set itself, and ensure that the sample size used in subsequent training is appropriate.

[0068] In an embodiment, a fourth threshold value of the loss function difference value can be set in advance, and the data group with a loss function difference value greater than the fourth threshold value can be selected from the m data groups as the data group to be played back.

[0069] Continuing to refer to Figure 1 In step S150, the first model is trained using the second data set and the data group to be played back to obtain a third model.

[0070] By selecting one or more data groups to be played back, a data subset for data playback is extracted from the first data set, which is combined with the second data set to form an incremental learning data set. Obviously, the data amount of the incremental learning data set is less than the total data amount of the first data set and the second data set, thereby reducing the sample size involved in step S150.

[0071] The first model can be trained using the incremental learning dataset. During the training process, the first model can learn the information of the second dataset while learning the information of the to-be-playback data group, thereby improving the forgetting of the information of the first dataset. Through the training, a third model can be obtained, which can be the final output model in the example embodiment. The third model can learn the information of the first dataset and the second dataset at the same time, and achieve a relatively ideal accuracy on both datasets, thereby effectively achieving the training goal of incremental learning.

[0072] Figure 3 A schematic diagram of a model training method is shown. A base model is trained using a first dataset to obtain a first model; the first model is trained using a second dataset to obtain a second model; the first dataset is divided into m batches, and a first loss function value of the first model on each batch and a second loss function value of the second model on each batch are determined; a difference between the first loss function value and the second loss function value is calculated to obtain a loss function difference value corresponding to each batch; one or more to-be-playback batches are selected from the m batches according to the loss function difference value corresponding to each batch; an incremental learning dataset is formed using the second dataset and the to-be-playback batches, and the first model is trained using the incremental learning dataset to obtain a third model.

[0073] The training process from the first model to the third model can be regarded as an incremental learning process. In the example embodiment, the incremental learning process is performed on the first model, but the incremental learning process can also be performed on the second model. Figure 1 Similar incremental learning can also be performed before or after each step shown. For example, as described above, the training process from the base model to the first model can be implemented in an incremental learning manner, and the first dataset can be a new dataset in the incremental learning process. Alternatively, after obtaining the third model, if a new dataset (such as a third dataset) compared to the second dataset is obtained, a method similar to the method shown in the example embodiment can be used to select a to-be-playback data group from the second dataset and use the to-be-playback data group and the new dataset together to train the third model to obtain a new model, thereby achieving incremental learning. Figure 1

[0074] ​In an embodiment, the weight of each data group can be determined according to the second loss function value or the loss function difference value, and the corresponding weight can be set for different data groups in the training process in step S150, so that the training process is more focused on the data groups with larger weights, thereby accelerating the training process. For example, after obtaining the loss function difference value corresponding to each data group and selecting the data group to be played back, the loss function difference value corresponding to the data group to be played back can be normalized as the weight of each data group to be played back. The weight of each data group in the second data set can be set as the maximum weight (e.g., 1). In the training process in step S150, the first model can be trained based on the weight of each data group to be played back and each data group in the second data set. For example, when a data group (a data group to be played back or a data group in the second data set) is substituted into the first model and the loss function value is calculated, the loss function value can be multiplied by the weight of the data group to adjust the size of the loss function value. In this way, for the data group with a larger weight, when updating the model parameters, the model parameters tend to determine a larger gradient, thereby obtaining a larger adjustment amplitude. In fact, the model is more likely to learn the information in the data group with a larger weight, thereby accelerating the convergence of the model and improving the training efficiency.

[0075] In an embodiment, the first data set can be a general data set for image processing. The meaning of "general" is that it is not targeted at a specific user, but is general for all users or within a certain range. For example, the first data set can include first sample images and corresponding first label images, and the first label images are images obtained by manually processing the first sample images by different users (or art personnel), so the first data set integrates the preference information of different users for image processing and has a certain generality. The first model obtained by training the base model using the first data set can be a general image processing model, i.e., an image processing model applicable to different users.

[0076] On the contrary, the second data set can be a personalized data set for the target user. The target user can be any specific user, and the personalized data set refers to a data set that can reflect the user's personalized style or preference. For example, a second sample image and a second label image corresponding to the second sample image can be obtained to form a second data set. The second label image is an image obtained by at least manually processing the second sample image by the target user, so the second data set reflects the preference information of the target user for image processing and has personal specificity. The third model obtained by training the first model using the second data set and the data group to be played back in the first data set learns the personalized preference information of the target user for image processing while learning the general image processing preference information, so the third model can be a personalized image processing model for the target user, thereby meeting the personalized needs of the target user.

[0077] Reference Figure 4 As shown in FIG. 4, the flow of the training method of the image processing model can include the following steps S410-S470:

[0078] In step S410, a general image processing model is obtained; the general image processing model is obtained by training a basic image processing model using a first data set, and the first data set is a general data set for image processing.

[0079] In step S420, a second sample image and a second label image corresponding to the second sample image are obtained to form a second data set; the second label image is an image obtained by at least performing manual image processing by a target user on the second sample image; and the second data set is a personalized data set for the target user.

[0080] Of course, in addition to manual image processing by the target user, other processing such as image enhancement, image color mapping, etc. can also be performed on the second sample image to obtain the second label image.

[0081] In step S430, the general image processing model is trained using the second data set to obtain an intermediate image processing model. The intermediate image processing model is equivalent to the second model described above. For example, the general image processing model can be trained for one epoch using the second data set to obtain the intermediate image processing model.

[0082] In step S440, m data groups in the first data set are obtained, and a first loss function value of the general image processing model on each data group and a second loss function value of the intermediate image processing model on each data group are determined.

[0083] In step S450, the difference between the first loss function value and the second loss function value is calculated to obtain a loss function difference value corresponding to each data group.

[0084] In step S460, based on the loss function difference value corresponding to each data group, one or more to-be-playback data groups are selected from the m data groups.

[0085] In step S470, the general image processing model is trained using the second data set and the to-be-playback data groups to obtain a personalized image processing model for the target user.

[0086] In an embodiment, the second label image can be an image obtained by first processing the second sample image using the first model and then performing manual image processing by the target user. In this way, the second sample image is a result of combining model processing and manual image processing, and generally has high quality, thereby improving the quality of the second data set and facilitating improvement of the quality of the third model finally obtained by training.

[0087] In an embodiment, the step S110 or S420 described above can include the following steps:

[0088] The color filter model with the highest usage frequency of the target user is selected from the pre-trained multiple color filter models as the first model.

[0089] The color filter model can be one of the image processing models, which is used to perform color mapping processing on the image under a specific filter to show the stylized effect of the filter. For example, the types of filters can include bright, fresh warm, fresh cold, bright, preference, leisure, vitality, silver tone, etc. For each type of filter, a corresponding color filter model can be set and trained. According to the usage habit of the target user, the color filter model corresponding to the filter with the highest usage frequency of the target user is taken as the first model. Therefore, the first model has the preference information of the target user to some extent.

[0090] The second label image is an image obtained by at least performing manual color adjustment implemented by the target user on the second sample image. Therefore, the second data set can reflect the preference information of the target user for image color adjustment. Training the first model on the second data set and the to-be-played data set can enable the first model to learn the preference information of the target user for image color adjustment on the basis of retaining the original characteristics of the color filter model with the highest usage frequency of the target user. Finally, a new color filter model that can highly meet the needs of the target user, i.e., the third model, is obtained.

[0091] In an embodiment, the model training method can further include the following steps:

[0092] The third model is used to process the to-be-processed image to obtain a target image.

[0093] In the case where the training is completed and the third model is obtained, the third model can be deployed to an actual application environment. The third model can be an image processing model. In the actual application environment, a to-be-processed image, which can be an image uploaded by a user, is obtained, and the to-be-processed image is input into the third model for processing to obtain a target image. The target image can simultaneously reflect the image processing effects in the first data set and the second data set.

[0094] Figure 5A schematic diagram of incremental learning and image processing is shown. A model with the highest usage frequency of a target user is selected from multiple color filter models as a first model; images processed by the target user are collected, the images before processing are taken as second sample images, and the images processed by the first model and the target user are taken as second label images to form a second data set; a first data set used for training the first model is obtained, and a to-be-played data group is determined; the first model is subjected to incremental learning by using the second data set and the to-be-played data group, and a third model is obtained, which is a personalized color filter model for the target user; when the target user inputs a to-be-processed image, the third model is used to process the image, and a corresponding target image is output.

[0095] Figure 6 A system architecture of an operating environment of the present exemplary embodiment is shown. The system architecture 600 can include a terminal 610 and a server 620. The terminal 610 can be a mobile phone, a tablet computer, a personal computer, a smart wearable device, a drone, or the like. The server 620 can be a background system providing a model training service or an image processing service, and can be a single server or a cluster of multiple servers. The terminal 610 and the server 620 can be connected by a wired or wireless communication link to exchange data.

[0096] In an embodiment, the model training method in the present exemplary embodiment can be executed by the server 620. The server 620 itself has a first model and a first data set deployed thereon, and can collect a second data set from the terminal 610. For example, the terminal 610 can be a terminal used by a target user, which uploads second sample images and second label images processed by the target user to the server 620, so that the server 620 obtains the second data set. The server 620 obtains a third model by executing the model training method. The third model can be a personalized image processing model for the target user. Subsequently, the server 620 can process images uploaded by the terminal 610 by using the third model to provide image processing services meeting the individual needs of the target user. Alternatively, the server 620 can deploy the third model on the terminal 610, and the terminal 610 can provide localized image processing services by using the third model to obtain images meeting the individual needs of the target user. For example, the terminal 610 or the server 620 can process a to-be-processed image by using the third model to obtain a target image.

[0097] In an embodiment, the model training method in the present exemplary embodiment can be executed by the terminal 610. For example, the server 620 can send the first model and the first data set to the terminal 610, and the terminal 610 can execute the model training method in combination with a local second data set to obtain a third model. Subsequently, the terminal 610 can also execute related tasks such as image processing tasks by using the third model.

[0098] As can be seen from the above, the execution subject of the model training method in the example embodiment can be the terminal 610 or the server 620.

[0099] The example embodiment of the present disclosure also provides a model training device for incremental learning. Referring to Figure 7 As shown in the figure, the model training device 700 can include:

[0100] The model obtaining module 710 is configured to obtain a first model; the first model is obtained by training a base model using a first data set;

[0101] The first training module 720 is configured to train the first model using a second data set to obtain a second model;

[0102] The loss function value determining module 730 is configured to obtain m data groups in the first data set, and determine a second loss function value of the second model on each data group; m is a positive integer not less than 2;

[0103] The data group to be played back selecting module 740 is configured to select one or more data groups to be played back from the m data groups according to the second loss function value of the second model on each data group;

[0104] The second training module 750 is configured to train the first model using the second data set and the data group to be played back to obtain a third model.

[0105] In an embodiment, the loss function value determining module 730 is further configured to determine a first loss function value of the first model on each data group.

[0106] The above selecting one or more data groups to be played back from the m data groups according to the second loss function value of the second model on each data group includes:

[0107] According to the difference between the first loss function value of the first model on each data group and the second loss function value of the second model on each data group, a loss function difference value corresponding to each data group is obtained;

[0108] Based on the loss function difference value corresponding to each data group, one or more data groups to be played back are selected from the m data groups, and the loss function difference value corresponding to the data group to be played back is greater than the loss function difference value corresponding to the data group not selected.

[0109] In an embodiment, the above selecting one or more data groups to be played back from the m data groups based on the loss function difference value corresponding to each data group includes:

[0110] Select k data groups to be played back from the m data groups in descending order of loss function difference; k = z*m, z is a preset ratio value in the range of (0, 1).

[0111] In an embodiment, the first data set is a general data set for image processing, and the first model is a general image processing model; the second data set is a personalized data set for the target user, and the third model is a personalized image processing model for the target user.

[0112] The first training module 720 is further configured to: before training the first model by using the second data set, obtain a second sample image and a second label image corresponding to the second sample image to form the second data set; the second label image is an image obtained by performing at least manual image processing implemented by the target user on the second sample image.

[0113] In an embodiment, the second label image is an image obtained by performing manual image processing on the second sample image by using the first model and then by the target user.

[0114] In an embodiment, the above obtaining the first model comprises:

[0115] Selecting, from the pre-trained plurality of color filter models, a color filter model with the highest usage frequency by the target user as the first model.

[0116] The second label image is an image obtained by performing at least manual color adjustment implemented by the target user on the second sample image.

[0117] In an embodiment, the model training apparatus 700 can further comprise an image processing module configured to:

[0118] Processing the image to be processed by using the third model to obtain a target image.

[0119] The specific details of each part of the above apparatus have been described in detail in the method embodiment, and the undisclosed details can be referred to the content of the method embodiment, and thus will not be described again.

[0120] The exemplary embodiments of the present disclosure also provide a computer readable storage medium, which can be implemented in the form of a program product, including program codes for causing an electronic device to perform the steps according to various exemplary embodiments of the present disclosure described in the above "Exemplary Method" section of the present specification when the program product is run on the electronic device. In an alternative embodiment, the program product can be implemented in the form of a portable compact disc read-only memory (CD-ROM) and includes program codes, and can be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in the present document, the readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus or device.

[0121] The program product can employ any combination of one or more readable media. The readable media can be a readable signal medium or a readable storage medium. The readable storage medium, for example, can be, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include an electrical connection having one or more wires, a portable disc, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0122] The computer readable signal medium can include a data signal propagated in baseband or propagated as a carrier wave, in which the readable program codes are carried. Such propagated data signal can take on many forms, including but not limited to electro-magnetic signal, optical signal or any suitable combination of the above. The readable signal medium can also be any readable medium that is not a readable storage medium, which can send, propagate or transmit the program for use by or in connection with an instruction execution system, apparatus or device.

[0123] The program codes contained on the readable medium can be transmitted by any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0124] Program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0125] Exemplary embodiments of this disclosure also provide an electronic device, which may be, for example, the control node described above. The electronic device may include a processor and a memory. The memory stores executable instructions for the processor, such as program code. The processor executes these executable instructions to perform the model training method or image editing method of this exemplary embodiment.

[0126] The following is for reference. Figure 8 The electronic device is illustrated by way of a general-purpose computing device. It should be understood that... Figure 8 The electronic device 800 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.

[0127] like Figure 8 As shown, the electronic device 800 may include: a processor 810, a memory 820, a bus 830, an I / O (input / output) interface 840, and a network adapter 850.

[0128] The memory 820 may include volatile memory, such as RAM 821 and cache unit 822, and may also include non-volatile memory, such as ROM 823. The memory 820 may also include one or more program modules 824, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0129] Bus 830 is used to connect different components of electronic device 800 and may include data bus, address bus and control bus.

[0130] Electronic device 800 can communicate with one or more external devices 2000 (such as keyboard, mouse, external controller, etc.) through I / O interface 840.

[0131] The electronic device 800 can communicate with one or more networks through the network adapter 850, for example, the network adapter 850 can provide a mobile communication solution such as 3G / 4G / 5G, or provide a wireless communication solution such as a wireless local area network, Bluetooth, near field communication, etc. The network adapter 850 can communicate with other modules of the electronic device 800 through the bus 830.

[0132] Although Figure 8 Other hardware and / or software modules can also be employed in the electronic device 800, including but not limited to a display, microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc. are not shown in the electronic device 800.

[0133] It should be noted that although several modules or units of devices for action execution are mentioned in the above detailed description, such division is not mandatory. Indeed, according to exemplary embodiments of the present disclosure, features and functionalities of two or more modules or units described above can be embodied in one module or unit. Conversely, features and functionalities of one module or unit described above can be further divided into embodied by multiple modules or units.

[0134] Those skilled in the art can understand that various aspects of the present disclosure can be implemented as a system, a method or a program product. Therefore, various aspects of the present disclosure can be embodied as a whole hardware embodiment, a whole software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects, which can be collectively referred to as "circuitry", "module" or "system" herein. Those skilled in the art will easily understand other embodiments of the present disclosure after considering the specification and practicing the application disclosed herein. The present application is intended to cover any variations, uses or adaptive changes of the present disclosure that follow the general principles of the present disclosure and include common knowledge or conventional techniques in the art that are not disclosed by the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are indicated by the claims.

[0135] It should be understood that the present disclosure is not limited to the precise structures described above and shown in the drawings and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is only limited by the appended claims.

Claims

1. A model training method for incremental learning, characterized in that, include: Obtain the first model; The first model was obtained by training a base model using the first dataset; The first model is trained using the second dataset to obtain the second model; Obtain m data groups from the first dataset, and determine the second loss function value of the second model on each data group; m is a positive integer not less than 2; Based on the second loss function value of the second model on each of the data groups, one or more data groups to be replayed are selected from the m data groups; The first model is trained using the second dataset and the data set to be replayed to obtain the third model; Wherein, the first dataset is a general dataset for image processing, and the first model is a general image processing model; the second dataset is a personalized dataset for the target user, and the third model is a personalized image processing model for the target user; Before training the first model using the second dataset, the method further includes: A second sample image and a corresponding second label image are obtained to form the second dataset; the second label image is an image obtained by performing at least some manual image processing on the second sample image by the target user.

2. The method according to claim 1, characterized in that, The method further includes: Determine the first loss function value of the first model on each of the data sets; The step of selecting one or more data groups to be replayed from the m data groups based on the second loss function value of the second model on each data group includes: Based on the difference between the first loss function value of the first model on each data group and the second loss function value of the second model on each data group, the loss function difference value corresponding to each data group is obtained; Based on the difference in the loss function corresponding to each of the data groups, one or more data groups to be replayed are selected from the m data groups, wherein the difference in the loss function corresponding to the data group to be replayed is greater than the difference in the loss function corresponding to the unselected data groups.

3. The method according to claim 2, characterized in that, The step of selecting one or more data groups to be replayed from the m data groups based on the difference in the loss function corresponding to each data group includes: According to the loss function difference from high to low, k data groups to be replayed are selected from the m data groups; k = z·m, where z is a preset ratio value in the range of (0, 1).

4. The method according to claim 1, characterized in that, The second labeled image is obtained by first processing the second sample image using the first model, and then by the target user performing manual image processing.

5. The method according to claim 1, characterized in that, The process of obtaining the first model includes: Select the color filter model most frequently used by the target user from a number of pre-trained color filter models, and use it as the first model; The second label image is an image obtained by manually adjusting the colors of the second sample image at least by the target user.

6. The method according to claim 1, characterized in that, The method further includes: The third model is used to process the image to be processed to obtain the target image.

7. A model training device for incremental learning, characterized in that, include: The model acquisition module is configured to acquire the first model; The first model was obtained by training a base model using the first dataset; The first training module is configured to train the first model using the second dataset to obtain the second model; The loss function value determination module is configured to acquire m data groups from the first dataset and determine the second loss function value of the second model on each data group; m is a positive integer not less than 2; The data group selection module is configured to select one or more data groups to be replayed from the m data groups based on the second loss function value of the second model on each data group; The second training module is configured to train the first model using the second dataset and the data set to be replayed, to obtain the third model; Wherein, the first dataset is a general dataset for image processing, and the first model is a general image processing model; the second dataset is a personalized dataset for the target user, and the third model is a personalized image processing model for the target user; The first training module is further configured to: before training the first model using the second dataset, acquire a second sample image and a second label image corresponding to the second sample image to form the second dataset; the second label image is an image obtained by performing at least some manual image processing performed by the target user on the second sample image.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 6.

9. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the method of any one of claims 1 to 6 by executing the executable instructions.