A model training method, device and equipment

By dynamically adjusting the data augmentation probability during model training and optimizing model performance based on iterative test results, the impact of data augmentation on model generalization performance is resolved, and the overall performance of the model is improved.

CN117094898BActive Publication Date: 2026-04-07GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-12
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In existing technologies, data augmentation for each category is performed according to a preset probability during model training, which leads to a decrease in the model's generalization performance, especially affecting the model's adaptability to real data in the later stages of training.

Method used

By acquiring image training sets and image test sets of different categories, iterative training and testing are performed based on the initial data augmentation probability. The test results are compared to adjust the data augmentation probability, ensuring that the data augmentation probability of a certain category is reduced when the model's performance improves, and otherwise the data augmentation probability of that category is increased, until the number of iterations reaches the total number of iterations.

Benefits of technology

It improves the generalization and overall performance of the model and resolves the negative impact of data augmentation on the model's generalization performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117094898B_ABST
    Figure CN117094898B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of machine learning, and provides a model training method, device and equipment.The method comprises the following steps: S1, acquiring an image training set and different categories of image test sets; S2, performing P times of iterative training on a model based on the image training set and different categories of data enhancement probabilities; inputting the different categories of image test sets into the trained model for testing to obtain test results corresponding to the categories; S3, performing M times of iterative training on the model after the previous round of training based on the image training set and different categories of data enhancement probabilities; inputting the different categories of test sets into the model after this round of training for testing to obtain test results corresponding to the categories; S4, comparing the test results; if the performance of the model in a certain category is improved, the data enhancement probability of the category is reduced; otherwise, the data enhancement probability of the category is increased; returning to S3 until the number of iterations is equal to the total number of iterations.The application can improve the generalization performance of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of machine learning technology, such as a model training method, apparatus, and device. Background Technology

[0002] Data augmentation refers to image manipulation techniques such as rotation, blurring, and color transformation. Data augmentation is a crucial part of deep learning model training, significantly improving the model's generalization performance. However, currently, each type of data augmentation operates on a predetermined probability, which is not always beneficial throughout the training process. Especially in the later stages, data augmentation can negatively impact the model's adaptation to real-world data, reducing its generalization performance. Summary of the Invention

[0003] To address the aforementioned technical problems, the purpose of this application is to provide a model training method, apparatus, and device, which aims to solve the technical problem that the generalization performance of the model is reduced because each type of data augmentation in the current model training process is applied to the image according to a preset probability.

[0004] To address the aforementioned technical problems, in a first aspect, embodiments of this application provide a model training method, comprising:

[0005] Obtain an image training set and image test sets of different categories; different data augmentation methods are used for different image categories.

[0006] Based on the image training set and the initial data augmentation probabilities for different categories, the model to be trained is subjected to P iterations of training to obtain the model after one round of iterative training; where P is a positive integer.

[0007] The different categories of image test sets are respectively input into the model after one round of iterative training for testing, and the test results of the corresponding categories are obtained;

[0008] Based on the image training set and the initial data augmentation probabilities for different categories, the model trained in the previous iteration is trained for M iterations. After the model trained in the previous iteration has completed M iterations, training stops, and the image test sets for different categories are input into the model trained in this iteration for testing to obtain the test results for the corresponding categories; where M is a positive integer.

[0009] The test results of this round are compared with the test results of the previous round. If the model trained in this round has improved the performance of a certain category compared with the model trained in the previous round, the initial data augmentation probabilities of different categories are updated by reducing the data augmentation probability of that category. Otherwise, the initial data augmentation probabilities of different categories are updated by increasing the data augmentation probability of that category.

[0010] Returning to the steps of performing M iterations of training on the model after the previous iteration, based on the image training set and the initial data augmentation probabilities for different categories, until the number of iterations equals the total number of iterations.

[0011] Furthermore, the step of performing P iterations of training on the model to be trained based on the image training set and the initial data augmentation probabilities for different categories to obtain the model after one round of iterative training includes:

[0012] Obtain a sample image from the image training set;

