Target detection model training method, terminal equipment and storage medium

By combining multi-stage training methods and loss functions, the problems of poor speed and performance in the training process of object detection models are solved, and more efficient and accurate object detection results are achieved.

CN119004178APending Publication Date: 2024-11-22HEBEI UNIV OF SCI & TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411079166.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

Existing object detection models use a fixed loss function during training, which makes it difficult to adapt to the optimization needs at different stages, affecting the training speed and training effect of the model.

Method used

A multi-stage training method is adopted, using different loss functions to optimize the object detection model at different stages, including the GIoU loss function in the initial stage, the combination of GIoU and CIoU loss functions in the middle stage, and the CIoU loss function in the final stage. The learning rate is dynamically adjusted to improve the stability and convergence speed of the model.

Benefits of technology

By dynamically adjusting the multi-stage loss function and learning rate, the stability and efficiency of model training are improved, thereby enhancing the detection accuracy and speed of the object detection model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119004178A_ABST
    Figure CN119004178A_ABST
Patent Text Reader

Abstract

The invention provides a target detection model training method, terminal equipment and a storage medium. The training method comprises the following steps: training an initial target detection model for a first preset number of times according to a first loss function to obtain a first intermediate target detection model; training the first intermediate target detection model for a second preset number of times according to a second loss function to obtain a second intermediate target detection model; training the second intermediate target detection model according to a third loss function until the third loss function converges; wherein the first loss function is different from the second loss function and the third loss function. According to the method, the model training is divided into different stages based on the characteristics of different stages of the model training, and different loss functions are adopted for training in each stage so as to adapt to the optimization requirements of different stages, so that the stability, the convergence speed and the final performance of the model training are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of neural network models, and in particular to a training method, terminal equipment and storage medium for a target detection model. Background Art

[0002] Object detection technology plays an important role in many practical application scenarios such as autonomous driving, security monitoring, medical image analysis, smart retail, and robot vision. Currently, mainstream object detection methods are mainly based on neural network models (e.g., CNN) for object detection.

[0003] In the prior art, the target detection model uses a fixed loss function during the training process, which is difficult to adapt to the optimization requirements of different stages and seriously affects the training speed and training effect of the model. Summary of the invention

[0004] The embodiments of the present invention provide a training method, a terminal device and a storage medium for a target detection model to solve the problem in the prior art that a fixed loss function affects the training speed and training effect of the model.

[0005] In a first aspect, an embodiment of the present invention provides a method for training a target detection model, comprising:

[0006] Training the initial object detection model a first preset number of times according to the first loss function to obtain a first intermediate object detection model;

[0007] Training the first intermediate object detection model a second preset number of times according to the second loss function to obtain a second intermediate object detection model;

[0008] Training the second intermediate target detection model according to the third loss function until the third loss function converges;

[0009] Among them, the first loss function is different from the second loss function and the third loss function.

[0010] Optionally, the first loss function is the sum of a first regression loss function, a first classification loss function, and a first confidence loss function;

[0011] The second loss function is the sum of the second regression loss function, the first classification loss function, and the first confidence loss function;

[0012] The third loss function is the sum of the third regression loss function, the first classification loss function, and the first confidence loss function;

[0013] Among them, the first regression loss function, the second regression loss function and the third regression loss function are all different.

[0014] Optionally, the calculation formula of the first regression loss function L1 is:

[0015] L1=GIoU(p,g)

[0016] The calculation formula of the second regression loss function L2 is:

[0017] L2=k1×GIoU(p,g)+k2×CIoU(p,g)

[0018] The calculation formula of the third regression loss function L3 is:

[0019] L3=CIoU(p,g)

[0020] Among them, p and g are the predicted value and the true value respectively, and k1 and k2 are coefficients.

[0021] Optionally, the values ​​of k1 and k2 are both 0.5.

[0022] Optionally, when training the initial object detection model, the learning rate is set to a preset value;

[0023] When training the first intermediate target detection model, the learning rate is calculated as:

[0024]

[0025] When training the second intermediate target detection model, the learning rate is calculated as:

[0026] α t =α0×e -λt

[0027]

[0028] Among them, α t is the learning rate of the tth iteration, λ is the decay rate, α max and α min are the maximum and minimum values ​​of the learning rate respectively; α0 is a preset value, E is the total number of iterations, and T is the sum of the first preset number and the second preset number.

[0029] Optionally, the values ​​of the first preset number and the second preset number are equal.

[0030] Optional, α max The value of is 0.1, α min The value of is 0.01, the value of T is 50, and the value of α0 is 0.1.

[0031] Optionally, the first classification loss function L classification The calculation formula is:

