A model training method and device

By controlling the number of iterations before backtracking and the loss metric parameters during the training process of a deep learning model, overfitting can be prevented, model parameters can be optimized, and the model's performance on the validation set can be improved.

CN114648100BActive Publication Date: 2026-03-24TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-21
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Deep learning models are prone to overfitting, resulting in poor performance on the validation set and an inability to generalize.

Method used

By loading the current model parameters and clearing the number of iterations before rollback, the loss metric parameters are obtained, and rollback control is performed when the loss metric parameters exceed the preset value to prevent model overfitting.

Benefits of technology

It effectively prevents model overfitting and optimizes model parameters to ensure that the model maintains good generalization ability during training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114648100B_ABST
    Figure CN114648100B_ABST
Patent Text Reader

Abstract

The application provides a model training method and device, and relates to the technical field of modeling. The method comprises the following steps: loading current model parameters, and clearing the iteration number before rollback; if it is determined that the model is trained once, obtaining a loss index parameter and a latest model parameter of the model, and adding 1 to the iteration number before rollback; if it is determined that the loss index parameter is greater than a preset loss index parameter of the model, comparing the iteration number before rollback with a preset iteration number before rollback; if it is determined that the iteration number before rollback is greater than or equal to the preset iteration number before rollback, continuing to execute the steps of loading the current model parameters, clearing the iteration number before rollback, and subsequent steps. The device executes the above method. The model training method and device provided in the application embodiment can prevent model overfitting, and ensure that the model parameters are continuously optimized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of modeling, in particular to a model training method and device. BACKGROUND

[0002] Deep learning is an artificial neural network algorithm based on learning representation, which belongs to machine learning in a broad sense. Deep learning models are widely used in computer vision, natural language processing, bioinformatics and other fields. Deep learning has a hierarchical structure, each layer is composed of multiple neurons, and a large number of neuron parameters provide the model with the ability to solve various tasks. Generally speaking, the more parameters, the higher the performance of the model with consistent architecture, but at the same time, it also brings the risk of overfitting.

[0003] Overfitting refers to the model's good performance on the training set and poor performance on the validation set. It is a common pitfall in deep learning - the model's learning ability is too strong, so as to remember the complete pattern of the training set data, including noise and random disturbance. Overfitting will lead to the model's inability to generalize, that is, to perform well in unseen data scenarios, thus causing the model training to fail.

[0004] In deep learning, the number of layers of neural network architecture is very large, complex and requires a lot of time to train, which is very easy to cause overfitting. SUMMARY

[0005] To solve the problems in the prior art, the embodiments of the present application provide a model training method and device, which can at least partially solve the problems in the prior art.

[0006] In one aspect, the present application provides a model training method, comprising:

[0007] loading current model parameters and clearing the number of iterations before rollback;

[0008] If it is determined that the model is trained once, the loss index parameter and the latest model parameter of the model are obtained, and the number of iterations before rollback is increased by 1;

[0009] If it is determined that the loss index parameter is greater than the preset loss index parameter of the model, the number of iterations before rollback is compared with the preset number of iterations before rollback.

[0010] If it is determined that the number of iterations before rollback is greater than or equal to the preset number of iterations before rollback, the loading of the current model parameters and the clearing of the number of iterations before rollback, and the subsequent steps are continued.

[0011] The model training method further comprises:

[0012] If it is determined that the iteration number before rollback is less than the preset iteration number before rollback, the method continues to execute the step of acquiring the loss index parameter and the latest model parameter of the model if the model is trained once, and adding 1 to the iteration number before rollback.

[0013] The model training method further comprises:

[0014] If it is determined that the loss index parameter is less than or equal to the preset loss index parameter of the model, the current model parameter is updated according to the latest model parameter obtained when the model is trained once, and the preset loss index parameter is updated according to the loss index parameter.

[0015] The method continues to execute the step of loading the current model parameter, clearing the iteration number before rollback, and the subsequent steps.

[0016] The model training method further comprises:

[0017] If it is determined that the model training does not meet the model training termination condition, the method continues to execute the step of acquiring the loss index parameter and the latest model parameter of the model if the model is trained once, and adding 1 to the iteration number before rollback, and the subsequent steps.

[0018] The model training method further comprises:

[0019] If it is determined that the iteration number before rollback is less than the preset iteration number before rollback, the method continues to execute the step of determining that the model training does not meet the model training termination condition, and the subsequent steps.

