Training methods and apparatus for image processing models, storage media and electronic devices

By determining the sample type based on the sample loss value and increasing the training weight of the target sample during the image processing model training process, the problem of model overfitting is solved and the training effect of the model is improved.

CN114330744BActive Publication Date: 2025-12-02ZHEJIANG DAHUA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111605270.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2025-12-02
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

Existing image processing models are prone to overfitting due to noise during training, as they are trained on the same sample images of varying training difficulty. This reduces model performance.

Method used

By obtaining the sample loss value of each training sample in each iteration cycle, the sample type is determined, and attention tags are added to the training samples of the target sample type, increasing their training weights in each iteration cycle until the convergence condition matching the target sample type is reached.

Benefits of technology

It improves the training performance of image processing models, prevents models from deviating from the correct direction during training, and enhances the targeted training effect of models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114330744B_ABST
    Figure CN114330744B_ABST
Patent Text Reader

Abstract

This invention discloses a training method, apparatus, storage medium, and electronic device for an image processing model. The method includes: acquiring the sample loss value of each training sample after simulated training in each iteration cycle; determining the sample type of the training sample based on the acquired sample loss values ​​obtained in multiple iteration cycles, wherein the sample type indicates the degree of convergence of the training sample in the simulated training; adding attention markers to target training samples of the target sample type, and using the target training samples to train the original model until a target model that meets a second convergence condition matching the target sample type is obtained, wherein the attention markers indicate the increase of training weights for the target training samples in the model training in each iteration cycle. This invention solves the technical problem of poor image processing model performance caused by improper model training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computers, and more specifically, to a training method and apparatus for an image processing model, a storage medium, and an electronic device. Background Technology

[0002] Currently, image processing models are increasingly widely used in data processing. The accuracy of image processing models in data processing applications is typically related to model training. And during the model training phase, the training data has a significant impact on model performance.

[0003] During model training, the model is typically trained using only positive and negative samples, without further classification of the sample images. However, training the same model on images of varying difficulty levels can lead to overfitting due to noise in the later stages of training, thus reducing the performance of the trained image processing model.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This invention provides a training method and apparatus for an image processing model, a storage medium, and an electronic device, to at least solve the technical problem of poor performance of image processing models caused by improper model training.

[0006] According to one aspect of the present invention, a training method for an image processing model is provided, comprising: obtaining a sample loss value obtained after simulated training of each training sample in each iteration cycle, wherein the simulated training involves iteratively training an original model using the training samples until the model loss value of the original model reaches a first convergence condition; determining the sample type to which the training sample belongs based on multiple sample loss values ​​obtained by the training samples in multiple iteration cycles, wherein the sample type is used to indicate the degree of convergence of the training sample in the simulated training to reach the convergence condition; adding attention markers to target training samples of a target sample type, and using the target training samples to train the original model until a target model that meets a second convergence condition matching the target sample type is obtained, wherein the attention markers are used to indicate increasing the training weights of the target training samples in the model training in each iteration cycle.

[0007] According to another aspect of the present invention, a training apparatus for an image processing model is also provided, comprising: an acquisition unit, configured to acquire sample loss values ​​obtained after simulated training of each training sample in each iteration cycle, wherein the simulated training involves iteratively training an original model using the training samples until the model loss value of the original model reaches a first convergence condition; a determination unit, configured to determine the sample type to which the training sample belongs based on the acquired sample loss values ​​obtained by the training sample in multiple iteration cycles, wherein the sample type is used to indicate the degree of convergence of the training sample in the simulated training to reach the convergence condition; and a training unit, configured to add attention markers to target training samples of a target sample type and use the target training samples to train the original model until a target model that meets a second convergence condition matching the target sample type is obtained, wherein the attention markers are used to indicate increasing the training weights of the target training samples in the model training in each iteration cycle.

[0008] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, which is configured to execute the above-described model training method at runtime.

[0009] According to another aspect of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute the model training method described above through the computer program.