[0013] The sample image is input into the model to be trained, and the sample image is augmented according to the initial data augmentation probabilities of different categories to obtain the data-augmented image;

[0014] Based on the data-enhanced image, the model to be trained is trained. After training is completed, the step of obtaining a sample image from the image training set is returned until all images in the image training set are traversed to obtain the model after one iteration of training.

[0015] Based on the image training set and the initial data augmentation probabilities for different categories, the model after one iteration of training is trained for P-1 iterations to obtain the model after one round of iterative training.

[0016] Furthermore, P is determined according to the following formula:

[0017] P = N / 5;

[0018] Wherein, N is the total number of iterations.

[0019] Furthermore, the initial data augmentation probabilities for each of the different categories are all set to 0.5.

[0020] Furthermore, before obtaining the image training sets for the different categories, the process also includes:

[0021] Obtain the image test set to be processed;

[0022] Different data augmentations are performed on the image test set to be processed to obtain image test sets of corresponding categories.

[0023] Furthermore, the step of performing different data augmentations on the image test set to be processed to obtain image test sets of corresponding categories includes:

[0024] Different geometric transformations are applied to the image test set to be processed to obtain image test sets of corresponding categories;

[0025] Different color transformation processes are applied to the image test set to be processed to obtain image test sets of corresponding categories.

[0026] Furthermore, the step of performing different geometric transformations on the image test set to obtain image test sets of corresponding categories includes:

[0027] The image set to be processed is flipped, rotated, cropped, deformed, and scaled to obtain image test sets of different categories.

[0028] Furthermore, the step of performing different color transformations on the image test set to obtain image test sets of corresponding categories includes:

[0029] The image test set to be processed is blurred, its color is changed, it is erased, and it is filled to obtain the image test set of the corresponding category.

[0030] Secondly, embodiments of this application also provide a model training apparatus, comprising:

[0031] The acquisition module is used to acquire the image training set and the image test set of different categories; different image categories correspond to different data augmentation methods;

[0032] The training module is used to perform P iterations of training on the model to be trained based on the image training set and the initial data augmentation probabilities of different categories, to obtain the model after one round of iterative training; where P is a positive integer.

[0033] The testing module is used to input the image test sets of different categories into the model after one round of iterative training for testing, and obtain the test results of the corresponding categories.

[0034] The training and testing module is used to perform M iterations of training on the model after the previous iteration based on the image training set and the initial data augmentation probabilities of different categories. After the model after the previous iteration has completed M iterations of training, training is stopped, and the image test sets of different categories are respectively input into the model after the current iteration for testing to obtain the test results of the corresponding categories; where M is a positive integer.

[0035] The comparison and update module is used to compare the test results of the current round with the test results of the previous round. If the model trained in the current round has improved the performance of a certain category compared with the model trained in the previous round, the initial data augmentation probability of different categories is updated by reducing the data augmentation probability of that category; otherwise, the initial data augmentation probability of different categories is updated by increasing the data augmentation probability of that category.

[0036] The return module is used to return the steps of training the model M times based on the image training set and the initial data augmentation probabilities of different categories, until the number of iterations equals the total number of iterations.

[0037] Thirdly, embodiments of this application also provide a computer device, including a memory and a processor, wherein the memory stores a computer program, characterized in that the processor executes the computer program to implement the steps of the model training method described in any of the above claims.