[0020] The model training termination condition comprises that the iteration number of model training reaches a preset iteration number of model training.

[0021] In one aspect, the present application provides a model training device, comprising:

[0022] A loading unit is configured to load a current model parameter and clear an iteration number before rollback.

[0023] An acquisition unit is configured to acquire a loss index parameter and a latest model parameter of the model if the model is trained once, and add 1 to the iteration number before rollback.

[0024] A comparison unit is configured to compare the iteration number before rollback with a preset iteration number before rollback if it is determined that the loss index parameter is greater than a preset loss index parameter of the model.

[0025] a rollback unit configured to, if it is determined that the iteration number before rollback is greater than or equal to the preset iteration number before rollback, continue to perform the loading of the current model parameter, clear the iteration number before rollback, and subsequent steps.

[0026] The model training apparatus is further configured to:

[0027] If it is determined that the iteration number before rollback is less than the preset iteration number before rollback, the method continues to perform the following steps: if it is determined that the model is trained once, obtaining the loss index parameter and the latest model parameter of the model, and adding 1 to the iteration number before rollback.

[0028] In another aspect, an electronic device is provided, which includes a processor, a memory, and a bus, wherein:

[0029] The processor and the memory communicate with each other through the bus.

[0030] The memory stores program instructions executable by the processor, and the processor invoking the program instructions can execute the following method:

[0031] Loading the current model parameter and clearing the iteration number before rollback.

[0032] If it is determined that the model is trained once, obtaining the loss index parameter and the latest model parameter of the model, and adding 1 to the iteration number before rollback.

[0033] If it is determined that the loss index parameter is greater than the preset loss index parameter of the model, comparing the iteration number before rollback with the preset iteration number before rollback.

[0034] If it is determined that the iteration number before rollback is greater than or equal to the preset iteration number before rollback, the method continues to perform the loading of the current model parameter, clearing the iteration number before rollback, and subsequent steps.

[0035] An embodiment of the present application provides a non-transitory computer readable storage medium, comprising:

[0036] The non-transitory computer readable storage medium stores computer instructions, and the computer instructions cause the computer to execute the following method:

[0037] Loading the current model parameter and clearing the iteration number before rollback.

[0038] If it is determined that the model is trained once, obtaining the loss index parameter and the latest model parameter of the model, and adding 1 to the iteration number before rollback.

[0039] If it is determined that the loss index parameter is greater than the preset loss index parameter of the model, the pre-backtracking iteration number is compared with a preset pre-backtracking iteration number.

[0040] If it is determined that the pre-backtracking iteration number is greater than or equal to the preset pre-backtracking iteration number, the current model parameter is loaded, the pre-backtracking iteration number is cleared, and subsequent steps are continued.

[0041] The model training method and device provided by the embodiment of the present application load the current model parameter and clear the pre-backtracking iteration number. If it is determined that the model is trained once, the loss index parameter and the latest model parameter of the model are obtained, and the pre-backtracking iteration number is incremented by 1. If it is determined that the loss index parameter is greater than the preset loss index parameter of the model, the pre-backtracking iteration number is compared with a preset pre-backtracking iteration number. If it is determined that the pre-backtracking iteration number is greater than or equal to the preset pre-backtracking iteration number, the current model parameter is loaded, the pre-backtracking iteration number is cleared, and subsequent steps are continued. This can prevent overfitting of the model and ensure that the model parameter is continuously optimized. BRIEF DESCRIPTION OF DRAWINGS