[0010] In this embodiment of the invention, the loss value of each training sample is obtained after simulated training in each iteration cycle of the simulated training. Based on the multiple loss values ​​of the training samples obtained in multiple iteration cycles, the sample type of the training sample is determined. An attention marker is added to the target training sample of the target sample type. The attention marker is used to indicate the increase of the training weight of the target training sample in the model training in each iteration cycle. The original model is trained using the target training sample until a target model that meets the second convergence condition matching the target sample type is obtained. By using the sample loss value of the model in each iteration cycle of the simulated training to determine the sample type of the training sample, the training weight of the target training sample of the target sample type is increased in the model training process by adding attention markers. This achieves the purpose of increasing the training weight of the target training sample of the target sample type in the model training, determining the model training direction, and avoiding the model from deviating from the training direction during the training process. This realizes the technical effect of using the classification of training samples to achieve targeted training of the model, thereby improving the performance of the trained model and solving the technical problem of poor image processing model performance caused by improper model training. Attached Figure Description

[0011] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0012] Figure 1 This is a schematic diagram of the application environment of an optional image processing model training method according to an embodiment of the present invention;

[0013] Figure 2 This is a flowchart illustrating an optional image processing model training method according to an embodiment of the present invention;

[0014] Figure 3 This is a flowchart illustrating an optional image processing model training method according to an embodiment of the present invention;

[0015] Figure 4 This is a flowchart illustrating an optional image processing model training method according to an embodiment of the present invention;

[0016] Figure 5 This is a schematic diagram of training samples for an optional image processing model training method according to an embodiment of the present invention;

[0017] Figure 6 This is a schematic diagram of the structure of a training device for an optional image processing model according to an embodiment of the present invention;

[0018] Figure 7 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. Detailed Implementation

[0019] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0020] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0021] According to one aspect of the present invention, a method for training an image processing model is provided. Optionally, the image processing model training method may be applied to, but is not limited to, [examples of other methods]. Figure 1 In the environment shown, terminal device 100 interacts with server 120 via network 110. Server 120 is not limited to training the model required by terminal device 100, and sends the trained target model to terminal device 100 via network 110. Terminal device 100 is not limited to feeding back model running data to server 120 via network 110.

[0022] Server 120 may include, but is not limited to, a database 122 and a processing engine 124. Database 122 stores training sample data, various data generated during training, and may also store trained target model data and model execution data fed back by terminal device 100. Processing engine 124 trains the model based on the training sample data and model parameters stored in database 122. Model training by server 120 may not be limited to executing S102 to S106 sequentially. S102: Obtain the sample loss value for each training sample. Obtain the sample loss value of each training sample after simulated training in each iteration cycle. Simulated training involves iteratively training the original model using the training samples until the model loss value of the original model reaches the first convergence condition. S104: Determine the sample type of the training sample. Based on the multiple sample loss values ​​obtained from the training samples in multiple iteration cycles, determine the sample type of the training sample. The sample type indicates the degree of convergence of the training sample in the simulated training to the convergence condition. S106, add attention markers to the target training samples of the target sample type, and use the target training samples to train the original model. Continue until a target model that meets the second convergence condition matching the target sample type is obtained. The attention markers are used to indicate the increase of training weights in the model training of the target training samples in each iteration cycle.

[0023] Optionally, in this embodiment, the terminal device 100 may be a terminal device configured with a target client, which may include, but is not limited to, at least one of the following: mobile phone (such as Android phone, iOS phone, etc.), laptop computer, tablet computer, PDA, MID (Mobile Internet Devices), PAD, desktop computer, smart TV, etc. The target client is a client running the target model, specifically including but not limited to audio client, video client, instant messaging client, browser client, educational client, etc. The network 110 may include, but is not limited to, wired network and wireless network. The wired network includes: local area network, metropolitan area network, and wide area network. The wireless network includes: Bluetooth, WIFI, and other networks that enable wireless communication. The server 120 may be a single server, a server cluster composed of multiple servers, or a cloud server. The above is merely an example, and no limitation is made in this embodiment.

[0024] As an optional implementation method, such as Figure 2 As shown, the training methods for the above image processing model include:

[0025] S202, obtain the sample loss value of each training sample after simulated training in each iteration cycle, wherein simulated training is to use the training samples to iterate the original model multiple times until the model loss value of the original model reaches the first convergence condition.