[0038] This application provides a model training method, comprising: acquiring an image training set and image test sets of different categories; wherein, different categories of images correspond to different data augmentation methods; based on the image training set and initial data augmentation probabilities of different categories, performing P iterations of training on the model to be trained to obtain a model after one round of iterative training; wherein, P is a positive integer; inputting the image test sets of different categories into the model after one round of iterative training for testing to obtain test results for the corresponding categories; based on the image training set and the initial data augmentation probabilities of different categories, performing M iterations of training on the model after the previous round of iterative training; when the model after the previous round of iterative training has completed M iterations of training, stopping training, and transferring the different categories of images to the training set; and performing M iterations of training on the model after the previous round of iterative training. Image test sets of the same category are input into the model trained in the current iteration for testing, and test results for the corresponding category are obtained; where M is a positive integer; the test results of the current iteration are compared with the test results of the previous iteration. If the model trained in the current iteration has improved performance in a certain category compared to the model trained in the previous iteration, the initial data augmentation probabilities of different categories are updated by reducing the data augmentation probability of that category; otherwise, the initial data augmentation probabilities of different categories are updated by increasing the data augmentation probability of that category; the process returns to the step of performing M iterations of training on the model trained in the previous iteration based on the image training set and the initial data augmentation probabilities of different categories, until the number of iterations equals the total number of iterations. This embodiment of the application solves the problem of the impact of data augmentation of different categories on the model's generalization performance during model training by comparing the model's performance in different categories after each iteration of training, and by reducing the data augmentation probability of a certain category when the model's performance in a certain category improves, and increasing the data augmentation probability of a certain category when the model's performance in a certain category is almost unchanged or decreases. This improves the model's generalization performance and ultimately enhances the overall performance of the model. Attached Figure Description

[0039] Figure 1 This is a flowchart illustrating a model training method provided in the first embodiment of this application;

[0040] Figure 2 This is a flowchart illustrating the process of obtaining a model after one round of iterative training, provided in the first embodiment of this application.

[0041] Figure 3 This is a schematic diagram of the structure of a model training device provided in the second embodiment of this application;

[0042] Figure 4 A schematic block diagram of the structure of a computer device provided in the third embodiment of this application.

[0043] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0045] Those skilled in the art will understand that, unless explicitly stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of features, integers, steps, operations, elements, modules, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, modules, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any modules and all combinations of one or more associated listed items.

[0046] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.

[0047] Reference Figure 1 This is a flowchart illustrating a model training method disclosed in this application, including:

[0048] S1. Obtain the image training set and the image test set of different categories; where different categories of images correspond to different data augmentation methods;

[0049] S2. Based on the image training set and the initial data augmentation probabilities of different categories, the model to be trained is trained P times to obtain the model after one round of iterative training; where P is a positive integer.

[0050] S3. Input the image test sets of different categories into the model after one round of iterative training for testing, and obtain the test results of the corresponding categories;

[0051] S4. Based on the image training set and the initial data augmentation probabilities for different categories, perform M iterations of training on the model after the previous iteration. After the model after the previous iteration has completed M iterations of training, stop training and input the image test sets for different categories into the model after this iteration for testing to obtain the test results for the corresponding categories; where M is a positive integer.

[0052] S5. Compare the test results of this round with the test results of the previous round. If the model trained in this round has improved the performance of a certain category compared with the model trained in the previous round, then update the initial data augmentation probability of different categories by reducing the data augmentation probability of that category; otherwise, update the initial data augmentation probability of different categories by increasing the data augmentation probability of that category.

[0053] S6. Return the steps of performing M iterations of training on the model after the previous iteration based on the image training set and the initial data augmentation probabilities of different categories, until the number of iterations equals the total number of iterations.

[0054] Regarding step S1 above, it should be noted that the images in the image training set can be obtained from publicly available image datasets, such as the ImageNet dataset, or captured by electronic devices with shooting capabilities, such as cameras, surveillance equipment, and smartphones. The different categories of image test sets can be obtained by performing different data augmentation techniques on the image test sets to be processed. Taking one image as an example, random rotation, random blurring, and color transformation are applied to that image to obtain three different types of images. It should be understood that the number of images in each type of image test set is basically the same.

[0055] In step S2 above, it should be noted that different categories of data augmentation probabilities may include rotation data augmentation probability, blur data augmentation probability, color transformation data augmentation probability, etc. This application does not limit the types of categories. It should also be noted that the categories of the images in the test set are consistent with the categories of data augmentation.