[0032]

[0033] The first confidence loss function L confidence The calculation formula is:

[0034]

[0035] Where N is the number of samples, y i is the true confidence of the i-th sample, is the prediction confidence of the i-th sample; C is the number of categories; y i,c is the true category of the i-th sample, is the predicted category probability of the i-th sample.

[0036] In a second aspect, an embodiment of the present invention provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the processor implements the steps of the target detection model training method provided in the first aspect or any possible implementation method of the first aspect.

[0037] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of the target detection model training method provided in the first aspect or any possible implementation method of the first aspect.

[0038] The embodiments of the present invention provide a training method, terminal device and storage medium for a target detection model. The training method of the target detection model includes: training the initial target detection model a first preset number of times according to the first loss function to obtain a first intermediate target detection model; training the first intermediate target detection model a second preset number of times according to the second loss function to obtain a second intermediate target detection model; training the second intermediate target detection model according to the third loss function until the third loss function converges; wherein the first loss function is different from the second loss function and the third loss function. The embodiments of the present invention divide the model training into different stages based on the characteristics of different stages of model training. In order to meet the optimization requirements of different stages, different loss functions are used for optimization in each model training stage, which effectively improves the stability and convergence speed of the model training, and also improves the efficiency and accuracy of the trained target detection model. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0040] Figure 1 It is a flow chart of an implementation method of a target detection model training method provided by an embodiment of the present invention;

[0041] Figure 2 is a schematic diagram of the structure of a training device for a target detection model provided by an embodiment of the present invention;

[0042] Figure 3 It is a schematic diagram of a terminal device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0044] In order to make the purpose, technical solutions and advantages of the present invention more clear, specific embodiments will be described below in conjunction with the accompanying drawings.

[0045] Object detection technology plays an important role in many practical application scenarios such as autonomous driving, security monitoring, medical image analysis, smart retail, and robot vision. At present, object detection methods are mainly based on neural network models (for example, convolutional neural network models), which can be divided into single-stage detectors and two-stage detectors. Single-stage detectors such as the YOLO series (YOLOv3, YOLOv4, YOLOv5) and SSD are widely used in real-time applications due to their high speed and high accuracy; two-stage detectors such as the R-CNN series (including R-CNN, Fast R-CNN, Faster R-CNN, Mask R-CNN) generate candidate regions through the region proposal network (RPN) and then perform fine detection. They usually have high detection accuracy, but high computational complexity.

[0046] Whether it is a single-stage detector or a multi-stage detector, during the model training process, if IoU is used as the loss function, the gradient fluctuations in the early stage of training are large, which can easily lead to unstable model training, especially when the overlap between the predicted box and the true box is low, the gradient information is insufficient, affecting the optimization effect. At the same time, when the overlap between the predicted box and the true box is extremely low or even non-existent, the gradient information of many IoU variants (such as CIoU) is insufficient, resulting in the model being unable to effectively learn the correct target box position. A single loss function is difficult to meet the optimization requirements of different training stages, resulting in slow convergence speed in some stages and poor optimization effects in some stages, which affects the overall training speed of the model and the accuracy of the model that is finally trained.

[0047] Based on this, see Figure 1 , which shows a flowchart of the implementation of the training method of the target detection model provided by an embodiment of the present invention, which is described in detail as follows:

[0048] The training method of the above target detection model includes:

[0049] S101: training the initial object detection model a first preset number of times according to a first loss function to obtain a first intermediate object detection model;

[0050] S102: training the first intermediate object detection model a second preset number of times according to the second loss function to obtain a second intermediate object detection model;

[0051] S103: training the second intermediate target detection model according to the third loss function until the third loss function converges;

[0052] Among them, the first loss function is different from the second loss function and the third loss function.

[0053] The optimization requirements of the target detection model are different at different stages. For example, in the initial stage, we mainly focus on improving the stability and convergence speed of the model; in the mid-term stage, while paying attention to stability and convergence speed, further fine optimization is required; in the final stage, the model is mainly finely optimized. In view of the optimization requirements at different stages of the training process, the embodiment of the present invention divides the training process into three different stages, adopts different loss functions for optimization training, and the loss function of each training stage is adapted to the optimization requirements of the corresponding training stage, and optimizes the stability, convergence speed and final performance of the model at different stages.

[0054] Through the strategy of multi-stage different loss functions, this application improves the stability of training and avoids insufficient optimization when the overlap is extremely low. It can improve the stability and convergence speed of model training at different stages, and also improves the detection accuracy of the trained target detection model.

[0055] In a possible implementation, the first loss function may be the sum of a first regression loss function, a first classification loss function, and a first confidence loss function;