[0026] S204. Based on the multiple sample loss values ​​obtained from the training samples over multiple iteration cycles, determine the sample type to which the training samples belong. The sample type is used to indicate the degree of convergence of the training samples in the simulation training to reach the convergence condition.

[0027] S206, add attention markers to the target training samples of the target sample type, and use the target training samples to train the original model until a target model that meets the second convergence condition matching the target sample type is obtained. The attention markers are used to indicate the increase of training weights in the model training of the target training samples in each iteration cycle.

[0028] Simulated training is not limited to training the original model using multiple training samples belonging to the same category to obtain the original model whose loss value reaches the convergence condition. The same category is not limited to the classification category of the training samples themselves, such as the positive sample category and the negative sample category. In the case of a recognition model, the category can also be the category corresponding to the recognition, such as training samples belonging to the same type in type recognition, or training samples belonging to the same object in an object recognition model.

[0029] The convergence condition is not limited to the loss value of the simulated training of the indicator model being less than the preset convergence threshold. If the model loss value is less than the preset convergence threshold, the original model after training is considered to have reached the convergence condition. It is not limited to determining the end of model training based on the model reaching the convergence condition, and the obtained model can be applied.

[0030] Simulated training is not limited to multiple iterations to gradually bring the model loss value closer to the convergence threshold after each iteration. Each iteration cycle can include multiple model training sessions, and the number of training sessions in each iteration cycle is not limited to being the same or different. The number of iteration cycles can be a preset number of cycles, or it can be determined based on the model loss value. That is, if the model loss value reaches the first convergence condition, the current number of iteration cycles is determined as the number of simulation training cycles.

[0031] The sample loss value obtained from training each training sample in each iteration cycle determines the sample type of each sample. The sample type is not limited to matching a preset sample type based on the sample loss value of each training sample to determine the sample type of each training sample.

[0032] After determining the sample types of all training samples, an attention marker is added to each target training sample belonging to the target sample type. The original model is then trained using all training samples, including those with attention markers, until a convergent target model is obtained. The attention marker increases the training weights of the model during training. If no attention marker exists in the training samples, the training weights for each training sample are not necessarily the same, until the loss value of the training sample reaches the convergence threshold. If the loss value of a training sample reaches the convergence threshold, the model is not necessarily prohibited from focusing on the training sample in the next iteration. If attention markers are added to the training samples, the training weights of the training samples are increased, not limited to those whose loss values ​​have not reached the convergence threshold. The specific degree of increase in training weights is not limited here.

[0033] The convergence thresholds indicated by the first and second convergence conditions may be the same or different, and are not limited to being determined based on the classification accuracy of the sample type and the model accuracy of the target model.

[0034] In this embodiment, the loss value of each training sample is obtained after simulated training in each iteration cycle of the simulated training. Based on the multiple loss values ​​of the training samples obtained in multiple iteration cycles, the sample type of the training sample is determined. An attention marker is added to the target training sample of the target sample type. The attention marker is used to indicate the increase of the training weight of the target training sample in the model training in each iteration cycle. The original model is trained using the target training sample until a target model that meets the second convergence condition matching the target sample type is obtained. By using the sample loss value of the model in each iteration cycle of the simulated training to determine the sample type of the training sample, the training weight of the target training sample of the target sample type is increased in the model training process by adding attention markers. This achieves the purpose of increasing the training weight of the target training sample of the target sample type in the model training, determining the model training direction, and avoiding the model from deviating from the training direction during the training process. This realizes the technical effect of using the classification of training samples to achieve targeted training of the model, thereby improving the performance of the trained image processing model and solving the technical problem of poor image processing model performance caused by improper model training.

[0035] As an optional implementation method, determining the sample type of a training sample based on multiple sample loss values ​​obtained over multiple iterations of the acquired training samples includes:

[0036] S1. Based on the sample loss value of each training sample in each iteration cycle of the simulated training, draw an iterative loss map for each training sample, wherein the iterative loss map is used to indicate the correspondence between the sample loss value of the training sample and the iteration cycle of the simulated training.

[0037] S2, determine the sample type of the training sample based on the sample simulation loss value indicated by the iterative loss map of each training sample.