[0056] In this embodiment, it should be noted that when an image is input into the model, the model will perform data augmentation on the image according to different categories of data augmentation probabilities. For example, assuming the data augmentation probability of random rotation is 0.5 and the data augmentation probability of random blurring is 0.5, the model will perform data augmentation on the image based on these two data augmentation probabilities. For example, the model may only perform random rotation processing on the image, or only perform random blurring processing on the image, or it may perform both random blurring and random rotation processing on the image. The model will then be trained based on this data-augmented image.

[0057] In this embodiment, it should also be noted that in actual program code, one training iteration is usually represented as one epoch. Therefore, the statement "training the model to be trained for P iterations to obtain the model after one round of training" means that training is stopped after P epochs, resulting in the model after one round of training. P is generally equal to N / 5, where N represents the total number of epochs of model training, i.e., the total number of training iterations. It should be noted that N is preset.

[0058] Regarding step S3 above, it should be noted that to understand the model's performance in each category, different image test sets for each category need to be input into the model for testing. These different image test sets can include rotation test sets, blur test sets, color transformation test sets, and so on. It should also be noted that the performance evaluation metrics for the model vary depending on the task. For example, for classification tasks, the accuracy / error rate is the performance evaluation metric.

[0059] In step S4 above, it should be noted that since this application needs to determine whether the model's performance improves or declines across different categories after each training iteration, and thus adjust the data augmentation probability accordingly, a test is required after each training iteration. Furthermore, the number of iterations M is designed based on actual needs. Generally, more iterations per round result in fewer iterations with a fixed total number of iterations, leading to fewer tests and thus shorter overall training time. However, fewer tests result in a lower frequency of data augmentation probability adjustment, potentially hindering optimal performance. Therefore, the specific value of M needs to be set based on the actual situation.

[0060] In step S5 above, it should be noted that since each round of iterative training is based on the original image training set, if the model's performance in a certain category is improved, then in order to improve the model's generalization performance for images of that category, the data augmentation probability of that category should be reduced. Conversely, if the model's performance in a certain category remains almost unchanged or decreases, the data augmentation probability of that category should be increased.

[0061] In step S6 above, it should be noted that since each round of iterative training is based on the original image training set, the updated data augmentation probabilities of different categories, and the model trained in the previous round, after comparing the test results, the model needs to be trained in the next round based on the updated data augmentation probabilities of different categories.

[0062] This application's embodiments compare the model's performance on different categories after each round of training iterations. When the model's performance on a certain category is improved, the data augmentation probability of that category is reduced. When the model's performance on a certain category remains almost unchanged or decreases, the data augmentation probability of that category is increased. This solves the problem of the impact of different categories of data augmentation on the model's generalization performance during model training, thereby improving the model's generalization performance and ultimately improving the overall model performance.

[0063] Please see Figure 2 In one embodiment, the step of performing P iterations of training on the model to be trained based on the image training set and the initial data augmentation probabilities for different categories to obtain a model after one round of iterative training includes:

[0064] S21. Obtain a sample image from the image training set;

[0065] S22. Input the sample image into the model to be trained, and perform data augmentation on the sample image according to the initial data augmentation probabilities of different categories to obtain the data-augmented image;

[0066] S23. Based on the data-enhanced image, train the model to be trained. After training is completed, return to the step of obtaining a sample image from the image training set until all images in the image training set have been traversed to obtain the model after one iteration of training.

[0067] S24. Based on the image training set and the initial data augmentation probabilities of different categories, perform P-1 iterations of training on the model after one iteration to obtain the model after one round of iteration training.

[0068] This application embodiment performs data augmentation on sample images in the initial stage of model training. Since the data-augmented image can produce an image that is different from the original image, the model can be trained on different images each time, which can improve the generalization performance and robustness of the model compared to training on the same image each time.

[0069] In one embodiment, P is determined according to the following formula:

[0070] P = N / 5;

[0071] Wherein, N is the total number of iterations.

[0072] In the embodiments of this application, it should be noted that when the number of iterations reaches 20% of the total number of iterations, the model can basically meet the basic requirements. Therefore, the first test node is taken as the number of iterations reaching 20% ​​of the total number of iterations.

[0073] In one embodiment, the initial data augmentation probabilities for each of the different categories are all set to 0.5.