[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor. In the drawings:

[0043] Figure 1 is a flowchart of the model training method provided by an embodiment of the present application.

[0044] Figure 2 is a flowchart of the model training method provided by another embodiment of the present application.

[0045] Figure 3 is a structural diagram of the model training device provided by an embodiment of the present application.

[0046] Figure 4 is an electronic device entity structure diagram provided by an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the following will further describe the embodiments of the present application with reference to the drawings. Here, the illustrative embodiments of the present application and their descriptions are used to explain the present application, but not as a limitation of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other arbitrarily without conflict.

[0048] Figure 1 is a flowchart of a model training method provided by an embodiment of the present application, as shown in Figure 1 The model training method provided by the embodiment of the present application comprises the following steps.

[0049] Step S1: loading current model parameters and clearing the iteration count before rollback.

[0050] Step S2: if it is determined that the model is trained once, obtaining the loss index parameter and the latest model parameter of the model, and adding 1 to the iteration count before rollback.

[0051] Step S3: if it is determined that the loss index parameter is greater than the preset loss index parameter of the model, comparing the iteration count before rollback with a preset iteration count before rollback.

[0052] Step S4: if it is determined that the iteration count before rollback is greater than or equal to the preset iteration count before rollback, continuing to perform the loading of the current model parameters and the clearing of the iteration count before rollback, and subsequent steps.

[0053] In the above step S1, the device loads the current model parameters and clears the iteration count before rollback. The device can be a computer device that executes the method, for example, a server. The model can be a neural network model, as shown in Figure 2 The current model is denoted as S, and the current model parameter is the weight parameter of the model. It can be understood that the model obtained after each training is denoted as s, and the model parameter, i.e., the weight parameter of the model s, is updated once. At this time, the loss index parameter of the model s is denoted as l.

[0054] The iteration count before rollback is denoted as c, which realizes the counting function of the iteration count before rollback. The rollback control of the model training is realized by c=0. The initial value of the iteration count before rollback is zero.

[0055] As shown in Figure 2 Before the step of loading the current model parameters and clearing the iteration count before rollback, the related parameters can be initialized and set.

[0056] L represents the preset loss index parameter of the current model. Since the model is trained, the data can be divided into a training set and a validation set. Further, L represents the preset loss index parameter of the model S in the validation set, i.e., the loss value of the loss function. The loss value of the loss function can be calculated according to a predefined function, and the predefined function is not limited in the embodiment of the present application.

[0057] The initial value of the preset loss index parameter can be set autonomously according to the actual situation, and a large value can be selected, for example, 1013 .

[0058] The loss index parameter l of model s can be found in the description of the preset loss index parameter L, and will not be repeated here.

[0059] E represents the preset number of model training iterations. When the number of model training iterations reaches E, the model training will terminate, indicating that the model training is complete. The preset number of model training iterations can be set according to the actual situation.

[0060] C represents the preset number of iterations before rollback, which can be set according to the actual situation, and can be selected from 4 to 10 times.

[0061] Where e represents the number of model training iterations. The number of model training iterations is incremented by 1 each time the model is trained.

[0062] The above initialization settings are the parameters for the first model validation. Typically, the first few training batches will optimize the model performance. Here, a batch refers to a parameter update of the model parameters using a small portion of the training set for backpropagation. This small portion of the samples is called a "batch of data".

[0063] Figure 2 The dashed arrows in the diagram represent model training processes that do not require backoff control. Figure 2 The solid arrows in the text indicate model training processes that require backtracking control.

[0064] In step S2 above, if the device determines that the model is trained once, it obtains the loss index parameters and the latest model parameters of the model, and increments the iteration count before backtracking by 1. Each training iteration of the model means that the model has undergone one epoch of training. An epoch refers to a complete training of the model using all the data in the training set, which is called "generation training".

[0065] The loss metric parameters of a model can be obtained by calculating the loss value of the loss function.

[0066] By obtaining the latest model parameters, the weight parameters of the model were optimized.

[0067] In step S3 above, if the device determines that the loss index parameter is greater than the preset loss index parameter of the model, it compares the number of iterations before backtracking with the preset number of iterations before backtracking. The explanation is as follows:

[0068] If the model was not optimized during training, then the number of iterations before backtracking is counted once, i.e., the value of c is increased by 1. This means that the model used one free iteration variation opportunity.

[0069] In step S4, if the device determines that the iteration number before rollback is greater than or equal to the preset iteration number before rollback, the current model parameter is loaded, the iteration number before rollback is cleared, and subsequent steps are continued. The description is as follows:

[0070] The iteration number before rollback of the model free training and continuous deterioration has exceeded the preset iteration number before rollback, and the model needs to be rolled back, that is, s=S, l=L, and c=0.

[0071] The model is continuously iterated for C times, and it can be considered that the training effect will not be good if it continues, so the bridle is retrieved, and the model starts training from the last saved point.

[0072] After the model training is completed, the model can be applied to the scene of image target recognition, for example:

[0073] An image to be recognized is obtained, and image target recognition is performed on the image to be recognized based on a preset image target recognition model to obtain a recognition result of whether the image to be recognized contains an image target. The preset image target recognition model is a trained model obtained according to the above model training method. The image target can specifically include a person and a vehicle, and the like, and is not limited in particular.

[0074] The model training method provided in the embodiment of the application loads the current model parameter, clears the iteration number before rollback, determines that the model is trained once, obtains the loss index parameter and the latest model parameter of the model, and adds 1 to the iteration number before rollback. If it is determined that the loss index parameter is greater than the preset loss index parameter of the model, the iteration number before rollback is compared with the preset iteration number before rollback. If it is determined that the iteration number before rollback is greater than or equal to the preset iteration number before rollback, the current model parameter is loaded, the iteration number before rollback is cleared, and subsequent steps are continued. This can prevent overfitting of the model and ensure that the model parameter is continuously optimized.

[0075] Further, the model training method further includes:

[0076] If it is determined that the iteration number before rollback is less than the preset iteration number before rollback, the step of determining that the model is trained once, obtaining the loss index parameter and the latest model parameter of the model, and adding 1 to the iteration number before rollback is continued, and subsequent steps are continued. The description is as follows:

[0077] The model does not need to be intervened temporarily, and can continue to be trained. The preset iteration number before rollback C is set to prevent the information of the verification set from being introduced into the training process too much, so that the model has the opportunity to iterate freely.

[0078] Further, the model training method further includes:

[0079] If it is determined that the loss index parameter is less than or equal to the preset loss index parameter of the model, the current model parameter is updated according to the latest model parameter obtained by training the model once, and the preset loss index parameter is updated according to the loss index parameter;

[0080] The current model parameter is loaded, the iteration number before rollback is cleared, and subsequent steps are continued. The description is as follows:

[0081] The model is optimized in training, the model parameter is updated, S=s, L=l, the model parameter update is confirmed, and the preset loss index parameter is also updated to the loss index parameter of the model s on the validation set, so as to limit the model to optimize in a better direction.

[0082] Further, a model training termination condition is obtained. Correspondingly, after the step of loading the current model parameter and clearing the iteration number before rollback, and before the step of obtaining the loss index parameter of the model if the model is trained once, the model training method further comprises:

[0083] If it is determined that the model training does not meet the model training termination condition, the step of obtaining the loss index parameter and the latest model parameter of the model if the model is trained once, and the iteration number before rollback is added by 1, and subsequent steps are continued. The model training termination condition can include that the model training iteration number e reaches the preset model training iteration number E, which is not limited. As shown in the following table, if it is determined that the model training meets the model training termination condition, the method ends, indicating that the model training is completed. Figure 2

[0084] Further, the model training method further comprises:

[0085] If it is determined that the iteration number before rollback is less than the preset iteration number before rollback, the step of determining that the model training does not meet the model training termination condition and subsequent steps are continued. As shown in the following table, this step corresponds to the determination step of e≥E? Figure 2

[0086] Further, the model training termination condition includes that the model training iteration number reaches the preset model training iteration number. For details, refer to the above description.

[0087] Figure 3 is a structural schematic diagram of a model training device provided by an embodiment of the present application, as shown in the following table, the model training device provided by the embodiment of the present application comprises a loading unit 301, an obtaining unit 302, a comparison unit 303 and a rollback unit 304, wherein: Figure 3

[0088] ​​​The loading unit 301 is configured to load current model parameters and clear the iteration number before rollback; the obtaining unit 302 is configured to obtain a loss index parameter and a latest model parameter of the model if it is determined that the model is trained once, and add 1 to the iteration number before rollback; the comparing unit 303 is configured to compare the iteration number before rollback with a preset iteration number before rollback if it is determined that the loss index parameter is greater than a preset loss index parameter of the model; and the rollback unit 304 is configured to continue to execute the loading of the current model parameters and the clearing of the iteration number before rollback, and subsequent steps if it is determined that the iteration number before rollback is greater than or equal to the preset iteration number before rollback.

[0089] Specifically, the loading unit 301 in the device is configured to load current model parameters and clear the iteration number before rollback; the obtaining unit 302 is configured to obtain a loss index parameter and a latest model parameter of the model if it is determined that the model is trained once, and add 1 to the iteration number before rollback; the comparing unit 303 is configured to compare the iteration number before rollback with a preset iteration number before rollback if it is determined that the loss index parameter is greater than a preset loss index parameter of the model; and the rollback unit 304 is configured to continue to execute the loading of the current model parameters and the clearing of the iteration number before rollback, and subsequent steps if it is determined that the iteration number before rollback is greater than or equal to the preset iteration number before rollback.

[0090] The model training device provided in the embodiment of the application loads current model parameters and clears the iteration number before rollback; obtains a loss index parameter and a latest model parameter of the model if it is determined that the model is trained once, and adds 1 to the iteration number before rollback; compares the iteration number before rollback with a preset iteration number before rollback if it is determined that the loss index parameter is greater than a preset loss index parameter of the model; and continues to execute the loading of the current model parameters and the clearing of the iteration number before rollback, and subsequent steps if it is determined that the iteration number before rollback is greater than or equal to the preset iteration number before rollback, thereby preventing model overfitting and ensuring that model parameters are continuously optimized.

[0091] Further, the model training device is further configured to:

[0092] If it is determined that the iteration number before rollback is less than the preset iteration number before rollback, the method continues to execute the step of obtaining the loss index parameter and the latest model parameter of the model if it is determined that the model is trained once, and adding 1 to the iteration number before rollback, and subsequent steps.

[0093] The embodiments of the model training device provided in the embodiments of the application can be specifically used for executing the processing procedures of the above-mentioned method embodiments, and details are not described herein again. For details, refer to the detailed description of the above-mentioned method embodiments.

[0094] Figure 4 An electronic device entity structure schematic diagram provided by an embodiment of the present application is shown in FIG. 1. Figure 4 As shown, the electronic device includes a processor 401, a memory 402 and a bus 403.

[0095] The processor 401, the memory 402 and the bus 403 complete communication with each other.

[0096] The processor 401 is configured to invoke program instructions in the memory 402 to execute the method provided by each method embodiment described above, for example including:

[0097] loading current model parameters and clearing the iteration count before rollback;

[0098] If it is determined that the model is trained once, obtaining a loss index parameter and a latest model parameter of the model, and adding 1 to the iteration count before rollback;

[0099] If it is determined that the loss index parameter is greater than a preset loss index parameter of the model, comparing the iteration count before rollback with a preset iteration count before rollback;

[0100] If it is determined that the iteration count before rollback is greater than or equal to the preset iteration count before rollback, continuing to execute the loading current model parameters and the clearing the iteration count before rollback, and subsequent steps.

[0101] The embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the method provided by each method embodiment described above, for example including:

[0102] loading current model parameters and clearing the iteration count before rollback;

[0103] If it is determined that the model is trained once, obtaining a loss index parameter and a latest model parameter of the model, and adding 1 to the iteration count before rollback;

[0104] If it is determined that the loss index parameter is greater than a preset loss index parameter of the model, comparing the iteration count before rollback with a preset iteration count before rollback;

[0105] If it is determined that the iteration count before rollback is greater than or equal to the preset iteration count before rollback, continuing to execute the loading current model parameters and the clearing the iteration count before rollback, and subsequent steps.

[0106] The embodiment provides a computer readable storage medium, which stores a computer program, and the computer program causes the computer to execute the method provided in each method embodiment.

[0107] Load current model parameters, and clear the iteration number before rollback;

[0108] If it is determined that the model is trained once, obtain the loss index parameter and the latest model parameter of the model, and add 1 to the iteration number before rollback;

[0109] If it is determined that the loss index parameter is greater than the preset loss index parameter of the model, compare the iteration number before rollback with a preset iteration number before rollback.

[0110] If it is determined that the iteration number before rollback is greater than or equal to the preset iteration number before rollback, continue to execute the steps of loading current model parameters, clearing the iteration number before rollback, and subsequent steps.

[0111] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt a computer program product in the form of being implemented on one or more computer usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) containing computer usable program codes.