[0038] The iterative loss plot is not limited to using the sample loss value of the training samples in each iteration cycle and the number of iteration cycles as the x and y axes, respectively, to construct the iterative loss plot of the training samples. The simulated sample loss value is not limited to the convergence value of the sample loss value indicated by the iterative loss plot. The convergence value is not limited to the mean of the sample loss values ​​when the model reaches the convergence threshold, or other sample convergence values ​​determined based on the iterative loss plot, such as the sample loss values ​​at the end of the iterative loss plot.

[0039] The sample type is determined based on the degree of convergence indicated by the simulated loss value of the sample and the loss value threshold indicated by the preset sample type.

[0040] As an optional implementation, determining the sample type of a training sample based on the sample simulation loss value indicated by the iterative loss map of each training sample includes:

[0041] If the simulated loss value of the training sample is less than the first threshold, the training sample is determined to belong to the first sample type, wherein the first sample type converges during the simulated training.

[0042] If the simulated loss value of the training sample is greater than the second threshold, the training sample is determined to be a noise sample, where the second threshold is greater than the first threshold.

[0043] If the simulated loss value of the training sample is greater than or equal to the first threshold and less than or equal to the second threshold, the training sample is determined to belong to the type of sample of interest, wherein the type of sample of interest has not converged in the simulated training.

[0044] The first and second thresholds are not limited to those used to indicate the first sample type that has fully converged and the noisy sample type that has not converged at all in the training samples. The first sample of the first sample type has fully converged in the simulated training and is not limited to samples that do not affect the training direction of the model.

[0045] The type of noise sample is not limited to noise samples mixed in with the training samples. The sample loss value of the noise sample is not limited to always being greater than the second threshold during the training process. The noise sample is determined from the training samples by using the second threshold.

[0046] As an optional implementation, determining the sample type of a training sample based on the sample simulation loss value indicated by the iterative loss map of each training sample includes:

[0047] S1, calculate the mean convergence loss of the training samples of the sample type of interest, where the mean convergence loss is the mean of the sample loss values ​​of the training samples when the convergence condition is met.

[0048] S2, determine the target segmentation threshold based on the mean convergence loss of the training samples of the sample type of interest;

[0049] S3 will focus on training samples whose simulated loss value is less than the target segmentation threshold and identify them as target training samples of the target sample type.

[0050] The target sample type is not limited to the portion of training samples identified from the target sample types whose simulated loss values ​​fall between a first threshold and a second threshold. For example, it could be a portion leaning towards the first sample type, a portion leaning towards the noisy sample type, or a portion falling within a preset range. The target segmentation threshold is used to determine the target sample type from the target sample types.

[0051] Model training is not limited to, for example Figure 3As shown. S302, perform simulated training on the original model. Stop the simulated training once the model has converged. S304, obtain the sample loss value for each training sample in each iteration of the simulated training. This is not limited to recording the sample loss value for each training sample in each iteration. S306, plot the iterative loss curve for each training sample. Plot the iterative loss curve based on the correspondence between the number of iterations and the sample loss value. Based on the iterative loss curve of each training sample, determine the first sample type using a first threshold, and then determine the noise sample type using a second threshold, thereby determining the type of training samples that falls between the first and second thresholds. S308, determine the target training samples belonging to the target sample type within the type of training samples that fall ... falls within the type of training samples that falls within the type of training samples that falls within the type of training samples that falls within the type of training samples that falls within the type of training samples that falls within the type of training samples that falls within the type of training samples that falls within the

[0052] As an optional implementation, determining the sample type of a training sample based on the sample simulation loss value indicated by the iterative loss map of each training sample includes:

[0053] S1, Sort the training samples of the sample types of interest according to the sample simulation loss values ​​to obtain the sequence of samples of interest;

[0054] S2 uses the training samples in the target sequence that are located in the target order as the initial target training samples of the target sample type.

[0055] Determining the target sample type from the types of samples of interest can also be done by sorting the samples based on their loss values ​​to obtain a sample sequence. The target order is not limited to multiple orders within a preset order range. When the target training samples are determined, they are not limited to being used as the target training samples for multiple iterations of model training; they can also be updated based on the sample loss values ​​of each iteration, relabeled, and then used for the next iteration of training.

