A method, device and electronic device for screening training models in a training model group
The particle swarm algorithm is used to screen the optimal solution of the training model in the training model group, which solves the complex problems of training model selection and confidence parameter adjustment in the existing technology, achieves faster and more accurate model parameter screening, and improves target recognition. efficiency and accuracy.
Patent Information
- Application Number
- CN202111446357.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In the existing technology, the selection of training models and the adjustment of confidence parameters are often lengthy and complex and may not yield the optimal solution. Especially in multi-variable situations, automation is difficult to achieve, which affects the deployment and practicality of target recognition in engineering applications. change.
The particle swarm algorithm is used to initialize the particle vector, and the sample and particle vector are input into the training model group. The particle swarm algorithm is used to screen out the optimal solution of the training model group, including the number of training model iterations and target confidence, and automatic optimization is performed to reduce Manual filtering complexity.
It greatly reduces the complexity and time of manual screening, improves the accuracy of optimal solution screening for training model groups, overcomes the problems of low manual screening efficiency and sub-optimal model parameter groups, and achieves faster and more accurate model parameter screening.
Smart Images

Figure CN114092768B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, device and electronic equipment for screening training models in a training model group. Background Art
[0002] Object detection has always been a long-lasting research direction in the field of computer vision. Object detection is also a subjective process. It is quite simple for humans. Children without any training can easily locate the target object by observing different colors, regions and other features in the picture. However, when the computer receives the RGB pixel matrix of these pictures, it will not directly obtain the abstract concept of the target (such as pedestrians, vehicles, etc.), let alone locate its position. Researchers have explored a solution to these more subjective problems. This solution is to design a method for computers to learn from massive experience, fit things by building a hierarchical structure, and define things through relatively simple relationships between levels. This solution allows computers to capture experience from massive knowledge autonomously. The advantage is that it avoids humans specifying learning content for computers, thereby solving the problem of feature loss caused by humans not being able to fully know the features to be learned. Scientists proposed the concept of hierarchy for the first time, which is based on the way the human brain works, so that computers can learn complex features by building simple models, that is, deep learning mode. Computer systems need to have the ability to fit models from raw data, that is, the ability to learn autonomously, that is, machine learning. Using machine learning, computers can fit approximate models of real things and make judgments about similar things. Using this machine learning ability, abstract high-level features are used to achieve target positioning and classification to achieve target detection.
[0003] Object detection and recognition in computer vision has been widely used in many industries. Its deep learning work can be simply divided into two parts: training and prediction. The selection of training models and the optimization of various confidence levels in the prediction part have a huge impact on the final practical application effect.
[0004] At present, the selection of optimal models and confidence parameters for deep learning algorithms is mostly done by manual testing and screening. However, the process of manual screening and parameter adjustment based on the established mathematical model and output results is often long and complicated, and the final model and parameters may not be the optimal ones; and when changing the iterative training model, the confidence parameter group needs to be adjusted based on the balance between the target discovery rate and the accuracy rate. If there are many variables that need to be adjusted, there are more possible combinations for adjustment. This work is often not something that non-professionals can do, which brings great inconvenience to the deployment of target recognition in engineering applications and seriously affects the practical research of the technology. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method, device and electronic device for screening training models in a training model group to achieve automatic optimization of the optimal solution of the training model group.
[0006] According to the first aspect, an embodiment of the present invention provides a method for screening training models in a training model group, including: initializing a particle vector of each particle in a particle swarm; inputting a detection sample and the particle vector of each particle into the training model group and using a particle swarm algorithm to screen out the optimal solution of the training model group.
[0007] The method for screening the training model in the training model group provided by the embodiment of the present invention can use the particle swarm algorithm for automatic optimization, which greatly reduces the complexity of manual screening. For example, the model is trained for 50 generations, and the target categories are 10 categories. Assuming that the confidence setting size of each category of target is consistent, and the confidence is gradually increased according to the confidence step size of each category of 0.1, there are 10 cases (0.1, 0.2, ... 1), and the number of manual screenings is 50x10 = 500 times. If the confidence of each category is set to be inconsistent, and the confidence is gradually increased according to the confidence step size of each category of 0.1, there are 50x10 = 500 times. 10 =50x10 11 Second, the amount of calculation for manual screening is very large, and it is impossible to achieve enumeration, so usually only a partial comparison is made to obtain the final model parameter configuration. Therefore, when using manual screening, it is possible to screen out a suboptimal model parameter group, and it may also be easy to miss the selection; the particle swarm algorithm screening of the present application can overcome the above defects. In other words, the method for screening training models in the training model group provided by the embodiment of the present invention is faster and more accurate than manual optimization.
[0008] In combination with the first aspect, in the first implementation of the first aspect, the particle vector includes the number of training model iterations and the confidence of each type of target in the training model.
[0009] In combination with the first aspect, in the second implementation of the first aspect, the inputting of the detection sample and the particle vector of each particle into the training model group and using the particle swarm algorithm to screen out the optimal solution of the training model group includes: inputting the detection sample and the particle vector of each particle into the training model group to obtain a detection result set, wherein the detection result set includes the detection results of the training models with different numbers of iterations; obtaining the fitness of each particle according to the detection result set; and iteratively solving the optimal value of the particle swarm according to the fitness of each particle, a preset individual extreme value and a preset global extreme value to obtain the optimal solution of the training model group.
[0010] In combination with the second embodiment of the first aspect, in the third embodiment of the first aspect, obtaining the fitness of each particle according to the detection result set includes: for a particle, using the average precision of the detection results of the training model with the same number of iterations as the particle to the particle, and using the recall rate of the detection results of the training model with the same number of iterations as the particle to the particle; using the average precision of the particle and the recall rate of the particle to obtain the fitness of the particle; traversing all particles in the particle swarm to obtain the fitness of each particle in the particle swarm.
[0011] In combination with the third implementation manner of the first aspect, in the fourth implementation manner of the first aspect, the use of the detection result of the training model with the same number of iterations as the particle to obtain the average accuracy of the particle includes: determining the accuracy of each type of target according to the detection result of the training model with the same number of iterations as the particle; inputting the accuracy of each type of target into a preset first formula to obtain the average accuracy of the particle, and the first formula is:
[0012]
[0013] Among them, f () represents the average accuracy of the particle, and b i represents the first weight of the i-th target, P () The represents the accuracy of the i-th target in the particle, and n represents the number of target types in the particle. This not only ensures that the optimal training model selected can meet the recognition requirements of various types of targets, but also achieves the focus of key categories by adding weights of different categories, thereby achieving better model and parameter screening for the final prediction of key categories.
[0014] In combination with the third implementation of the first aspect, in the fifth implementation of the first aspect, the step of obtaining the fitness of the particle by using the average precision of the particle and the recall rate of the particle includes: inputting the average precision of the particle and the recall rate of the particle into a preset second formula to obtain the fitness of the particle, and the second formula is:
[0015]
[0016] Among them, F () represents the fitness of the particle, and f () represents the average accuracy of the particle, n represents the number of target types in the particle, and a i represents the second weight of the i-th target, the R () Represents the recall rate of the i-th target in the particle. Therefore, by adding weights of different classes, we can focus on the key classes, thereby achieving a better model and parameter screening for the final prediction of the key classes.
[0017] In combination with the third embodiment of the first aspect, in the sixth embodiment of the first aspect, before using the detection results of the training model with the same number of iterations as the particle to calculate the recall rate of the particle, it also includes: judging whether the average precision of the particle is greater than a preset threshold; when the average precision of the particle is greater than the threshold, executing the step of using the detection results of the training model with the same number of iterations as the particle to calculate the recall rate of the particle.
[0018] According to the second aspect, an embodiment of the present invention also provides a device for screening training models in a training model group, comprising an initialization module and a screening module, wherein the initialization module is used to initialize the particle vector of each particle in the particle swarm; the screening module is used to input the detection sample and the particle vector of each particle into the training model group and use the particle swarm algorithm to screen out the optimal solution of the training model group.
[0019] According to the third aspect, an embodiment of the present invention also provides an electronic device, comprising a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for screening training models in the training model group described in the first aspect or any embodiment of the first aspect by executing the computer instructions.
[0020] According to the fourth aspect, an embodiment of the present invention also provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the method for screening training models in the training model group described in the first aspect or any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The features and advantages of the present invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the present invention in any way. In the accompanying drawings:
[0022] Figure 1 Schematic diagram of the process of the method for screening training models in the training model group in Example 1 of the present invention;
[0023] Figure 2 Schematic diagram of the process of the particle swarm algorithm in Example 1 of the present invention;
[0024] Figure 3 Schematic diagram of the flow of the method for determining the optimal solution of the training model group in Example 1 of Embodiment 1 of the present invention;
[0025] Figure 4 A schematic diagram of the structure of an example of a deep convolutional neural model;
[0026] Figure 5 Schematic diagram of the training process of a deep convolutional neural network;
[0027] Figure 6 It is a structural schematic diagram of a training model screening method device in a training model group in Example 2 of the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0029] Example 1
[0030] Embodiment 1 of the present invention provides a method for screening training models in a training model group. Figure 1 Schematic diagram of the process of the training model screening method in the training model group in Example 1 of the present invention, such as Figure 1 As shown, the method for screening training models in the training model group in Embodiment 1 of the present invention, specifically a method for determining the optimal solution of the training model group, comprises the following steps:
[0031] S101: Initialize the particle vector of each particle in the particle swarm.
[0032] As a specific implementation, the particle vector includes the number of iterations of the training model and the confidence of each type of target in the training model.
[0033] For example, the particle vector of a particle in a particle swarm is represented by X = {x0, x1, x2, ... x n}. x0 is the number of training model iterations, x i is the confidence of n types of targets in the training model, where 1≤i≤n.
[0034] S102: Input the detection sample and the particle vector of each particle into the training model group and use the particle swarm algorithm to screen out the optimal solution of the training model group.
[0035] In Embodiment 1 of the present invention, a model (e.g., a deep convolutional neural network) is trained using a training sample set (e.g., a training image data set) to obtain training models with different numbers of iterations, and the training models with different numbers of iterations constitute a training model group. In other words, the training model group includes multiple training models, and each training model has a different number of iterations.
[0036] Specifically, when the training sample set is a training image data set, the training model group is a training model group for image recognition. For example, the target in the image can be recognized using the optimal training model selected from the training model group, where the target can be understood as the content involved in the image, such as pedestrians. It should be noted that there may be multiple types of targets involved in the image, such as people, animals, plants, etc.
[0037] As a further implementation method, before the test samples are respectively input into the training models of the training model group to obtain multiple groups of detection results, it also includes: obtaining a training image data set; obtaining a training model, wherein the training model is a deep learning model; and training the training model using the training image data set to obtain a training model group.
[0038] As a specific implementation manner, the detection sample and the particle vector of each particle are input into the training model group and the optimal solution of the training model group is screened out by the particle swarm algorithm. The following scheme can be adopted: the detection sample and the particle vector of each particle are input into the training model group to obtain a detection result set, wherein the detection result set includes the detection results of the training models with different iteration times; the fitness of each particle is obtained according to the detection result set; the optimal value of the particle swarm is iteratively solved according to the fitness of each particle, the preset individual extreme value and the preset global extreme value to obtain the optimal solution of the training model group.
[0039] More specifically, the fitness of each particle obtained according to the set of detection results can be obtained by the following scheme: for a particle, the average precision of the detection results of the training model with the same number of iterations as the particle is used to obtain the average precision of the particle, and the recall of the detection results of the training model with the same number of iterations as the particle is used to obtain the recall of the particle; the fitness of the particle is obtained by using the average precision of the particle and the recall of the particle; and all particles in the particle group are traversed to obtain the fitness of each particle in the particle group.
[0040] For example, using the detection result of the training model with the same number of iterations as the particle to obtain the average accuracy of the particle includes: determining the accuracy of each type of target according to the detection result of the training model with the same number of iterations as the particle; inputting the accuracy of each type of target into a preset first formula to obtain the average accuracy of the particle, and the first formula is:
[0041]
[0042] Among them, f () represents the average accuracy of the particle, and b i represents the first weight of the i-th target, P ()The represents the accuracy of the i-th target in the particle, and n represents the number of target types in the particle.
[0043] In Example 1 of the present invention, the accuracy of each type of target can be determined according to the detection results of the training model with the same number of iterations as the particle by any scheme in the prior art. For example, the confidence of each type of target in the x0th generation model is input as an input parameter into the x0th generation training model group to obtain the accuracy of the training model group. For example, the accuracy of the x0th generation training model can be calculated by the third formula: Calculate, where represents the accuracy of the x0th generation training model, Indicates the number of correct judgments among the samples judged as positive; Indicates the number of incorrect judgments among the samples judged as negative, x i is the confidence of the i-th target.
[0044] The recall rate of the particle using the detection results of the training model with the same number of iterations as the particle can adopt any solution in the prior art. For example, the confidence of each type of target in the x0th generation model is input as an input parameter into the x0th generation training model group to obtain the recall rate of the training model group. For example, according to the fourth formula Calculate the recall rate, where represents the recall rate of the x0th generation training model, Indicates the number of correct judgments among the samples judged as positive; is the number of incorrect judgments among the samples judged as positive, x i is the confidence of the i-th target.
[0045] The fitness of the particle obtained by using the average precision of the particle and the recall rate of the particle can be obtained by the following scheme: the average precision of the particle and the recall rate of the particle are input into a preset second formula to obtain the fitness of the particle, and the second formula is:
[0046]
[0047] Among them, F () represents the fitness of the particle, and f () represents the average accuracy of the particle, n represents the number of target types in the particle, and a i represents the second weight of the i-th target, the R () Represents the recall rate of the i-th target in the particle.
[0048] Among them, the fitness F ((X)The larger the value, the better the selected model and various confidence indicators. The model iteration number and confidence parameter group under the maximum value are the optimal solutions in this model group.
[0049] As a further implementation, before using the detection results of the training model with the same number of iterations as the particle to calculate the recall rate of the particle, it also includes: judging whether the average precision of the particle is greater than a preset threshold; when the average precision of the particle is greater than the threshold, executing the step of using the detection results of the training model with the same number of iterations as the particle to calculate the recall rate of the particle. For example, the preset threshold can be 80%. That is to say, only when the average precision of the particle is greater than the threshold, the value is considered to be valid, thereby ensuring the accuracy of the screening results.
[0050] In Example 1 of the present invention, the step of "iteratively solving the optimal value of the particle swarm according to the fitness of each particle, the preset individual extreme value and the preset global extreme value to obtain the optimal solution of the training model group" can use the particle swarm algorithm in the prior art to search for the global optimal solution. For example, Figure 2 As shown, the following solutions can be adopted:
[0051] ① Initialize a group of particles (group size is N), including random positions and velocities;
[0052] ② Use the first, second, third and fourth formulas above to evaluate the fitness of each particle respectively, and obtain the fitness of N particles in the current population;
[0053] ③ For each particle in the current group of N particles, compare its fitness with the best position pbest (individual extreme value) it has passed. If it is better, take it as the current best position pbest;
[0054] ④ For each particle in the current group of N particles, compare its fitness with the best position gbest (global extreme value) it has passed. If it is better, take it as the current best position gbest;
[0055] ⑤ Repeat ③ and ④ to obtain the global optimum in the current group, and determine whether the global optimum meets the iteration termination condition. If so, the iteration process is terminated. If not, the speed and position of each particle are adjusted to obtain the next group. The iteration termination condition is generally selected as the maximum number of iterations Gk or / and the optimal position searched so far by the particle group meets the predetermined minimum adaptation threshold according to the specific problem.
[0056] ⑥For the next group, repeat steps ② to ⑤ until the optimal value of the particle group is obtained.
[0057] The screening method of the training model in the training model group provided in Example 1 of the present invention can use the particle swarm algorithm for automatic optimization, which greatly reduces the complexity of manual screening. For example, the model is trained for 50 generations, and the target categories are 10 categories. Assuming that the confidence setting size of each category of target is consistent, and the confidence is gradually increased according to the confidence step size of each category of 0.1, there are 10 cases (0.1, 0.2, ... 1), and the number of manual screenings is 50x10 = 500 times. If the confidence of each category is set to be inconsistent, and the confidence is gradually increased according to the confidence step size of each category of 0.1, there are 50x10 10 =50x10 11 Second, the amount of calculation for manual screening is very large, and it is impossible to achieve enumeration, so usually only a partial comparison is made to obtain the final model parameter configuration. Therefore, when using manual screening, it is possible to screen out a suboptimal model parameter group, and it may also be easy to miss the selection; and the particle swarm algorithm screening of the present application cannot overcome the above defects. In other words, the method for screening training models in the training model group provided by the embodiment of the present invention is faster and more accurate than manual optimization.
[0058] That is to say, the method for screening training models in the training model group provided in Embodiment 1 of the present invention has the following advantages:
[0059] 1. The optimal solution structure of deep learning combined with particle swarm algorithm is realized. The machine learning autonomous optimization method is used to replace manual screening, which can realize efficient screening of the optimal solution in the training model group (including the optimal training model and / or the confidence parameters of various targets in the optimal training model). It overcomes the problem of low efficiency of manual screening in the past, and overcomes the disadvantage of using suboptimal model parameter groups for production due to manual screening.
[0060] 2. Design the fitness function of the particle swarm algorithm based on the deep learning algorithm and practical requirements, provide the basis for algorithm screening, and achieve the optimal screening criteria. This solves the problem of optimal solution leakage caused by manual search, greatly reduces the complexity of research and development, and improves the recognition rate of the target.
[0061] In order to more clearly illustrate the method for screening training models in the training model group of Example 1 of the present invention, an example is given. Figure 3 Schematic diagram of the flow of the method for determining the optimal solution of the training model group in Example 1 of Embodiment 1 of the present invention, such as Figure 3 As shown, the following steps are included:
[0062] (1) Acquire image data with annotation information, or annotate the historical image data to form a training image data set. Preprocess the training image data set, such as cleaning data samples, filtering images without corresponding targets, and deleting duplicate and low-quality blurred images.
[0063] (2) Use deep learning detection algorithms to implement iterative and step-by-step refinement of target area detection training. The structure of a deep learning model (such as a deep convolutional neural model) is as follows: Figure 4 As shown. Specifically, deep learning detection algorithms are divided into primary or secondary detection algorithms. The primary detection algorithm does not generate candidate boxes, but directly converts the problem of target border positioning into a regression problem, such as SSD, YOLO, RetinaNet, etc. The secondary detection algorithm first generates a series of candidate boxes as samples, and then classifies the samples through convolutional neural networks, such as RCNN, Faster-RCNN, etc. Here, the primary detection algorithm YOLO network algorithm is selected, and the training data is used to complete the network model group training according to the deep learning iterative training process. The training process is as follows Figure 5 As shown, a training model group (i.e., a deep learning detection model group) is obtained.
[0064] (3) preparing a target detection test sample and initializing the particle vector of each particle in the particle group (initializing the encoding parameter); inputting the detection sample and the particle vector of each particle into the training model group to obtain the detection result;
[0065] (4) obtaining the fitness of each particle according to the detection result set;
[0066] (5) Determine whether the convergence condition is met based on the calculated fitness;
[0067] (6) When the convergence condition is not met, the speed and position of the particle are updated; when the convergence condition is met, the optimal solution is output to configure pre-detection for target detection, realize the target recognition process for actual application in business scenarios, and use the selected optimal training model to perform on-site target recognition on image data.
[0068] That is to say, the screening method of the training model in the above training model group includes: obtaining target detection image data, such as pedestrian detection data, and the image data has annotation information. Select a deep learning model to perform target recognition training on the training sample set to obtain a training model group; prepare target detection test samples, use each training model to perform target detection test, and save the detection results; define the spatial position vector of the particle swarm particles, and select the confidence of each type of target in the model and the number of model iterations according to the target recognition requirements to define the particle swarm fitness function; iteratively solve the particle swarm fitness function to obtain the maximum value of the objective function, and determine the optimal solution in the training model group and the optimal confidence solution of the target detection class; use the deep learning model and its parameters corresponding to the optimal solution as the target recognition model for actual application in business scenarios to perform on-site target recognition work.
[0069] Example 2
[0070] Corresponding to the first embodiment of the present invention, the second embodiment of the present invention provides a device for screening training models in a training model group, Figure 6 Schematic diagram of the structure of the training model screening method device in the training model group in Example 2 of the present invention, such as Figure 6 As shown, the device for determining the optimal solution of the training model group in Embodiment 2 of the present invention includes an initialization module 20 and a screening module 21.
[0071] Specifically, the initialization module 20 is used to initialize the particle vector of each particle in the particle swarm;
[0072] The screening module 21 is used to input the detection sample and the particle vector of each particle into the training model group and use the particle swarm algorithm to screen out the optimal solution of the training model group.
[0073] For details of the above electronic equipment, please refer to Figures 1 to 5 The corresponding related descriptions in the illustrated embodiments can be understood and will not be repeated here.
[0074] Similarly, the device for screening training models in the training model group provided in Embodiment 2 of the present invention has the following advantages:
[0075] 1. The optimal solution structure of deep learning combined with particle swarm algorithm is realized. The machine learning autonomous optimization method is used to replace manual screening, which can realize efficient screening of the optimal solution in the training model group (including the optimal training model and / or the confidence parameters of various targets in the optimal training model). It overcomes the problem of low efficiency of manual screening in the past, and overcomes the disadvantage of using suboptimal model parameter groups for production due to manual screening.
[0076] 2. Design the fitness function of the particle swarm algorithm based on the deep learning algorithm and practical requirements, provide the basis for algorithm screening, and achieve the optimal screening criteria. This solves the problem of optimal solution leakage caused by manual search, greatly reduces the complexity of research and development, and improves the recognition rate of the target.
[0077] Example 3
[0078] An embodiment of the present invention further provides an electronic device, which includes a processor and a memory, wherein the processor and the memory may be connected via a bus or in other ways.
[0079] The processor may be a central processing unit (CPU). The processor may also be 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, or a combination of the above chips.
[0080] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method for determining the optimal solution of the training model group in the embodiment of the present invention (for example, Figure 6 The processor executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory, that is, the screening method of the training model in the training model group in the above method embodiment is implemented.
[0081] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0082] The one or more modules are stored in the memory and when executed by the processor, perform the following steps: Figures 1 to 5 The method for determining the optimal solution of the training model group in the illustrated embodiment.
[0083] For details of the above electronic equipment, please refer to Figures 1 to 6 The corresponding related descriptions and effects in the illustrated embodiments can be understood and will not be repeated here.
[0084] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0085] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for screening a training model in a training model group, characterized in that: include: Initialize the particle vector of each particle in the particle swarm; The particle vector includes the number of iterations of the training model and the confidence of each type of target in the training model; Input the detection sample and the particle vector of each particle into the training model group, and use the particle swarm algorithm to screen out the optimal solution of the training model group; wherein the training model group includes a plurality of the training models, and the number of iterations of each training model is different; The step of inputting the detection sample and the particle vector of each particle into the training model group and using the particle swarm algorithm to screen out the optimal solution of the training model group includes: Inputting the detection sample and the particle vector of each particle into a training model group to obtain a detection result set, wherein the detection result set includes detection results of the training models with different iteration times; Obtaining the fitness of each particle according to the detection result set; Iteratively solving the optimal value of the particle swarm according to the fitness of each particle, a preset individual extreme value and a preset global extreme value to obtain the optimal solution of the training model group; The step of obtaining the fitness of each particle according to the detection result set includes: For a particle, the average precision of the particle is obtained by using the detection result of the training model with the same number of iterations as the particle, and the recall of the particle is obtained by using the detection result of the training model with the same number of iterations as the particle; the fitness of the particle is obtained by using the average precision of the particle and the recall of the particle; Traversing all particles in the particle swarm to obtain the fitness of each particle in the particle swarm; The step of obtaining the fitness of the particle by using the average precision of the particle and the recall rate of the particle includes: The average precision of the particle and the recall rate of the particle are input into a preset second formula to obtain the fitness of the particle, and the second formula is: = in, represents the fitness of the particle. represents the average accuracy of the particle, n represents the number of target types in the particle, represents the second weight of the i-th target, represents the recall rate of the i-th target in the particle; The method of obtaining the average accuracy of the particle using the detection result of the training model with the same number of iterations as the particle includes: Determine the accuracy of each type of target based on the detection results of the training model with the same number of iterations as the particle; The accuracy of each type of target is input into a preset first formula to obtain the average accuracy of the particle, and the first formula is: = in, represents the average accuracy of the particle, represents the first weight of the i-th target, The represents the accuracy of the i-th target in the particle, and n represents the number of target types in the particle.
2. The method according to claim 1, characterized in that: Before obtaining the recall rate of the particle using the detection result of the training model with the same number of iterations as the particle, it also includes: Determine whether the average accuracy of the particle is greater than a preset threshold; When the average precision of the particle is greater than the threshold, the step of obtaining the recall rate of the particle by using the detection result of the training model with the same number of iterations as the particle is performed.
3. A device for screening training models in a training model group, characterized in that: include: An initialization module, used to initialize the particle vector of each particle in the particle swarm, wherein the particle vector includes the number of iterations of the training model and the confidence of each type of target in the training model; A screening module, used for inputting the detection sample and the particle vector of each particle into the training model group and screening out the optimal solution of the training model group by using the particle swarm algorithm; wherein the training model group includes a plurality of the training models, and the number of iterations of each training model is different; The step of inputting the detection sample and the particle vector of each particle into the training model group and using the particle swarm algorithm to screen out the optimal solution of the training model group includes: Inputting the detection sample and the particle vector of each particle into a training model group to obtain a detection result set, wherein the detection result set includes detection results of the training models with different iteration times; Obtaining the fitness of each particle according to the detection result set; Iteratively solving the optimal value of the particle swarm according to the fitness of each particle, a preset individual extreme value and a preset global extreme value to obtain the optimal solution of the training model group; The step of obtaining the fitness of each particle according to the detection result set includes: For a particle, the average precision of the particle is obtained by using the detection result of the training model with the same number of iterations as the particle, and the recall of the particle is obtained by using the detection result of the training model with the same number of iterations as the particle; the fitness of the particle is obtained by using the average precision of the particle and the recall of the particle; Traversing all particles in the particle swarm to obtain the fitness of each particle in the particle swarm; The step of obtaining the fitness of the particle by using the average precision of the particle and the recall rate of the particle includes: The average precision of the particle and the recall rate of the particle are input into a preset second formula to obtain the fitness of the particle, and the second formula is: = in, represents the fitness of the particle. represents the average accuracy of the particle, n represents the number of target types in the particle, represents the second weight of the i-th target, represents the recall rate of the i-th target in the particle; The method of obtaining the average accuracy of the particle using the detection result of the training model with the same number of iterations as the particle includes: Determine the accuracy of each type of target based on the detection results of the training model with the same number of iterations as the particle; The accuracy of each type of target is input into a preset first formula to obtain the average accuracy of the particle, and the first formula is: = in, represents the average accuracy of the particle, represents the first weight of the i-th target, The represents the accuracy of the i-th target in the particle, and n represents the number of target types in the particle.
4. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for screening training models in the training model group described in any one of claims 1-2 by executing the computer instructions.
5. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method for screening training models in the training model group described in any one of claims 1 to 2.