[0112] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system), and computer program product according to the embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one or more flows and / or blocks. Figure 1 The device that implements the functions specified in one or more flows and / or blocks.

[0113] These computer program instructions can also be stored in a computer readable memory that can guide the computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer readable memory produce a product including instruction devices, which implement the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in one or more flows and / or blocks. Figure 1the function specified in one or more blocks.

[0114] These computer program instructions can also be loaded into computer or other programmable data processing devices, so that a series of operational steps are performed on the computer or other programmable data processing devices, to generate computer-implemented processes, thus the instructions executed on the computer or other programmable data processing devices provide processes for implementing the flow Figure 1 one or more flows and / or blocks Figure 1 the function specified in one or more blocks.

[0115] In the description of the present specification, the description of the terms "one embodiment", "one specific embodiment", "some embodiments", "for example", "exemplary", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0116] The above-described specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above-described specific embodiments are only specific embodiments of the present application and are not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A model training method, characterized in that, include: Load the current model parameters and clear the number of iterations before rollback; If it is determined that the model is trained once, the loss metric parameters and the latest model parameters of the model are obtained, and the number of iterations before the rollback is incremented by 1; If it is determined that the loss index parameter is greater than the preset loss index parameter of the model, then the number of iterations before backtracking is compared with the preset number of iterations before backtracking. If it is determined that the number of iterations before rollback is greater than or equal to the preset number of iterations before rollback, then continue to load the current model parameters, clear the number of iterations before rollback to zero, and proceed with subsequent steps. Before loading the current model parameters and resetting the number of iterations before backtracking, the relevant parameters are initialized, including: The model parameters are updated by backpropagation using a batch of data from the training set. After the model is trained, it will be applied to image object recognition scenarios, including: Obtain the image to be identified; perform image target recognition on the image to be identified based on the preset image target recognition model to obtain the recognition result of whether the image to be identified contains an image target; wherein, the preset image target recognition model is a trained model obtained according to the model training method.