[0056] As an optional implementation method, such as Figure 4 As shown, adding attention markers to target training samples of the target sample type and training the original model using the target training samples includes:

[0057] S402, add attention markers to the initial target training samples, and use the initial target training samples with added attention markers to perform the first iteration of training on the original model;

[0058] S404, Obtain the loss value of the first iteration sample obtained by training the training sample of the sample type of interest based on the first iteration model;

[0059] S406, in the first sequence of training samples of the type of focus obtained by sorting the training samples according to the loss value of the first iteration sample, the training sample located at the target order is used as the second target training sample.

[0060] S408, add attention markers to the training samples of the second target, and use the training samples of the second target with added attention markers to perform a second iteration of training on the original model.

[0061] Not limited to each iteration of model training, the loss values ​​of the samples obtained in the current iteration are used to sort the training samples by the type of sample of interest, thereby determining the target training samples for the next iteration and re-adding interest tags to the target training samples. By updating the target training samples in each iteration, the target sample type is dynamically determined. This allows for dynamic adjustment of the target training samples during model training, thereby dynamically adjusting the model training direction and improving the performance of the trained model.

[0062] As an optional implementation, after adding attention markers to the target training samples of the target sample type and training the original model using the target training samples until a target model that meets the second convergence condition matching the target sample type is obtained, the method further includes: adding reinforcement markers to the target data in the training samples of the attention sample type and using the training samples with reinforcement markers to perform reinforcement training on the target model, wherein the reinforcement training is used to improve the success rate of the target model in recognizing the target data to reach the recognition threshold.

[0063] After identifying the training samples of interest from the training samples, additional boosting tags can be added to the target data in the training samples to enhance the target model and further improve its performance.

[0064] Taking a face recognition model as an example, training samples belonging to the same category are not limited to, for example, Figure 5 As shown in (1), the nine training samples are facial images of the same object from different angles, with different actions and different resolutions, and interference samples mixed in with them. The interference sample is a facial image of a female object located in the lower right corner, which is different in gender and is therefore an interference training sample for this object.

[0065] The sample type for determining training samples based on a type threshold is not limited to, for example... Figure 5 (2) to Figure 5(5) is shown. Based on the iterative loss curve plotted from the loss values ​​of each iteration during the model's simulated training, the convergence value of the training samples is determined. In the case of training sample convergence, for example... Figure 5 (2) As shown in the curve, those samples whose loss value approaches 0 before the end of the simulation training are identified as simple sample types. If the training samples have not converged, the convergence value determined by the curve is used as the sample convergence value for the training samples, thus first identifying the noise samples indicating the noise sample type, such as... Figure 5 (5) shows the target training samples of the target sample type from the remaining training samples. Training samples with a value less than the segmentation threshold are identified as the target training sample type—semi-hard sample type, as shown in (5). Figure 5 As shown in (3). The target data in the training samples, focusing on sample types, is not limited to... Figure 5 (4) contains data corresponding to sunglasses. This strengthens the targeted training of the target model based on the target data.

[0066] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0067] According to another aspect of the present invention, a training apparatus for an image processing model for implementing the training method of the above-described image processing model is also provided. For example... Figure 6 As shown, the device includes:

[0068] The acquisition unit 602 is used to acquire the sample loss value of each training sample after simulated training in each iteration cycle. The simulated training is to use the training samples to iterate the original model multiple times until the model loss value of the original model reaches the first convergence condition.

[0069] The determining unit 604 is used to determine the sample type of the training sample based on the multiple sample loss values ​​obtained by the training sample in multiple iteration cycles. The sample type is used to indicate the degree of convergence of the training sample in the simulation training to reach the convergence condition.

[0070] Training unit 606 is used to add attention markers to target training samples of the target sample type and use the target training samples to train the original model until a target model that meets the second convergence condition matching the target sample type is obtained. The attention markers are used to indicate the increase of training weights in the model training of the target training samples in each iteration cycle.

[0071] Optionally, the determining unit 604 further includes:

[0072] The plotting module is used to plot the iterative loss map of each training sample based on the sample loss value of each training sample in each iteration of the simulated training. The iterative loss map is used to indicate the correspondence between the sample loss value of the training sample and the iteration cycle of the simulated training.