[0074] In the embodiments of this application, it should be noted that by setting the initial data augmentation probability of different categories to 0.5, the probability of data augmentation for each category is the same in the initial stage, and each category has a 50% chance of being selected and a 50% chance of not being selected.

[0075] In one embodiment, prior to obtaining the training sets of the different categories of images, the method further includes:

[0076] Obtain the image test set to be processed;

[0077] Different data augmentations are performed on the image test set to be processed to obtain image test sets of corresponding categories.

[0078] In the embodiments of this application, it should be noted that since there are many ways to augment data, the method of augmentation can be selected according to the actual situation, and this application does not limit it here.

[0079] In one embodiment, performing different data augmentations on the image test set to be processed to obtain image test sets of corresponding categories includes:

[0080] Different geometric transformations are applied to the image test set to be processed to obtain image test sets of corresponding categories;

[0081] Different color transformation processes are applied to the image test set to be processed to obtain image test sets of corresponding categories.

[0082] In the embodiments of this application, it should be noted that data augmentation methods generally include two types: geometric transformation and color transformation. Generally, both types of data augmentation methods are involved in order to obtain images of different categories.

[0083] In one embodiment, performing different geometric transformations on the image test set to be processed to obtain an image test set of the corresponding category includes:

[0084] The image set to be processed is flipped, rotated, cropped, deformed, and scaled to obtain image test sets of different categories.

[0085] In the embodiments of this application, it should be noted that there are many types of data augmentation methods for geometric transformations, and the data augmentation methods exemplified in the embodiments of this application are only the more commonly used data augmentation methods.

[0086] In one embodiment, performing different color transformations on the image test set to be processed to obtain an image test set of the corresponding category includes:

[0087] The image test set to be processed is blurred, its color is changed, it is erased, and it is filled to obtain the image test set of the corresponding category.

[0088] In the embodiments of this application, it should be noted that there are many types of data augmentation methods for color transformation, and the data augmentation methods exemplified in the embodiments of this application are only the more commonly used data augmentation methods.

[0089] Example 2:

[0090] Based on the same inventive concept as the model training method described above, embodiments of this application also provide a model training apparatus, such as... Figure 3 As shown, it includes:

[0091] Module 1 is used to acquire the image training set and the image test set of different categories; different categories of images correspond to different data augmentation methods;

[0092] Training module 2 is used to perform P iterations of training on the model to be trained based on the image training set and the initial data augmentation probabilities of different categories, to obtain the model after one round of iterative training; where P is a positive integer.

[0093] Test module 3 is used to input the image test sets of different categories into the model after one round of iterative training for testing, and obtain the test results of the corresponding categories;

[0094] Training and testing module 4 is used to perform M iterations of training on the model after the previous iteration based on the image training set and the initial data augmentation probabilities of different categories. After the model after the previous iteration has completed M iterations of training, training is stopped, and the image test sets of different categories are respectively input into the model after the current iteration for testing to obtain the test results of the corresponding categories; where M is a positive integer.

[0095] The comparison and update module 5 is used to compare the test results of the current round with the test results of the previous round. If the model trained in the current round has improved the performance of a certain category compared with the model trained in the previous round, the initial data augmentation probability of different categories is updated by reducing the data augmentation probability of that category; otherwise, the initial data augmentation probability of different categories is updated by increasing the data augmentation probability of that category.

[0096] Return module 5 is used to return the steps of training the model after the previous iteration M times based on the image training set and the initial data augmentation probabilities of different categories, until the number of iterations equals the total number of iterations.

[0097] This application's embodiments compare the model's performance on different categories after each round of training iterations. When the model's performance on a certain category is improved, the data augmentation probability of that category is reduced. When the model's performance on a certain category is almost unchanged or decreases, the data augmentation probability of that category is increased. This solves the problem of the impact of different categories of data augmentation on the model's generalization performance during model training, thereby improving the model's generalization performance and ultimately improving the overall model performance.

[0098] Example 3:

[0099] Reference Figure 4 This application also provides a computer device, which may be a server, and its internal structure may be as follows: Figure 3As shown, this computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data suitable for a model training method, etc. The network interface is used for communication with external terminals via a network connection. When executed by a processor, this computer program implements a model training method, including: acquiring an image training set and image test sets of different categories; wherein different categories of images correspond to different data augmentation methods; performing P iterations of training on the model to be trained based on the image training set and initial data augmentation probabilities for different categories to obtain a model after one round of iterative training; wherein P is a positive integer; inputting the image test sets of different categories into the model after one round of iterative training for testing to obtain test results for the corresponding categories; performing M iterations of training on the model after the previous round of iterative training based on the image training set and the initial data augmentation probabilities for different categories; and stopping training after the model after the previous round of iterative training has completed M iterations of training. The different categories of image test sets are input into the model trained in this iteration for testing, and the test results for the corresponding categories are obtained; where M is a positive integer; the test results of this round are compared with the test results of the previous round. If the model trained in this round has improved the performance of a certain category compared with the model trained in the previous round, the initial data augmentation probabilities of different categories are updated by reducing the data augmentation probability of that category; otherwise, the initial data augmentation probabilities of different categories are updated by increasing the data augmentation probability of that category; the process of performing M iterations of training on the model trained in the previous round based on the image training set and the initial data augmentation probabilities of different categories is returned until the number of iterations equals the total number of iterations.

[0100] This application's embodiments compare the model's performance on different categories after each round of training iterations. When the model's performance on a certain category is improved, the data augmentation probability of that category is reduced. When the model's performance on a certain category is almost unchanged or decreases, the data augmentation probability of that category is increased. This solves the problem of the impact of different categories of data augmentation on the model's generalization performance during model training, thereby improving the model's generalization performance and ultimately improving the overall model performance.

[0101] Example 4:

[0102] This application also provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements a model training method, including the following steps: acquiring an image training set and image test sets of different categories; wherein, different categories of images correspond to different data augmentation methods; performing P iterations of training on the model to be trained based on the image training set and the initial data augmentation probabilities of different categories to obtain a model after one round of iteration training; wherein, P is a positive integer; inputting the image test sets of different categories into the model after one round of iteration training for testing to obtain test results for the corresponding categories; and performing M iterations of training on the model after the previous round of iteration training based on the image training set and the initial data augmentation probabilities of different categories, until the model after the previous round of iteration training... After completing M iterations of training, training is stopped, and the image test sets of different categories are input into the model trained in this iteration for testing, obtaining the test results for the corresponding categories; where M is a positive integer; the test results of this round are compared with the test results of the previous round. If the model trained in this round has improved the performance of a certain category compared to the model trained in the previous round, the initial data augmentation probabilities of different categories are updated by reducing the data augmentation probability of that category; otherwise, the initial data augmentation probabilities of different categories are updated by increasing the data augmentation probability of that category; the process returns to the step of performing M iterations of training on the model trained in the previous round based on the image training set and the initial data augmentation probabilities of different categories, until the number of iterations equals the total number of iterations.

[0103] The above-described method applies to a model training approach. By comparing the model's performance on different categories after each round of training iterations, and reducing the data augmentation probability of a category when the model's performance on that category improves, and increasing the data augmentation probability of a category when the model's performance on that category remains almost unchanged or decreases, the method addresses the impact of different categories of data augmentation on the model's generalization performance during training, thereby improving the model's generalization performance and ultimately enhancing the overall model performance.

[0104] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media provided in this application and in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0105] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.