2. The model training method according to claim 1, characterized in that, The model training method also includes: If it is determined that the number of iterations before rollback is less than the preset number of iterations before rollback, then continue to execute the following steps: if it is determined that the model is trained once, then obtain the model's loss index parameters and the latest model parameters, increment the number of iterations before rollback by 1, and then proceed with the subsequent steps.

3. The model training method according to claim 2, characterized in that, The model training method also includes: If it is determined that the loss index parameter is less than or equal to the preset loss index parameter of the model, then the current model parameter is updated according to the latest model parameter obtained after each training of the model, and the preset loss index parameter is updated according to the loss index parameter. Continue with the steps of loading the current model parameters, clearing the previous iteration count, and proceeding with subsequent steps.

4. The model training method according to claim 2 or 3, characterized in that, Obtain the model training termination condition; correspondingly, after the steps of loading the current model parameters and clearing the number of iterations before backtracking, and before the step of obtaining the model's loss metric parameters if it is determined that the model is trained once, the model training method further includes: If it is determined that the model training does not meet the model training termination condition, then continue to execute the following steps: if it is determined that the model is trained once, then obtain the model's loss index parameters and the latest model parameters, increment the previous iteration count by 1, and proceed with subsequent steps.

5. The model training method according to claim 4, characterized in that, The model training method also includes: If it is determined that the number of iterations before rollback is less than the preset number of iterations before rollback, then continue with the steps if it is determined that model training does not meet the model training termination condition, and subsequent steps.