[0073] The determination module is used to determine the sample type of a training sample based on the sample simulation loss value indicated by the iterative loss map of each training sample.

[0074] Optionally, the determining module is further configured to: determine that the training sample belongs to a first sample type when the simulated loss value of the training sample is less than a first threshold, wherein the first sample type has converged during simulated training; determine that the training sample belongs to a noise sample type when the simulated loss value of the training sample is greater than a second threshold, wherein the second threshold is greater than the first threshold; and determine that the training sample belongs to a focus sample type when the simulated loss value of the training sample is greater than or equal to the first threshold and less than or equal to the second threshold, wherein the focus sample type has not converged during simulated training.

[0075] Optionally, the aforementioned determining module is further configured to calculate the mean convergence loss of training samples of the sample type of interest, wherein the mean convergence loss is the mean of the sample loss values ​​of the training samples when the convergence condition is met; determine the target segmentation threshold based on the mean convergence loss of training samples of the sample type of interest; and determine the training samples of the sample type of interest whose simulated loss value is less than the target segmentation threshold as target training samples of the target sample type.

[0076] Optionally, the aforementioned determining module is further configured to sort the training samples of the sample type of interest according to the sample simulation loss value to obtain the sequence of samples of interest; and to use the training sample in the sequence of samples of interest that is located at the target position as the initial target training sample of the target sample type.

[0077] Optionally, the training unit 606 further includes a training module, used to add attention markers to the initial target training samples and use the initial target training samples with added attention markers to perform a first iteration of training on the original model; obtain the first iteration sample loss value of the training samples of the attention sample type trained based on the first iteration model; in the first attention sample sequence obtained by sorting the training samples of the attention sample type according to the first iteration sample loss value, the training sample located at the target position is used as the second target training sample; add attention markers to the second target training sample and use the second target training sample with added attention markers to perform a second iteration of training on the original model.

[0078] Optionally, the training apparatus for the above-mentioned image processing model further includes an enhancement training unit, which is used to add attention markers to target training samples of the target sample type, and use the target training samples to train the original model until a target model that meets the second convergence condition matching the target sample type is obtained. Then, it adds enhancement markers to the target data in the training samples of the attention sample type, and uses the training samples with added enhancement markers to enhance the training of the target model. The enhancement training is used to improve the success rate of the target model in recognizing the target data to reach the recognition threshold.

[0079] In this embodiment, the loss value of each training sample is obtained after simulated training in each iteration cycle of the simulated training. Based on the multiple loss values ​​of the training samples obtained in multiple iteration cycles, the sample type of the training sample is determined. An attention marker is added to the target training sample of the target sample type. The attention marker is used to indicate the increase of the training weight of the target training sample in the model training in each iteration cycle. The original model is trained using the target training sample until a target model that meets the second convergence condition matching the target sample type is obtained. By using the sample loss value of the model in each iteration cycle of the simulated training to determine the sample type of the training sample, the training weight of the target training sample of the target sample type is increased in the model training process by adding attention markers. This achieves the purpose of increasing the training weight of the target training sample of the target sample type in the model training, determining the model training direction, and avoiding the model from deviating from the training direction during the training process. This realizes the technical effect of using the classification of training samples to achieve targeted training of the model, thereby improving the performance of the trained image processing model and solving the technical problem of poor image processing model performance caused by improper model training.

[0080] According to another aspect of the present invention, an electronic device for implementing the training method of the above-described image processing model is also provided. This electronic device may be... Figure 1 The terminal device or server shown. This embodiment uses the electronic device as a server as an example for illustration. Figure 7 As shown, the electronic device includes a memory 702 and a processor 704. The memory 702 stores a computer program, and the processor 704 is configured to execute the steps in any of the above method embodiments via the computer program.

[0081] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.

[0082] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0083] S1, obtain the sample loss value obtained after each training sample is simulated and trained in each iteration cycle. The simulated training is to use the training samples to train the original model multiple times until the model loss value of the original model reaches the first convergence condition.

[0084] S2, based on the multiple sample loss values ​​obtained from the training samples in multiple iteration cycles, determine the sample type to which the training sample belongs. The sample type is used to indicate the degree of convergence of the training sample in the simulation training to reach the convergence condition.