[0056] The second loss function may be the sum of the second regression loss function, the first classification loss function, and the first confidence loss function;

[0057] The third loss function may be the sum of the third regression loss function, the first classification loss function, and the first confidence loss function;

[0058] Among them, the first regression loss function, the second regression loss function and the third regression loss function are all different.

[0059] The loss function uses a penalty mechanism to make the model learn in a certain direction. Therefore, how to choose an appropriate loss function is a key step in problem abstract modeling and must be consistent with the purpose that the model is expected to achieve. The classification loss function is used to measure the difference between the prediction results of the model in the classification task and the true label; the regression loss function is used to measure the difference between the prediction results of the model in the regression task and the true value; the confidence loss function is used to measure the gap between the confidence of the model's prediction target and the actual target confidence. By minimizing the confidence loss function, the accuracy of model detection can be improved;

[0060] The embodiment of the present invention takes the sum of the regression loss function, the classification loss function and the confidence loss function as the final loss function to optimize the model, comprehensively considers the classification problem, the regression problem and the confidence problem, and can effectively improve the accuracy and training speed of the model training.

[0061] In a possible implementation, the calculation formula of the first regression loss function L1 may be:

[0062] L1=GIoU(p,g)

[0063] The calculation formula of the second regression loss function L2 can be:

[0064] L2=k1×GIoU(p,g)+k2×CIoU(p,g)

[0065] The calculation formula of the third regression loss function L3 can be:

[0066] L3=CIoU(p,g)

[0067] Among them, p and g are the predicted value and the true value respectively, and k1 and k2 are coefficients.

[0068] In the initial stage of training, the main goal is to improve the stability and convergence speed of the model. Therefore, a relatively simple and smooth GIoU can be selected as the regression loss function for training, which can better handle the overlapping problem of bounding boxes in the initial stage and help the model quickly learn basic target positioning capabilities. At the same time, GIoU can provide a stable gradient, which helps the model converge quickly and stably, avoiding instability caused by gradient fluctuations in the early stage.

[0069] In the final stage of training, the main goal is to further refine the model, so CIoU can be used as the regression loss function. CIoU has obvious advantages in processing the overlap, size ratio and center point distance of the target box, which can significantly improve the detection accuracy of the model. CIoU is used to fine-tune the model in the final stage of training to further improve the detection precision and accuracy.

[0070] In the mid-stage of training, GIoU and CIoU can be combined to avoid the instability of training caused by using CIoU directly, making the transition of the training process smooth and stable. At the same time, the advantages of GIoU and CIoU are combined, which not only maintains the stability of the training process, but also improves the positioning and shape matching capabilities of the model.

[0071] In the embodiment of the present invention, a more effective optimization path is provided in the entire training process through a flexible combination of loss functions, so that the trained model has a more efficient and accurate target detection effect.

[0072] In a possible implementation, the values ​​of k1 and k2 may both be 0.5.

[0073] That is, L2 = 0.5 × GIoU (p, g) + 0.5 × CIoU (p, g). During the intermediate stage of training, the two loss functions are combined in a 1:1 ratio.

[0074] Specifically, the values ​​of k1 and k2 may be set according to actual application requirements, which are not specifically limited here.

[0075] In one possible implementation, when training the initial object detection model, the learning rate may be set to a preset value;

[0076] When training the first intermediate target detection model, the learning rate can be calculated as:

[0077]

[0078] When training the second intermediate target detection model, the learning rate can be calculated as:

[0079] α t =α0×e -λt

[0080]

[0081] Among them, α t is the learning rate of the tth iteration, λ is the decay rate, α max and α min are the maximum and minimum values ​​of the learning rate respectively; α0 is a preset value, E is the total number of iterations, and T is the sum of the first preset number and the second preset number.

[0082] In the initial stage of training, the regression loss function uses GIoU, and a fixed learning rate is used to ensure that the model starts training smoothly and improve the stability of the model; in the middle of training, the cosine annealing strategy can be used to dynamically adjust the learning rate, so that the learning rate gradually decreases, thereby improving the training effect of the model; in the final stage, the exponential decay strategy is used to adjust the learning rate and fine-tune the model.

[0083] The embodiment of the present invention enables the model to update parameters more effectively through a strategy combining dynamic adjustment of the learning rate and gradient clipping, thereby improving training efficiency and training effect.

[0084] In a possible implementation manner, the values ​​of the first preset number and the second preset number may be equal.

[0085] In the embodiment of the present invention, the first preset number and the second preset number may be equal.

