CN-122021812-A - Model training method, device, storage medium and equipment
Abstract
The application discloses a model training method, a model training device, a model training storage medium and model training equipment, and belongs to the field of artificial intelligence. According to the application, whether training is finished or not is judged by combining the evaluation loss of the verification set and the evaluation value of the target performance value index through the set threshold range of the target performance value index. Under the condition that the threshold range of the target performance value index is met, and when the target performance index is relatively lowered or the evaluation loss is relatively raised, training is terminated in advance, and training resources can be released in advance. The application can automatically train to obtain the optimal model parameters, improve the performance of the model obtained by training, effectively avoid the over-fitting phenomenon and improve the generalization capability and performance of the model. The training resource can be reasonably utilized, the model reaching the required performance can be trained more quickly, the occupation of the training resource is saved, and the idle of the training resource is avoided.
Inventors
- ZHANG ZHENGUO
- LI JIE
- LI SHENG
- ZHOU JUN
Assignees
- 北京眼神智能科技有限公司
- 北京眼神科技有限公司
- 深圳爱酷智能科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241111
Claims (9)
- 1. A method of model training, the method comprising: Determining a target performance index for representing the performance of the model, and setting a threshold range of the target performance index; training the model in each training round sequentially through a training set, and training each training round to obtain a model instance; after each training round is trained to obtain a model instance, performing performance evaluation on the model instance through a verification set to obtain an evaluation loss of the model instance and an evaluation value of the target performance index; judging whether the evaluation value of the target performance index meets the threshold range of the target performance index, if so, executing the next step, otherwise, executing the training of the next training round; judging whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases, if so, ending the training, otherwise, performing the training of the next training round.
- 2. The model training method according to claim 1, wherein the determining whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases includes: setting running continuing rounds; Training the next training round in the run-up round, and performing performance evaluation on a model instance through the verification set after training to obtain the model instance, so as to obtain evaluation loss and an evaluation value of the target performance index; and in the run-up run, judging whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases, if so, ending the training, otherwise, resetting the run-up run, and returning to the step of training in the run-up run for the next training run.
- 3. The model training method according to claim 2, wherein when the run-on run is set, the run-on run is calculated based on a current evaluation loss and historical data of the evaluation loss.
- 4. A model training method as claimed in claim 3, wherein said determining whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases within the run-up run comprises: calculating the difference between the current evaluation loss and the evaluation loss of the previous training round to obtain a first parameter; calculating the difference between the current evaluation loss and the evaluation loss of the N th training round to obtain a second parameter; Wherein N is an integer greater than 1; Dividing the first parameter and the second parameter to obtain a third parameter; And if the second parameter is negative and the third parameter is positive, and the evaluation value of the target performance index is relatively increased compared with the previous training round, recalculating the running round according to the third parameter, returning to the step of training of the next training round in the running round, and otherwise ending the training.
- 5. The model training method of claim 4, further comprising: Setting a maximum training round, and generating a reminding round according to the maximum training round number; Wherein the reminder round is no greater than the maximum training round; And judging whether the total training round reaches the reminding round when the evaluation value of the target performance index does not meet the threshold range of the target performance index, if so, stopping training, and sending the evaluation loss of each training round and the evaluation value of the target performance index to a user, otherwise, performing the training of the next training round.
- 6. The model training method of claim 5, wherein the value of N is determined based on the value of the trend of change in the previous estimated loss before the current estimated loss; and/or; The value range of the reminding round is within a range of 60% -90% of the maximum training round.
- 7. A model training apparatus, the apparatus comprising: A first setting module, configured to determine a target performance index for representing performance of the model, and set a threshold range of the target performance index; The training module is used for training the model in sequence for each training round through a training set, and each training round is trained to obtain a model instance; The evaluation module is used for performing performance evaluation on the model instance through a verification set after each training round is trained to obtain a model instance, so as to obtain an evaluation loss of the model instance and an evaluation value of the target performance index; The first judging module is used for judging whether the evaluation value of the target performance index meets the threshold range of the target performance index, if so, executing the first judging module, otherwise, executing the training of the next training round; And the second judging module is used for judging whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases, if so, ending the training, otherwise, carrying out the training of the next training round.
- 8. A computer readable storage medium for model training, comprising a memory for storing processor executable instructions which, when executed by the processor, implement steps comprising the model training method of any of claims 1-6.
- 9. An apparatus for model training comprising at least one processor and a memory storing computer executable instructions that when executed by the processor perform the steps of the model training method of any of claims 1-6.
Description
Model training method, device, storage medium and equipment Technical Field The application relates to the field of artificial intelligence, in particular to a model training method, a device, a storage medium and equipment. Background In recent years, deep learning techniques have been widely used in the fields of computer vision, natural language processing, speech, recommendation systems, and the like. The deep learning model needs Training (Training) before use, and the Training refers to a model structure or a deep neural network structure constructed by utilizing the characteristics of data, and the process of Training parameters of the model by taking the data as input. In the existing training scheme, most of the training tasks are terminated under the conditions such as a fixed training round number, a fixed iteration number, a fixed training duration or manual ending of training. On the one hand, these termination conditions are typically set empirically, resulting in the performance of the trained model being difficult to meet the expected requirements. On the other hand, these termination conditions are fixed values, and too small a value may result in the training model having no practical value, and too large a value not only wastes training resources, but also easily results in the model being over-fitted. Disclosure of Invention In order to overcome the defects of the prior art, the application provides a model training method, a device, a storage medium and equipment, which can reasonably utilize training resources, train a model reaching required performance more quickly, and improve the performance of the model obtained by training. The technical scheme provided by the application is as follows: In a first aspect, the present application provides a model training method, the method comprising: Determining a target performance index for representing the performance of the model, and setting a threshold range of the target performance index; training the model in each training round sequentially through a training set, and training each training round to obtain a model instance; after each training round is trained to obtain a model instance, performing performance evaluation on the model instance through a verification set to obtain an evaluation loss of the model instance and an evaluation value of the target performance index; judging whether the evaluation value of the target performance index meets the threshold range of the target performance index, if so, executing the next step, otherwise, executing the training of the next training round; judging whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases, if so, ending the training, otherwise, performing the training of the next training round. Further, the determining whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases includes: setting running continuing rounds; Training the next training round in the run-up round, and performing performance evaluation on a model instance through the verification set after training to obtain the model instance, so as to obtain evaluation loss and an evaluation value of the target performance index; and in the run-up run, judging whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases, if so, ending the training, otherwise, resetting the run-up run, and returning to the step of training in the run-up run for the next training run. Further, when the run-up run is set, the run-up run is calculated according to the current evaluation loss and the historical data of the evaluation loss. Further, the determining whether the evaluation value of the target performance index relatively decreases or whether the evaluation loss relatively increases in the run-up run turn includes: calculating the difference between the current evaluation loss and the evaluation loss of the previous training round to obtain a first parameter; calculating the difference between the current evaluation loss and the evaluation loss of the N th training round to obtain a second parameter; Wherein N is an integer greater than 1; Dividing the first parameter and the second parameter to obtain a third parameter; And if the second parameter is negative and the third parameter is positive, and the evaluation value of the target performance index is relatively increased compared with the previous training round, recalculating the running round according to the third parameter, returning to the step of training of the next training round in the running round, and otherwise ending the training. Further, the method further comprises: Setting a maximum training round, and generating a reminding round according to the maximum training round number; Wherein the reminder round is no greater than the maximum trai