[0085] S3 adds attention markers to the target training samples of the target sample type and uses the target training samples to train the original model until a target model that meets the second convergence condition matching the target sample type is obtained. The attention markers are used to indicate the increase of training weights in the model training of the target training samples in each iteration cycle.

[0086] Alternatively, as those skilled in the art will understand, Figure 7 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones (such as Android phones, iOS phones, etc.), tablets, PDAs, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 7 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 7 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 7 The different configurations shown.

[0087] The memory 702 can be used to store software programs and modules, such as the program instructions / modules corresponding to the model training method and apparatus in this embodiment of the invention. The processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, thereby realizing the aforementioned model training method. The memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 702 may further include memory remotely located relative to the processor 704, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 702 may be used, but is not limited to, to store training samples, training sample types, model data of the original model, model data of the target model, and other information. As an example, such as... Figure 7As shown, the memory 702 may include, but is not limited to, the acquisition unit 602, the determination unit 604, and the training unit 606 in the model training device. Furthermore, it may include, but is not limited to, other module units in the model training device, which will not be elaborated upon in this example.

[0088] Optionally, the transmission device 706 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 706 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 706 is a radio frequency (RF) module, used for wireless communication with the Internet.

[0089] In addition, the aforementioned electronic device also includes: a display 708 for displaying the training samples and attention markers; and a connection bus 710 for connecting the various module components in the aforementioned electronic device.

[0090] In other embodiments, the aforementioned terminal device or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer (P2P) network, and any form of computing device, such as a server, terminal, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.

[0091] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various alternative implementations of the training aspect of the image processing model described above. The computer program is configured to execute the steps in any of the method embodiments described above during runtime.

[0092] Optionally, in this embodiment, the computer-readable storage medium described above may be configured to store a computer program for performing the following steps:

[0093] S1, obtain the sample loss value obtained after each training sample is simulated and trained in each iteration cycle. The simulated training is to use the training samples to train the original model multiple times until the model loss value of the original model reaches the first convergence condition.

[0094] S2, based on the multiple sample loss values ​​obtained from the training samples in multiple iteration cycles, determine the sample type to which the training sample belongs. The sample type is used to indicate the degree of convergence of the training sample in the simulation training to reach the convergence condition.

[0095] S3 adds attention markers to the target training samples of the target sample type and uses the target training samples to train the original model until a target model that meets the second convergence condition matching the target sample type is obtained. The attention markers are used to indicate the increase of training weights in the model training of the target training samples in each iteration cycle.

[0096] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0097] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0098] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0099] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0100] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.

[0101] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0102] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0103] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A training method for an image processing model, characterized in that, include: The sample loss value is obtained after each training sample is simulated and trained in each iteration cycle. The simulated training is to use the training sample to train the original model multiple times until the model loss value of the original model reaches the first convergence condition. The training sample is image data. Based on the multiple sample loss values ​​obtained by the training sample in multiple iteration cycles, the sample type of the training sample is determined, wherein the sample type is used to indicate the degree of convergence of the training sample in the simulation training to reach the convergence condition. Add attention markers to target training samples of the target sample type, and use the target training samples to train the original model until a target model that meets the second convergence condition matching the target sample type is obtained, wherein the attention markers are used to indicate the increase of training weights of the target training samples in the model training in each iteration cycle; Adding attention markers to target training samples of the target sample type, and using the target training samples to train the original model, includes: The attention marker is added to the initial target training sample, and the original model is trained in the first iteration using the initial target training sample with the attention marker added. The initial target training sample is the training sample in the target order of the attention sample sequence obtained by sorting the training samples of the attention sample type according to the sample simulated loss value. The training sample of the attention sample type is the sample whose sample simulated loss value is greater than or equal to a first threshold and less than or equal to a second threshold. The training samples of the type of sample of interest are obtained based on the first iteration sample loss value obtained from the first iteration training; The training sample located at the target position in the first sequence of training samples of the type of focus, which is obtained by sorting the training samples according to the loss value of the first iterative sample, is used as the second target training sample. The attention marker is added to the second target training sample, and the original model is trained in a second iteration using the second target training sample with the attention marker added.