[0086] Exemplarily, both may be 25. Specifically, the values ​​of the first preset number and the second preset number may be set according to actual application requirements, and the details will not be repeated here.

[0087] In one possible implementation, α max The value of can be 0.1, α min The value of can be 0.01, the value of T can be 50, and the value of α0 can be 0.1.

[0088] The above is only an embodiment of each parameter, and each value can be set according to actual application requirements.

[0089] In one possible implementation, the first classification loss function L classification The calculation formula can be:

[0090]

[0091] The first confidence loss function L confidence The calculation formula can be:

[0092]

[0093] Where N is the number of samples, yi is the true confidence of the i-th sample, is the prediction confidence of the i-th sample; C is the number of categories; y i,c is the true category of the i-th sample, is the predicted category probability of the i-th sample.

[0094] The classification loss function is used to measure the difference between the predicted category probability of each grid and the true category. The classification loss function in the embodiment of the present invention may be a cross entropy loss function;

[0095] The confidence loss function measures the difference between the confidence of whether there is a daily target in the prediction box and the actual situation. The confidence loss function in the embodiment of the present invention can use binary cross entropy loss.

[0096] It should be clear to those skilled in the art that model training includes but is not limited to the above steps. A training process is specifically as follows:

[0097] 1. For the large amount of predicted box information output by the detection model, calculate which grid the center point of the real box falls in, and then find the other three grids closest to the center point. These four grids that just form a square are considered to be the predicted real box;

[0098] 2. Calculate the regression loss, classification loss and confidence loss of the predicted box and the true box, and add them together to get the final loss;

[0099] 3. Use the optimizer to back propagate and optimize the model to complete a training.

[0100] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0101] The following is an embodiment of the device of the present invention. For details not described in detail therein, reference may be made to the corresponding method embodiment described above.

[0102] Figure 2 The structural diagram of the training device of the target detection model provided by the embodiment of the present invention is shown. For the convenience of explanation, only the part related to the embodiment of the present invention is shown, which is described in detail as follows:

[0103] like Figure 2 As shown, the training device of the target detection model includes:

[0104] A first training module 21 is used to train the initial object detection model for a first preset number of times according to a first loss function to obtain a first intermediate object detection model;

[0105] A second training module 22, configured to train the first intermediate object detection model a second preset number of times according to a second loss function to obtain a second intermediate object detection model;

[0106] A third training module 23, used to train the second intermediate target detection model according to the third loss function until the third loss function converges;

[0107] Among them, the first loss function is different from the second loss function and the third loss function.

[0108] In a possible implementation, the first loss function may be the sum of a first regression loss function, a first classification loss function, and a first confidence loss function;

[0109] The second loss function may be the sum of the second regression loss function, the first classification loss function, and the first confidence loss function;

[0110] The third loss function may be the sum of the third regression loss function, the first classification loss function, and the first confidence loss function;

[0111] Among them, the first regression loss function, the second regression loss function and the third regression loss function are all different.

[0112] In a possible implementation, the calculation formula of the first regression loss function L1 may be:

[0113] L1=GIoU(p,g)

[0114] The calculation formula of the second regression loss function L2 can be:

[0115] L2=k1×GIoU(p,g)+k2×CIoU(p,g)

[0116] The calculation formula of the third regression loss function L3 can be:

[0117] L3=CIoU(p,g)

[0118] Among them, p and g are the predicted value and the true value respectively, and k1 and k2 are coefficients.

[0119] In a possible implementation, the values ​​of k1 and k2 may both be 0.5.

[0120] In one possible implementation, when training the initial object detection model, the learning rate may be set to a preset value;

[0121] When training the first intermediate target detection model, the learning rate can be calculated as:

[0122]

[0123] When training the second intermediate target detection model, the learning rate can be calculated as:

[0124] α t =α0×e -λt

[0125]

[0126] Among them, α t is the learning rate of the tth iteration, λ is the decay rate, α max and α min are the maximum and minimum values ​​of the learning rate respectively; α0 is a preset value, E is the total number of iterations, and T is the sum of the first preset number and the second preset number.

[0127] In a possible implementation manner, the values ​​of the first preset number and the second preset number may be equal.

[0128] In one possible implementation, α max The value of can be 0.1, α min The value of can be 0.01, the value of T can be 50, and the value of α0 can be 0.1.

[0129] In one possible implementation, the first classification loss function L classification The calculation formula can be:

[0130]

[0131] The first confidence loss function L confidence The calculation formula can be:

[0132]

[0133] Where N is the number of samples, y i is the true confidence of the i-th sample, is the prediction confidence of the i-th sample; C is the number of categories; y i,c is the true category of the i-th sample, is the predicted category probability of the i-th sample.