[0106] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A model training method, characterized in that, include: Obtain an image training set and image test sets of different categories; different data augmentation methods are used for different image categories. Based on the image training set and the initial data augmentation probabilities for different categories, the model to be trained is subjected to P iterations of training to obtain a model after one round of iterative training; where P is a positive integer; the process includes: obtaining a sample image from the image training set; inputting the sample image into the model to be trained, performing data augmentation on the sample image according to the initial data augmentation probabilities for different categories to obtain a data-augmented image; training the model to be trained based on the data-augmented image, wherein data augmentation is performed on the sample image in the initial stage of model training, and since the data-augmented image can produce an image different from the original image, the model can be trained based on different images each time it is trained; after training is completed, the step of obtaining a sample image from the image training set is returned until all images in the image training set have been traversed to obtain a model after one round of iterative training; and performing P-1 iterations of training on the model after one round of iterative training based on the image training set and the initial data augmentation probabilities for different categories to obtain the model after one round of iterative training. The different categories of image test sets are respectively input into the model after one round of iterative training for testing, and the test results of the corresponding categories are obtained; Based on the image training set and the initial data augmentation probabilities for different categories, the model trained in the previous iteration is trained for M iterations. After the model trained in the previous iteration has completed M iterations, training stops, and the image test sets for different categories are input into the model trained in this iteration for testing to obtain the test results for the corresponding categories; where M is a positive integer. The test results of this round are compared with the test results of the previous round. If the model trained in this round has improved the performance of a certain category compared with the model trained in the previous round, the initial data augmentation probabilities of different categories are updated by reducing the data augmentation probability of that category. Otherwise, the initial data augmentation probabilities of different categories are updated by increasing the data augmentation probability of that category. Returning to the steps of performing M iterations of training on the model after the previous iteration, based on the image training set and the initial data augmentation probabilities for different categories, until the number of iterations equals the total number of iterations.

2. The model training method according to claim 1, characterized in that, P is determined according to the following formula: P = N / 5; Wherein, N is the total number of iterations.

3. The model training method according to claim 1, characterized in that, The initial data augmentation probabilities for each of the different categories were all set to 0.

5.

4. The model training method according to claim 1, characterized in that, Before obtaining the image training sets for the different categories, the following steps are also included: Obtain the image test set to be processed; Different data augmentations are performed on the image test set to be processed to obtain image test sets of corresponding categories.

5. The model training method according to claim 4, characterized in that, The process of performing different data augmentations on the image test set to be processed to obtain image test sets of corresponding categories includes: Different geometric transformations are applied to the image test set to be processed to obtain image test sets of corresponding categories; Different color transformation processes are applied to the image test set to be processed to obtain image test sets of corresponding categories.

6. The model training method according to claim 5, characterized in that, The process of performing different geometric transformations on the image test set to be processed to obtain image test sets of corresponding categories includes: The image set to be processed is flipped, rotated, cropped, deformed, and scaled to obtain image test sets of different categories.

7. The model training method according to claim 5, characterized in that, The step of performing different color transformations on the image test set to be processed to obtain image test sets of corresponding categories includes: The image test set to be processed is blurred, its color is changed, it is erased, and it is filled to obtain the image test set of the corresponding category.

8. A model training apparatus for implementing the method according to any one of claims 1-7, characterized in that, include: The acquisition module is used to acquire the image training set and the image test set of different categories; different image categories correspond to different data augmentation methods; The training module is used to perform P iterations of training on the model to be trained based on the image training set and the initial data augmentation probabilities of different categories, to obtain the model after one round of iterative training; where P is a positive integer. The testing module is used to input the image test sets of different categories into the model after one round of iterative training for testing, and obtain the test results of the corresponding categories. The training and testing module is used to perform M iterations of training on the model after the previous iteration based on the image training set and the initial data augmentation probabilities of different categories. After the model after the previous iteration has completed M iterations of training, training is stopped, and the image test sets of different categories are respectively input into the model after the current iteration for testing to obtain the test results of the corresponding categories; where M is a positive integer. The comparison and update module is used to compare the test results of the current round with the test results of the previous round. If the model trained in the current round has improved the performance of a certain category compared with the model trained in the previous round, the initial data augmentation probability of different categories is updated by reducing the data augmentation probability of that category; otherwise, the initial data augmentation probability of different categories is updated by increasing the data augmentation probability of that category. The return module is used to return the steps of training the model M times based on the image training set and the initial data augmentation probabilities of different categories, until the number of iterations equals the total number of iterations.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the model training method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Model training method and device and electronic equipment

    CN110717515A