2. The method according to claim 1, characterized in that, The step of determining the sample type of the training sample based on the multiple sample loss values ​​obtained from the training sample over multiple iteration periods includes: Based on the sample loss value of each training sample in each iteration of the simulated training, an iterative loss map is plotted for each training sample, wherein the iterative loss map is used to indicate the correspondence between the sample loss value of the training sample and the iteration cycle of the simulated training; The sample type of the training sample is determined based on the simulated loss value of the sample indicated by the iterative loss map of each training sample.

3. The method according to claim 2, characterized in that, Determining the sample type of the training sample based on the sample simulation loss value indicated by the iterative loss map of each training sample includes: If the simulated loss value of the training sample is less than the first threshold, the training sample is determined to belong to the first sample type, wherein the first sample type has completed convergence in the simulated training. If the simulated loss value of the training sample is greater than the second threshold, the training sample is determined to be a noise sample type, wherein the second threshold is greater than the first threshold; If the simulated loss value of the training sample is greater than or equal to the first threshold and less than or equal to the second threshold, the training sample is determined to belong to the type of sample of interest, wherein the type of sample of interest has not converged in the simulated training.

4. The method according to claim 3, characterized in that, Determining the sample type of the training sample based on the simulated loss value indicated by the iterative loss map of each training sample includes: Calculate the mean convergence loss of the training samples of the sample type of interest, wherein the mean convergence loss is the mean of the sample loss values ​​of the training samples when the convergence condition is met; The target segmentation threshold is determined based on the mean convergence loss of the training samples of the sample type of interest. Training samples whose simulated loss value is less than the target segmentation threshold in the sample type of interest are identified as the target training samples of the target sample type.

5. The method according to claim 3, characterized in that, Determining the sample type of the training sample based on the simulated loss value indicated by the iterative loss map of each training sample includes: According to the simulated loss value of the sample, the training samples of the sample type of interest are sorted to obtain the sequence of samples of interest; The training sample located at the target position in the sequence of samples of interest is used as the initial target training sample of the target sample type.

6. The method according to any one of claims 3 to 5, characterized in that, After adding attention markers to target training samples of the target sample type and training the original model using the target training samples until a target model that meets the second convergence condition matching the target sample type is obtained, the method further includes: Enhanced labels are added to the target data in the training samples of the sample type of interest, and the target model is trained using the training samples with the enhanced labels, wherein the training is used to improve the success rate of the target model in recognizing the target data to a recognition threshold.

7. A training device for an image processing model, characterized in that, include: The acquisition unit is used to acquire the sample loss value obtained by each training sample after simulated training in each iteration cycle, wherein the simulated training is to use the training sample to perform multiple iterations of training on the original model until the model loss value of the original model reaches the first convergence condition, and the training sample is image data. The determining unit is used to determine the sample type of the training sample based on the multiple sample loss values ​​obtained by the training sample in multiple iteration cycles, wherein the sample type is used to indicate the degree of convergence of the training sample in the simulation training to reach the convergence condition. A training unit is used to add attention markers to target training samples of the target sample type and use the target training samples to train the original model until a target model that meets the second convergence condition matching the target sample type is obtained, wherein the attention markers are used to indicate the increase of training weights of the target training samples in the model training in each iteration cycle. The apparatus is further configured to add the attention marker to the initial target training samples, and use the initial target training samples with the attention marker added to perform a first iteration of training on the original model, wherein the initial target training samples are training samples located at the target position in the attention sample sequence obtained by sorting the training samples of the attention sample type according to the sample simulated loss value, and the training samples of the attention sample type are samples whose sample simulated loss value is greater than or equal to a first threshold and less than or equal to a second threshold; obtain the first iteration sample loss value of the training samples of the attention sample type based on the first iteration of training; take the training samples located at the target position in the first attention sample sequence obtained by sorting the training samples of the attention sample type according to the first iteration sample loss value as the second target training samples; add the attention marker to the second target training samples, and use the second target training samples with the attention marker added to perform a second iteration of training on the original model.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method according to any one of claims 1 to 6.

9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 6 through the computer program.

Citation Information

Patent Citations

  • Model optimization method and device based on machine learning and storage medium

    CN112819085A