6. The model training method according to claim 4, characterized in that, The model training termination condition includes reaching a preset number of model training iterations.

7. A model training device, characterized in that, include: The loading unit is used to load the current model parameters and clear the number of iterations before rollback; The acquisition unit is used to acquire the loss index parameters and the latest model parameters of the model each time the model is trained, and to increment the number of iterations before the backoff by 1. The comparison unit is used to compare the number of iterations before backtracking with the preset number of iterations before backtracking if it is determined that the loss index parameter is greater than the preset loss index parameter of the model. The rollback unit is used to continue loading the current model parameters and clear the number of iterations before rollback to zero, and to perform subsequent steps if it is determined that the number of iterations before rollback is greater than or equal to the preset number of iterations before rollback. Before loading the current model parameters and resetting the number of iterations before backtracking, the relevant parameters are initialized, including: The model parameters are updated by backpropagation using a batch of data from the training set. After the model is trained, it will be applied to image object recognition scenarios, including: Acquire an image to be identified; perform image target recognition on the image to be identified based on a preset image target recognition model to obtain a recognition result of whether the image to be identified contains an image target; wherein, the preset image target recognition model is a model that has been trained based on the model training device.

8. The model training apparatus according to claim 7, characterized in that, The model training device is also used for: If it is determined that the number of iterations before rollback is less than the preset number of iterations before rollback, then continue to execute the following steps: if it is determined that the model is trained once, then obtain the model's loss index parameters and the latest model parameters, increment the number of iterations before rollback by 1, and then proceed with the subsequent steps.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

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

Citation Information

Patent Citations

  • Method for dynamically adjusting training sample in deep learning classification algorithm and terminal equipment

    CN111382757A

  • Method and system for training an artificial neural network

    US6269351B1