[0134] Figure 3 Schematic diagram of a terminal device 3 provided in an embodiment of the present invention. Figure 3 As shown, the terminal device 3 of this embodiment includes: a processor 30 and a memory 31. The memory 31 is used to store a computer program 32, and the processor 30 is used to call and run the computer program 32 stored in the memory 31 to perform the steps in the above-mentioned training method embodiments of each target detection model, such as Figure 1Alternatively, the processor 30 is used to call and run the computer program 32 stored in the memory 31 to implement the functions of each module / unit in the above-mentioned device embodiments, such as Figure 2 The functions of modules 21 to 23 are shown.

[0135] Exemplarily, the computer program 32 may be divided into one or more modules / units, one or more modules / units are stored in the memory 31, and are executed by the processor 30 to implement the present invention. One or more modules / units may be a series of computer program instruction segments that can implement specific functions, and the instruction segments are used to describe the execution process of the computer program 32 in the terminal device 3. For example, the computer program 32 may be divided into Figure 2 Modules / units 21 to 23 are shown.

[0136] The terminal device 3 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device 3 may include, but is not limited to, a processor 30 and a memory 31. Those skilled in the art will appreciate that Figure 3 It is only an example of terminal device 3 and does not constitute a limitation on terminal device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal may also include input and output devices, network access devices, buses, etc.

[0137] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0138] The memory 31 may be an internal storage unit of the terminal device 3, such as a hard disk or memory of the terminal device 3. The memory 31 may also be an external storage device of the terminal device 3, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 3. Further, the memory 31 may also include both an internal storage unit and an external storage device of the terminal device 3. The memory 31 is used to store computer programs and other programs and data required by the terminal. The memory 31 may also be used to temporarily store data that has been output or is to be output.

[0139] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0140] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0141] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0142] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

[0144] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0145] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc.

[0146] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for training a target detection model, characterized in that: include: Training the initial object detection model a first preset number of times according to the first loss function to obtain a first intermediate object detection model; Training the first intermediate object detection model a second preset number of times according to a second loss function to obtain a second intermediate object detection model; Training the second intermediate target detection model according to a third loss function until the third loss function converges; The first loss function is different from the second loss function and the third loss function.

2. The method for training a target detection model according to claim 1, characterized in that: The first loss function is the sum of a first regression loss function, a first classification loss function, and a first confidence loss function; The second loss function is the sum of a second regression loss function, the first classification loss function, and the first confidence loss function; The third loss function is the sum of a third regression loss function, the first classification loss function, and the first confidence loss function; Among them, the first regression loss function, the second regression loss function and the third regression loss function are all different.

3. The target detection model training method according to claim 2, characterized in that: The calculation formula of the first regression loss function L1 is: L1=GIoU(p,g) The calculation formula of the second regression loss function L2 is: L2=k1×GIoU(p,g)+k2×CIoU(p,g) The calculation formula of the third regression loss function L3 is: L3=CIoU(p,g) Among them, p and g are the predicted value and the true value respectively, and k1 and k2 are coefficients.

4. The method for training a target detection model according to claim 3, characterized in that: The values ​​of k1 and k2 are both 0.

5.

5. The method for training a target detection model according to claim 3, characterized in that: When training the initial target detection model, the learning rate is set to a preset value; When training the first intermediate target detection model, the learning rate is calculated as follows: When training the second intermediate target detection model, the learning rate is calculated as follows: α t =α0×e -λt Among them, α t is the learning rate of the tth iteration, λ is the decay rate, α max and α min are the maximum and minimum values ​​of the learning rate respectively; α0 is the preset value, E is the total number of iterations, and T is the sum of the first preset number and the second preset number.

6. The method for training a target detection model according to claim 5, characterized in that: The first preset number and the second preset number are equal in value.

7. The method for training a target detection model according to claim 5, characterized in that: α max The value of is 0.1, α min The value of is 0.01, the value of T is 50, and the value of α0 is 0.

1.

8. The method for training a target detection model according to any one of claims 2 to 7, characterized in that: The first classification loss function L classification The calculation formula is: The first confidence loss function L confidence The calculation formula is: Where N is the number of samples, y i is the true confidence of the i-th sample, is the prediction confidence of the i-th sample; C is the number of categories; y i,c is the true category of the i-th sample, is the predicted category probability of the i-th sample.

9. A terminal device, characterized in that: It comprises a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the steps of the target detection model training method as described in any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for training a target detection model as described in any one of claims 1 to 8 are implemented.

Citation Information

Cited By

  • Detection model training method and device and service quality detection method and device

    CN121309381A