Optimization Method and System for Detection Model Combining Evolutionary Multi-Objective and Evolutionary Multi-Task
By building a combination of auxiliary tasks and main tasks, using mountain climbing search and evolutionary multi-objective optimization methods, the local optimization and time complexity problems of the object detection model in weight optimization are solved, and rapid convergence and efficient model optimization are achieved.
Patent Information
- Application Number
- CN202210451076.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-24
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2042-04-24
AI Technical Summary
The existing object detection model is difficult to find the optimal weight λ during the optimization process, and the gradient descent algorithm is prone to fall into local optimality, the evolution algorithm has high time complexity and the dimensional curse problem is prominent, which makes it difficult to optimize the classification and regression loss functions simultaneously.
The detection model optimization method combining evolutionary multi-objective and evolutionary multi-task is adopted. By constructing auxiliary tasks and main tasks, the mountain climbing search algorithm is used to optimize weights, and the search results of auxiliary tasks are migrated to the main task population. Combining the evolutionary multi-objective optimization method, the NSGA-II algorithm is used to sort to obtain the final solution.
It realizes that without specifying weights, it can quickly converge to a set of mutually weighed solutions, which reduces the time complexity of the optimization of the object detection model and improves the optimization efficiency and accuracy of the model.
Smart Images

Figure CN114819144B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of target detection, and particularly relates to a method and system for optimizing a detection model by combining evolutionary multi-objectives and evolutionary multi-tasks. Background Art
[0002] So-called target detection is a process of finding specific things in an image or video and accurately positioning and identifying them. Generally speaking, it is divided into two processes: position determination and target recognition, and mainly has two major tasks: namely, regression and classification.
[0003] Classification assigns different labels to different targets, enabling a computer to distinguish different objects according to different features. The computer measures the gap between the model output and the truth through a loss function and indicates the direction for optimizing the model. Common classification loss functions include: 0-1 loss, logistic loss, Hinge loss, and exponential loss, etc.
[0004] Regression realizes object positioning in target detection, and gradually reduces the difference between the model output result and the real result by performing quantitative error analysis on the model output result and the real result. Common regression loss functions include: mean square error loss function, mean absolute error loss function, Huber loss, and cross-entropy loss, etc.
[0005] Currently, target detection is modeled by weighted summation of classification and regression, that is:
[0006] F = F1 + λF2
[0007] Wherein, F1 represents the classification loss, F2 represents the regression loss, and λ represents the weight between the classification loss and the regression loss.
[0008] This kind of modeling method transforms the two problems of classification and loss into one problem by weighted summation. However, the setting quality of the weight between classification and regression is closely related to the performance of the model. Moreover, the weight takes different values in different problems and also takes different values in different datasets of the same problem, and the current mainstream method is for users to take values according to experience, and the weight value is not accurate. At the same time, there are usually constraints and contradictions between multiple tasks, that is to say, after multiple tasks are transformed into a single task, when optimized to a certain extent, the optimization of one target often leads to the deterioration of another target.
[0009] Therefore, the deficiencies of modeling object detection by weighted summation are as follows: (1) The weight λ between classification and regression can only be determined empirically, and it is difficult to find the optimal weight λ; (2) There may be a relationship between the two objective functions corresponding to classification and regression, that is, when both objective functions are optimized to a certain extent, further optimization of one of them will necessarily lead to negative optimization of the other. The solution obtained by designing the overall objective function through weighted summation with the specified weight λ may not be able to optimize classification and regression simultaneously to the optimal state.
[0010] The training optimization methods for object detection models generally include gradient descent algorithms and evolutionary algorithms. Through the object detection modeling method, the loss function F of object detection is obtained. Since the value output by the loss function F represents the error value between the model output result and the true result, it can be considered that the process of training the object detection model is a process of finding the minimum value of the loss function.
[0011] Since the gradient of a function at a certain point always points in the direction where the function increases fastest at that point, based on this principle, the optimization method based on gradient descent continuously solves the gradient of the loss function F and updates the parameters Θ of the current model in the opposite direction of the gradient, and iterates continuously to find the minimum value of F. The formula is as follows:
[0012]
[0013] where Θ (n+1) represents the parameters of the object detection model at the (n + 1)-th iteration, Θ n represents the parameters of the object detection model at the n-th iteration, and α is the learning rate in the process of updating the gradient parameters, represents the gradient of the loss function F(Θ) with respect to Θ.
[0014] However, the deficiencies of the stochastic gradient descent method are as follows: (1) The gradient descent algorithm can only be applied to continuously differentiable objective functions and cannot solve the problem that the objective function is not continuously differentiable or cannot give the function; (2) The gradient algorithm is prone to falling into local optima.
[0015] Evolutionary algorithms (EA) are heuristic search algorithms inspired by the evolution of biological populations. They model the process of biological evolution by taking natural selection, survival of the fittest, and reproduction as the basic components of the algorithm. An individual represents a solution to a problem, and a population composed of individuals represents a set of solutions to the problem. The law of survival of the fittest is applied to operate on the population, simulating population evolution to obtain a better and more effective set of solutions. Its basic idea is: simulate the biological evolution process of nature, reflect genes and traits through coding, and then initialize a set of random solutions that meet the constraints for the problem to be solved as the initial population. Apply the law of survival of the fittest to this population, and solve the problem through the idea of evolution, gradually evolving a set of solutions that are closer and closer to the true solution of the problem. However, the deficiencies of evolutionary algorithms are: (1) high time complexity; (2) curse of dimensionality. Summary of the Invention
[0016] The purpose of the present invention is to overcome the deficiencies in the above background technology, reduce the time complexity of the optimization process of the target detection model, and be able to obtain a set of mutually balanced solutions.
[0017] To achieve the above objectives, the present invention proposes an optimization method for a detection model combining evolutionary multi-objective and evolutionary multi-task, and the method includes:
[0018] Construct an auxiliary task, where the auxiliary task is to optimize the weights in the target detection model based on the hill climbing search algorithm;
[0019] Construct a main task, where the main task is to optimize and solve the first objective function and the second objective function based on the evolutionary multi-objective method. The first objective function is a classification loss function, and the second objective function is a regression loss function;
[0020] Solve the auxiliary task and the main task, and use the solutions obtained during the search process of the auxiliary task as individuals to migrate to the population of the main task to complete model optimization.
[0021] Furthermore, the method also includes setting model optimization parameters, and the parameters include:
[0022] The set S of the objective function weights and the learning rate lr of the hill climbing search algorithm; the size of the population of the evolutionary multi-objective method is N and the maximum number of iterations is maxEpoch; the neural network topology structure MOD of the target detection model, the data volume DataSet, and the size batchSize of the batch sample extracted from the DataSet each time; the maximum number of individuals m migrated from the population of the hill climbing search algorithm to the population of the evolutionary multi-objective algorithm.
[0023] Further, solving the auxiliary task and the main task, and migrating the solutions obtained during the search process of the auxiliary task to the population of the main task to complete model optimization, including:
[0024] Initialize the neural network topology MOD and the weight set S respectively to obtain the first population POP and the second population GPOP;
[0025] Initialize the dictionary to obtain the historyElites dictionary;
[0026] Extract a data sample batchSample of size batchSize from the dataset, and place the corresponding number of the data sample batchSample into sample_id;
[0027] Evaluate based on the first population POP, and select the best λ individuals from the offspring as the next-generation individuals of the first population POP;
[0028] Migrate the individuals in the second population GPOP to the first population POP to obtain a migrated population;
[0029] Form a dictionary with the best individual in the migrated population and the current generation's sample_id and add it to the historyElites dictionary;
[0030] Let the population iteration number epochIndex = epochIndex + 1, and determine whether the current population iteration number satisfies epochIndex < maxEpoch, where maxEpoch is the maximum number of iterations;
[0031] If so, re-execute the step of initializing the dictionary;
[0032] If not, use the NSGA-II algorithm to sort the first population POP to obtain the Pareto front and obtain the final solution set.
[0033] Further, the initializing the neural network topology MOD and the weight set S respectively to obtain the first population POP and the second population GPOP includes:
[0034] Initialize N individuals of the population according to the neural network topology MOD of the object detection model using a (0, 1) normal distribution to obtain the first population POP;
[0035] For each element in the weight set S, initialize 1 individual according to the neural network topology MOD of the target detection model using a (0, 1) normal distribution, obtaining a second population GPOP that is solved by the hill climbing search algorithm and consists of |S| individuals.
[0036] Further, the evaluation based on the first population POP, and selecting the best λ individuals from the offspring as the next generation individuals of the first population POP includes:
[0037] Compare the sample_id with the evaluation data numbers datas in the historyElites dictionary, and find the elite individual corresponding to the evaluation data number datas with the largest overlap degree;
[0038] Apply a perturbation to the elite individual to obtain a perturbed individual, and add the elite individual and the perturbed individual to the first population POP;
[0039] Evaluate the first population POP on the data sample batchSample, and the first population POP performs offspring mutation operations to obtain a new population TempNewPOP;
[0040] Based on the first population POP and the population TempNewPOP, select the best λ individuals from the offspring as the next generation individuals of the first population POP.
[0041] Further, the migration of the individuals in the second population GPOP to the first population POP to obtain a migration population includes:
[0042] Perform fitness evaluation on the second population GPOP on the data sample batchSample, and initialize the set addedSet;
[0043] For the individuals in the second population GPOP, if there is an individual whose ranking in the second population POP is worse than |POP| / 2, update this individual using the hill climbing search algorithm with the learning rate lr, and add this individual to the set addedSet;
[0044] Migrate all the individuals in the set addedSet to the first population POP to obtain a migration population.
[0045] Further, evaluate the first population POP on the data sample batchSample, and the first population POP performs offspring mutation operations to obtain a new population TempNewPOP, including:
[0046] Perform fitness evaluation and sorting on the first population POP with respect to the data sample batchSample;
[0047] Extract two parents from the first population POP, and perform crossover using a coarse-grained crossover algorithm, and repeat several times to obtain a new population CrossPop;
[0048] Perform a mutation operation on the population CrossPop to obtain the population TempNewPOP.
[0049] Furthermore, based on the first population POP and the population TempNewPOP, selecting the best λ individuals from the offspring as the next-generation individuals of the first population POP includes:
[0050] Perform fitness evaluation and sorting on the population TempNewPOP with respect to the data sample batchSample;
[0051] Perform a selection operation on the first population POP and the population TempNewPOP, and based on the evaluation results of the population TempNewPOP and the evaluation results of the TempNewPOP, select the best λ individuals from the offspring as the next-generation individuals of the first population POP.
[0052] Furthermore, extracting two parents from the first population POP and performing crossover using a coarse-grained crossover algorithm includes:
[0053] Randomly select several crossover start sites among all individuals in the first population POP, and the distance between the start sites is greater than or equal to the maximum exchange length max_length;
[0054] For each start site, each time take a random number len in the range [0, max_length], and the area with a length of len starting from the start point is used as the crossover area;
[0055] If the random number is greater than the crossover probability Cr, then use Uniform crossover to perform crossover between the two parents in the crossover area, generate two offspring, and randomly select one as the output.
[0056] In addition, to achieve the above object, the present invention also proposes a detection model optimization system combining evolutionary multi-objective and evolutionary multi-task, and the system includes:
[0057] A first construction module for constructing an auxiliary task, where the auxiliary task is to optimize the weights in the object detection model based on a hill climbing search algorithm;
[0058] A second construction module for constructing a main task, where the main task is to optimize and solve a first objective function and a second objective function based on an evolutionary multi-objective method, the first objective function is a classification loss function, and the second objective function is a regression loss function;
[0059] A model optimization module for solving the auxiliary task and the main task, and migrating the solutions obtained during the search process of the auxiliary task to the population of the main task as individuals to complete model optimization.
[0060] Compared with the prior art, the present invention has the following technical effects: In view of the problem that the target detection model needs to manually specify weights, the present invention introduces an evolutionary multi-objective algorithm, without the need to specify weights, takes the classification loss and the regression loss as two objective functions that need to be optimized simultaneously, and uses the evolutionary multi-objective optimization method (evolutionary multi-objective optimization, EMO) algorithm for multi-objective optimization, and finally obtains a set of non-dominated solutions to find a set of mutually balanced solutions; however, introducing the EMO algorithm into the population search will cause the convergence speed of the algorithm to be very slow. The present invention introduces evolutionary multi-tasks, constructs an auxiliary task that can converge quickly, and migrates the solutions obtained during the search process of the auxiliary task to the main task population to accelerate the convergence of the main task. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The following will describe in detail the specific embodiments of the present invention with reference to the accompanying drawings:
[0062] Figure 1 is a flowchart of a detection model optimization method combining evolutionary multi-objective and evolutionary multi-tasks in the first embodiment of the present invention;
[0063] Figure 2 is a distribution diagram of the initialization of the population POP in two dimensions in the first embodiment of the present invention;
[0064] Figure 3 is a schematic diagram of the historyelites dictionary in the first embodiment of the present invention;
[0065] Figure 4 is a schematic diagram of coarse-grained crossover and swap in the first embodiment of the present invention;
[0066] Figure 5 is a schematic diagram of fine-grained crossover and swap in the first embodiment of the present invention;
[0067] Figure 6 is an overall flowchart of a detection model optimization method combining evolutionary multi-objective and evolutionary multi-tasks in the present invention;
[0068] Figure 7 It is the structural diagram of the detection model optimization system combining evolutionary multi-objective and evolutionary multi-task in the second embodiment of the present invention. Specific implementation manners
[0069] To further illustrate the features of the present invention, please refer to the following detailed description and drawings of the present invention. The attached drawings are for reference and illustration only, and are not used to limit the protection scope of the present invention.
[0070] As Figure 1 shown, this embodiment discloses a detection model optimization method combining evolutionary multi-objective and evolutionary multi-task. The method includes the following steps:
[0071] S10. Construct an auxiliary task, where the auxiliary task is to optimize the weights in the object detection model based on the hill climbing search algorithm.
[0072] S20. Construct a main task, where the main task is to optimize and solve the first objective function and the second objective function based on the evolutionary multi-objective method. The first objective function is a classification loss function, and the second objective function is a regression loss function.
[0073] S30. Solve the auxiliary task and the main task, and use the solutions obtained during the search process of the auxiliary task as individuals to migrate into the population of the main task to complete model optimization.
[0074] It should be noted that there is a problem that it is difficult to search for the optimal solution for both the classification loss and the regression loss simultaneously in the objective function of the object detection model, and using the gradient method to optimize this objective function often falls into a local optimum. This embodiment proposes a method based on evolutionary multi-objective EMO to optimize the object detection model, taking the classification loss and the regression loss as two objective functions that need to be optimized simultaneously, and finally obtaining a set of non-dominated solutions.
[0075] However, since EMO introduces population search, this will lead to a very slow convergence speed of the algorithm. Therefore, this embodiment introduces evolutionary multi-task, and constructs an auxiliary task that can converge quickly to accelerate the convergence of the main task. The auxiliary task is to optimize the object detection model using the traditional hill climbing search method, optimize the objective function of the object detection model by initializing a set of random λ weights, and accelerate the convergence of the main task by migrating the solutions obtained during the search process of the auxiliary task into the main task population.
[0076] It should be understood that this embodiment can use an EMO algorithm including but not limited to NSGA-II for multi-objective optimization, and this embodiment does not make a specific limitation.
[0077] In one embodiment, in the steps S10 and S20, model optimization parameters are set, and the parameters include:
[0078] The objective function weight set S and the learning rate lr of the hill climbing search algorithm; the population size N and the maximum number of iterations maxEpoch of the evolutionary multi-objective method; the neural network topology structure MOD of the object detection model, the data volume DataSet, and the size batchSize of each batchsample extracted from the DataSett; the maximum number of individuals m migrated from the population of the hill climbing search algorithm to the population in the evolutionary multi-objective algorithm; and the maximum exchange length max_length and the exchange probability Gr in the pre-set coarse-grained crossover algorithm.
[0079] It should be noted that in this embodiment, the hill climbing method objective function weight set S specified manually, for example, there are three objectives, |S| = 3, then S can be {(0.2, 0.5, 0.3), (0.3, 0.5, 0.2), (0.4, 0.4, 0.2)}.
[0080] In one embodiment, the step S30 specifically includes the following steps:
[0081] S31. Initialize the neural network topology structure MOD and the weight set S respectively to obtain the first population POP and the second population GPOP.
[0082] S32. Initialize the dictionary to obtain the historyElites dictionary.
[0083] It should be noted that the initialization is empty. The key of this dictionary is the iteration number, and each value is a dictionary with two key values, elite and datas. The value corresponding to elite is the chromosome vector of one elite individual, and the value corresponding to datas (the number of data in the batch sample) is the number of the evaluation data corresponding to this elite individual. As Figure 3 shown, historyElites = {1: {elite: (0.002, 0.69, 1.81, 0.57), datas = (1, 16, 99, 33, 55, 1045)}} represents that there is one elite individual inside, its chromosome is (0.002, 0.69, 1.81, 0.57), and the numbers of the corresponding data in the batchsample are (1, 16, 99, 33, 55, 1045).
[0084] S33. Extract a data sample batchSample of size batchSize from the dataset, and put the number corresponding to the data sample batchSample into sample_id.
[0085] S34. Based on the evaluation of the first population POP, select the best λ individuals from the offspring as the next-generation individuals of the first population POP.
[0086] S35. Migrate the individuals in the second population GPOP to the first population POP to obtain a migrated population.
[0087] S36. Combine the best individual in the migrated population and the current generation's sample_id into a dictionary and add it to the historyElites dictionary.
[0088] S37. Let the population iteration number epochIndex = epochIndex + 1, and determine whether the current population iteration number satisfies epochIndex < maxEpoch, where maxEpoch is the maximum number of iterations. If so, execute step S32; otherwise, execute step S38.
[0089] S38. Use the NSGA-II algorithm to sort the first population POP to obtain the Pareto front and get the final solution set.
[0090] In one embodiment, step S31 specifically includes the following steps:
[0091] S311. Initialize the N individuals of the population according to the neural network topology MOD of the target detection model using a (0, 1) normal distribution to obtain the first population POP.
[0092] It should be noted that in this embodiment, N individuals are initialized according to the neural network topology MOD using a (0, 1) normal distribution, that is, one locus of each individual's chromosome corresponds to a parameter in the model, and the initialized value of each locus follows N(0, 1). These N individuals form the initial population POP based on EMO. For example, when the search space is two-dimensional, the distribution of each individual can be as Figure 2 shown.
[0093] S312. For each element in the weight set S, initialize 1 individual according to the neural network topology MOD of the target detection model using a (0, 1) normal distribution to obtain a second population GPOP consisting of |S| individuals solved by the hill climbing search algorithm.
[0094] Note that for each element s in the weight set S, one individual is initialized according to the (0, 1) normal distribution using the MOD algorithm. When updating the parameters using the stochastic gradient descent method, the loss is calculated by multiplying s by the corresponding objective loss. Finally, a population GPOP consisting of |S| individuals that searches for solutions using the hill climbing algorithm is obtained.
[0095] In one embodiment, step S34 specifically includes the following steps:
[0096] S341. Compare the sample_id with the evaluation data numbers datas in the historyElites dictionary, and find the elite individual corresponding to the evaluation data number datas with the largest overlap degree.
[0097] S342. Apply a perturbation to the elite individual to obtain a perturbed individual, and add the elite individual and the perturbed individual to the first population POP.
[0098] Note that in this embodiment, the sample_id is compared with the datas in the historyElites dictionary to find the elite individual corresponding to the datas with the largest overlap degree, and a perturbation is applied to the elite individual, such as adding a noise that follows N(0, 1) to obtain some individuals distributed around the elite individual in the search space. The elite individual and these generated individuals are added to the first population POP.
[0099] S343. Evaluate the first population POP on the data sample batchSample, and the first population POP performs offspring mutation operations to obtain a new population TempNewPOP.
[0100] S344. Based on the first population POP and the population TempNewPOP, select the best λ individuals from the offspring as the next generation individuals of the first population POP.
[0101] In one embodiment, step S35 specifically includes the following steps:
[0102] S351. Perform fitness evaluation on the second population GPOP on the data sample batchSample, and initialize the set addedSet.
[0103] S352. For the individuals in the second population GPOP, if there are individuals whose rankings in the second population POP are worse than |POP| / 2, update these individuals using the hill climbing search algorithm with the learning rate lr, and add these individuals to the set addedSet.
[0104] S353. Migrate all individuals in the set addedSet to the first population POP to obtain a migrated population.
[0105] It should be noted that for an individual g in the second population GPOP, if the ranking of g in POP is worse than |POP| / 2, the hill climbing method is used to update the individual g with the learning rate lr, and the individual g is added to the set addedSet. If the number of selected individuals is greater than m, the best m individuals are taken, otherwise all are taken; otherwise, no operation is performed on the individual g.
[0106] It should be noted that for the population POP, the number of individuals in it is denoted as |POP|. The individuals in the population POP are evaluated and numbered in order from best to worst, numbered from 1 to |POP|. For example, the individual numbered 1 is better than the individual numbered 2, and so on. For an individual g in GPOP, the individual g is compared with the individuals in POP. If the individual g is worse than the individual ranked |POP| / 2, the hill climbing method is used to update the individual g with the learning rate lr, and the individual g is added to the set addedSet. If the number of individuals meeting the conditions is greater than m, at this time, the best m individuals are selected and added to the addedset. If the number of individuals meeting the conditions is less than m, then all the individuals meeting the conditions are added to the addedset.
[0107] In one embodiment, step S343 specifically includes the following steps:
[0108] (1) Perform fitness evaluation and sorting on the first population POP on the data sample batchSample.
[0109] (2) Extract two parents from the first population POP, and perform crossover using the coarse-grained crossover algorithm and repeat several times to obtain a new population CrossPop.
[0110] It should be noted that by continuously extracting two parents from the population POP and performing crossover using this coarse-grained crossover algorithm and repeating several times, a new CrossPop is obtained. For example: the (μ,λ)-selection method can be adopted. The number of individuals in each generation is μ. Each time, two parents are randomly selected and two offspring are generated according to the coarse-grained crossover algorithm, and a total of λ offspring are generated. Then, μ individuals are selected from the offspring as the next generation. Another example is the (μ+λ)-selection method. The process is similar, except that instead of selecting μ individuals from the offspring, μ individuals are selected from the current generation and the offspring.
[0111] (3) Perform a mutation operation on the population CrossPop to obtain the population TempNewPOP.
[0112] It should be noted that in this embodiment, a mutation operation is performed on CrossPop to obtain TempNewPOP. For example, a small random value can be added at each locus.
[0113] In one embodiment, in the step (2), two parents are selected from the first population POP and crossed using a coarse-grained crossover algorithm, including:
[0114] Randomly select several crossover start sites among all individuals in the first population POP, and the distance between the start sites is greater than or equal to the maximum exchange length max_length.
[0115] For each start site, each time a random number len in the range [0, max_length] is taken, and the area with a length of len starting from the start point is used as the crossover area.
[0116] If the random number is greater than the crossover probability Cr, then Uniform crossover is used to cross the two parents in the crossover area, generating two offspring, and randomly selecting one as the output.
[0117] It should be noted that as Figure 4 shown, coarse-grained crossover means swapping the two parents in the corresponding area here to generate two offspring, and randomly selecting one as the output.
[0118] As Figure 5 shown, fine-grained crossover means using Uniform crossover to cross the two parents to generate two offspring and randomly selecting one as the output. The mutation probability of each locus uses a preset probability Cr, that is, a random number between [0, 1] is generated, and then if this random number is greater than Cr, the locus is swapped, otherwise it is not swapped.
[0119] It should be noted that in order to further improve the convergence speed of the algorithm, as well as enhance the mutation and crossover efficiency of the algorithm in the high-dimensional search space and improve the search ability of the algorithm, this embodiment proposes a coarse-grained crossover operator to achieve this. Coarse-grained crossover is inspired by the exchange of chromosome segments in biology, increasing the exploration performance. By combining fine-grained crossover, better global search can be performed.
[0120] In one embodiment, the step S344 includes the following steps:
[0121] (1) Perform fitness evaluation and sorting on the population TempNewPOP with respect to the data sample batchSample.
[0122] It should be noted that fitness evaluation and sorting are performed on TempNewPOP with respect to the data sample batchSample. For example, the < mentioned in NSGA-II can be used. n The partial order relationship means that an individual in the previous non-dominated solution set is superior to the one behind. Among the elements in each non-dominated solution set, sparser ones are better than crowded ones. In i < n j, i is better than j. This way can be adopted for the subsequent designed sorting operations.
[0123] (2) Perform a selection operation on the first population POP and the population TempNewPOP, and select the best λ individuals from the offspring as the next-generation individuals of the first population POP according to the evaluation results of the population TempNewPOP and the evaluation results of the TempNewPOP.
[0124] It should be noted that a selection operation is performed on the populations POP and TempNewPOP, and N individuals are selected to form the next-generation POP. For example, the (μ, λ)-selection plus the elitist principle is used to select the best λ individuals from the offspring as the next generation according to the results obtained from the previous evaluation.
[0125] As Figure 6 shown, the overall implementation steps of the detection model optimization combining evolutionary multi-objective and evolutionary multi-task proposed in this embodiment are as follows:
[0126] (1) Input parameters: Input the population size N based on EMO; the maximum number of iterations maxEpoch; the maximum number of individuals m migrated from the population based on the hill-climbing method to the population applying the evolutionary algorithm; the set S of weights of the hill-climbing objective function specified manually. For example, if we have three objectives and |S| = 3, then S can be {(0.2, 0.5, 0.3), (0.3, 0.5, 0.2), (0.4, 0.4, 0.2)}; the hill-climbing learning rate lr, the neural network topology MOD of the object detection model, the data DataSet, the size batchSize of the batchsample extracted from the dataset each time; the maximum swap length max_length and the swap probability in the coarse-grained crossover algorithm.
[0127] (2) Initialize the population POP: Initialize N individuals according to the MOD using the (0, 1) normal distribution, that is, one locus of the chromosome of each individual corresponds to a parameter in the model, and the initialized value of each locus follows N(0, 1). These N individuals form the initial population POP based on EMO.
[0128] (3) Initialize the population GPOP: For each element s in S, initialize 1 individual according to the normal distribution of (0, 1) using MOD. When updating the parameters by the stochastic gradient descent method, the loss is calculated by multiplying s by the corresponding objective loss. Finally, obtain a population GPOP consisting of |S| individuals that search for solutions using the hill climbing algorithm.
[0129] (4) Initialize the historyElites dictionary: Initialize it to be empty. The keys of this dictionary are the iteration number, and each value is a dictionary with two key-value pairs, elite and datas. The value corresponding to elite is the chromosome vector of 1 elite individual, and the value corresponding to datas (the number of data in the batch sample) is the number of the evaluation data corresponding to this elite individual.
[0130] (5) Extract the evaluation data batchSample: Extract a data sample batchSample of size batchSize from the dataset and put its corresponding number into sample_id.
[0131] (6) Add historical individuals to POP: Compare sample_id with datas in the historyElites dictionary, find the elite individual corresponding to the datas with the largest overlap degree, and apply a perturbation to the elite individual, such as adding a noise that follows N(0, 1) to obtain some individuals distributed around this elite individual in the search space. Add this elite individual and these generated individuals to POP.
[0132] (7) Evaluate POP: Perform fitness evaluation and sorting on POP for batchSample;
[0133] (8) Generate offspring from POP: Continuously extract two parents from POP and perform crossover using the coarse-grained crossover algorithm proposed in this paper to obtain a new CrossPop, and repeat it several times; for example, the (μ, λ)-selection method can be used. The number of individuals in each generation is μ. Each time, randomly extract two parents and generate two offspring according to the coarse-grained crossover algorithm, and a total of λ offspring are generated. Then, select μ individuals from the offspring as the next generation. Another example is the (μ + λ)-selection method, and the process is similar, except that instead of selecting μ individuals from the offspring, μ individuals are selected from the current generation and the offspring.
[0134] Mutation operation on POP offspring: Perform mutation operation on CrossPop to obtain TempNewPOP; for example, a small random value can be added at each locus
[0135] (9) Evaluate TempNewPOP: Sort the fitness of TempNewPOP on batchSample.
[0136] (10) Select the next generation individuals of POP: Perform a selection operation on POP and TempNewPOP, and select N individuals to form the next generation of POP. For example, use (μ, λ)-selection plus the elitist principle to select the best λ individuals from the offspring as the next generation according to the results obtained from the previous evaluation.
[0137] (11) Evaluate GPOP: Evaluate the fitness of GPOP on batchSample.
[0138] (12) Initialize the set addedSet: Initialize the set addedSet and set it to be empty.
[0139] (13) Migrate individuals from GPOP to addedSet: For each individual g in GPOP, if the rank of g in POP is worse than |POP| / 2, update g by one step using the hill climbing method with the learning rate lr and add g to the set addedSet; otherwise, do not operate on the individual g.
[0140] (14) Add all individuals in addedSet to POP.
[0141] (15) Save the current historical optimal solution: Select the best individual in POP and form a dictionary with the chromosome and the sample_id of the current generation and add it to the historyElites dictionary.
[0142] (16) Judge the end condition: epochIndex = epochIndex + 1. If epochIndex < maxEpoch, jump to step (4).
[0143] (17) Obtain the final solution set: Use the NSGA-II algorithm to sort the POP population to obtain the Pareto front.
[0144] It should be noted that the evolutionary multi-task algorithm utilizes the implicit parallelism of the evolutionary algorithm to process multiple tasks simultaneously, and these tasks can be related or unrelated. In the concept of the evolutionary multi-task algorithm, there is a correlation to a certain extent between the knowledge used to solve one task and the knowledge required to solve another similar task. Therefore, in the present invention, the first task is designed. This task obtains some individuals (solutions) by manually specifying the weight optimization objective function of the hill climbing search algorithm. The second task is to search for the solution of the objective function by means of the evolutionary algorithm. Since the first task and the second task share a search space, and it can be considered that the knowledge for optimizing the first task is relevant to the knowledge for optimizing the second task, the individuals in the first task are migrated to the second task, so that knowledge transfer can be achieved and the convergence of task two can be accelerated.
[0145] This embodiment applies dynamic optimization to promote convergence on large-scale data sets. The dynamic optimization problem is a type of problem whose conditions change over time, and the change of conditions may affect the objective function, search space, or constraint conditions of the model, etc. In the field of object detection studied in the present invention, since the entire data set is divided into small batches of data during model training and the model is trained in different batches of small data in turn. There are N samples in the training set, and the data sample i poses a constraint Si on the optimization. Therefore, the global optimization problem is the optimization problem of N constraints. For any batch j of n samples, a subset {Sj1, Sj2, Sj3,..., Sjn} of different global constraints is re-sampled, thus constructing a sub-problem of the global problem. There is a correlation between the data in different batches, and there is an intersection between the constructed constraint subsets. Therefore, this correlation is utilized to obtain information from the solutions of historical batches to accelerate the convergence of the search in the current batch. During the training process, the historical optimal solutions of each batch are retained. By matching the correlation between the current problem and the historical problems, the optimal solution of the most relevant historical problem is selected and formed into a partial migration solution to be added to the current problem to promote the convergence of the current problem.
[0146] In addition, as Figure 7 shown, the second embodiment of the present invention also proposes a detection model optimization system combining evolutionary multi-objective and evolutionary multi-task, and the system includes:
[0147] The first construction module 10 is used to construct an auxiliary task, and the auxiliary task is to optimize the weights in the object detection model based on the hill climbing search algorithm;
[0148] The second construction module 20 is used to construct a main task, and the main task is to optimize and solve the first objective function and the second objective function based on the evolutionary multi-objective method. The first objective function is a classification loss function, and the second objective function is a regression loss function;
[0149] The model optimization module 30 is used to solve the auxiliary task and the main task, and transfer the solutions obtained during the search process of the auxiliary task to the population of the main task as individuals to complete model optimization.
[0150] It should be noted that the objective function of the object detection model has the problem that it is difficult to search for the optimal solution for both the classification loss and the regression loss at the same time, and using the gradient method to optimize this objective function often falls into a local optimum. This embodiment proposes a method based on evolutionary multi-objective EMO to optimize the object detection model, taking the classification loss and the regression loss as two objective functions that need to be optimized simultaneously, and finally obtaining a set of non-dominated solutions.
[0151] However, since EMO introduces population search, this will lead to a very slow convergence speed of the algorithm. Therefore, this embodiment introduces evolutionary multi-tasks, and constructs an auxiliary task that can converge quickly to accelerate the convergence of the main task; the auxiliary task is to optimize the object detection model using the traditional hill climbing search method, optimize the objective function of the object detection model by initializing a set of random λ weights, and accelerate the convergence of the main task by transferring the solutions obtained during the search process of the auxiliary task to the main task population.
[0152] In one embodiment, the system further includes a parameter setting module for setting parameters including: the objective function weight set S and the learning rate lr of the hill climbing search algorithm; the population size N and the maximum number of iterations maxEpoch of the evolutionary multi-objective method; the neural network topology structure MOD of the object detection model, the data volume DataSet, and the size batchSize of the batchsample extracted from the DataSett each time; the maximum number of individuals m transferred from the population of the hill climbing search algorithm to the population of the evolutionary multi-objective algorithm; and the maximum exchange length max_length and the exchange probability Gr in the pre-set coarse-grained crossover algorithm.
[0153] In one embodiment, the model optimization module 30 includes:
[0154] An initialization unit initializes the neural network topology structure MOD and the weight set S respectively to obtain the first population POP and the second population GPOP.
[0155] A dictionary initialization unit is used to initialize the dictionary to obtain the historyElites dictionary.
[0156] An extraction unit extracts a data sample batchSample with a size of batchSize from the data set and places the corresponding number of the data sample batchSample into sample_id.
[0157] An evaluation unit for evaluating based on the first population POP and selecting the best λ individuals from the offspring as the next-generation individuals of the first population POP.
[0158] A migration unit for migrating individuals in the second population GPOP to the first population POP to obtain a migrated population.
[0159] An addition unit for forming a dictionary from the best individual in the migrated population and the current generation's sample_id and adding it to the historyElites dictionary.
[0160] A judgment unit for setting the population iteration number epochIndex = epochIndex + 1 and judging whether the current population iteration number satisfies epochIndex < maxEpoch, where maxEpoch is the maximum number of iterations.
[0161] A determination unit for controlling the action of the dictionary initialization unit when the output result of the judgment unit is yes, and for sorting the first population POP using the NSGA-II algorithm to obtain the Pareto front and obtaining the final solution set when the output result of the judgment unit is no.
[0162] It should be noted that other embodiments or implementation methods of the detection model optimization system combining evolutionary multi-objective and evolutionary multi-task of the present invention can refer to the above method embodiments, and will not be repeated here.
[0163] It should be noted that the logic and / or steps represented in the flowchart or described otherwise herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch instructions from the instruction execution system, apparatus, or device and execute the instructions), or in combination with these instruction execution systems, apparatuses, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in combination with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium include the following: an electrical connection part with one or more wirings (electronic device), a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or otherwise processing as appropriate, and then storing it in a computer memory.
[0164] It should be understood that each part of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application-specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0165] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "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 invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.
[0166] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise specifically defined.
[0167] The foregoing are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. An optimization method for a detection model combining evolutionary multi-objective and evolutionary multi-task, characterized in that The method includes: Constructing an auxiliary task, which is to optimize the weights in the object detection model based on the hill climbing search algorithm. Here, the object detection model uses a neural network and is used to locate and identify specific things in images or videos. The set model optimization parameters include: the set of weights S of the objective function of the hill climbing search algorithm and the learning rate lr; the population size N and the maximum number of iterations maxEpoch of the evolutionary multi-objective method; the neural network topology MOD of the object detection model, the data volume DataSet, and the size batchSize of each batchsample extracted from the DataSet; the maximum number of individuals m migrated from the population of the hill climbing search algorithm to the population of the evolutionary multi-objective algorithm; Constructing a main task, which is to optimize and solve the first objective function and the second objective function based on the evolutionary multi-objective method. The first objective function is a classification loss function, and the second objective function is a regression loss function; Solving the auxiliary task and the main task, and using the solutions obtained during the search process of the auxiliary task as individuals to migrate into the population of the main task to complete model optimization, including: initializing the neural network topology MOD and the set of weights S respectively to obtain the first population POP and the second population GPOP. Specifically: initializing N individuals of the population according to the neural network topology MOD of the object detection model using a (0, 1) normal distribution to obtain the first population POP; for each element in the set of weights S, initializing 1 individual according to the neural network topology MOD of the object detection model using a (0, 1) normal distribution to obtain a second population GPOP consisting of |S| individuals solved by the hill climbing search algorithm; Initializing a dictionary to obtain the historyElites dictionary; Extracting a data sample batchSample with a size of batchSize from the dataset and putting the corresponding number of the data sample batchSample into sample_id; Evaluating based on the first population POP, and selecting the best λ individuals from the offspring as the next generation individuals of the first population POP; Migrating the individuals in the second population GPOP into the first population POP to obtain a migrated population; Forming a dictionary with the best individual in the migrated population and the current generation's sample_id and adding it to the historyElites dictionary; Letting the population iteration number epochIndex = epochIndex + 1, and judging whether the current population iteration number satisfies epochIndex < maxEpoch, where maxEpoch is the maximum number of iterations; If so, re-executing the step of initializing the dictionary; If not, using the NSGA-II algorithm to sort the first population POP to obtain the Pareto front and obtaining the final solution set.
2. The detection model optimization method combining evolutionary multi-objective and evolutionary multi-task according to claim 1, characterized in that Evaluating based on the first population POP, and selecting the best individual from the offspring as the next-generation individual of the first population POP, including: Comparing the sample_id with the evaluation data numbers datas in the historyElites dictionary to find the elite individual corresponding to the evaluation data number datas with the largest overlap degree; Applying a perturbation to the elite individual to obtain a perturbed individual, and adding the elite individual and the perturbed individual to the first population POP; Evaluating the first population POP on the data sample batchSample, and the first population POP performs offspring mutation operations to obtain a new population TempNewPOP; Based on the first population POP and the population TempNewPOP, selecting the best λ individuals from the offspring as the next-generation individuals of the first population POP.
3. The optimization method of the detection model combining evolutionary multi-objective and evolutionary multi-task as claimed in claim 1, wherein Migrating the individuals in the second population GPOP to the first population POP to obtain a migrated population, including: Performing fitness evaluation on the second population GPOP on the data sample batchSample, and initializing the set addedSet; For the individuals in the second population GPOP, if there is an individual whose ranking in the second population POP is worse than |POP| / 2, then using the hill climbing search algorithm to update this individual with the learning rate lr, and adding this individual to the set addedSet; Migrating all the individuals in the set addedSet to the first population POP to obtain a migrated population.
4. The optimization method of the detection model combining evolutionary multi-objective and evolutionary multi-task according to claim 2, characterized in that, Evaluating the first population POP on the data sample batchSample, and the first population POP performs offspring mutation operations to obtain a new population TempNewPOP, including: Performing fitness evaluation and sorting on the first population POP on the data sample batchSample; Selecting two parents from the first population POP and performing crossover using the coarse-grained crossover algorithm, and repeating several times to obtain a new population CrossPop; Performing mutation operations on the population CrossPop to obtain the population TempNewPOP.
5. The optimization method of the detection model combining evolutionary multi-objective and evolutionary multi-task according to claim 2, wherein Based on the first population POP and the population TempNewPOP, selecting the best λ individuals from the offspring as the next-generation individuals of the first population POP, including: Performing fitness evaluation and sorting on the population TempNewPOP on the data sample batchSample; Performing selection operations on the first population POP and the population TempNewPOP, and according to the evaluation results of the population TempNewPOP and the evaluation results of the TempNewPOP, selecting the best λ individuals from the offspring as the next-generation individuals of the first population POP.
6. The optimization method of the detection model combining evolutionary multi-objective and evolutionary multi-task as described in claim 4, characterized in that, Selecting two parents from the first population POP and performing crossover using the coarse-grained crossover algorithm, including: Randomly select several crossover starting sites among all individuals in the first population POP, where the distance between the starting sites is greater than or equal to the maximum exchange length max_length; For each starting site, each time a random number len in [0, max_length] is taken, and the area with a length of len starting from the starting point is used as the crossover area; If the random number is greater than the crossover probability Cr, then Uniform crossover is used to perform crossover between the two parents in the crossover area to generate two offspring, and one is randomly selected as the output.
7. A detection model optimization system combining evolutionary multi-objective and evolutionary multi-task, characterized in that, The system includes: The first construction module is used to construct an auxiliary task, which is to optimize the weights in the object detection model based on the hill climbing search algorithm. The object detection model uses a neural network to locate and identify specific things in images or videos. The set model optimization parameters include: the objective function weight set S and the learning rate lr of the hill climbing search algorithm; the population size of the evolutionary multi-objective method is N and the maximum number of iterations is maxEpoch; the neural network topology MOD of the object detection model, the data volume DataSet, and the size batchSize of the batchsample extracted from the DataSet each time; the maximum number of individuals m migrated from the population of the hill climbing search algorithm to the population of the evolutionary multi-objective algorithm; The second construction module is used to construct the main task, which is to optimize and solve the first objective function and the second objective function based on the evolutionary multi-objective method. The first objective function is the classification loss function, and the second objective function is the regression loss function; The model optimization module is used to solve the auxiliary task and the main task, and use the solutions obtained during the search process of the auxiliary task as individuals to migrate to the population of the main task to complete model optimization; The model optimization module includes: The initialization unit initializes the neural network topology MOD and the weight set S respectively to obtain the first population POP and the second population GPOP. Specifically: according to the neural network topology MOD of the object detection model, use the (0, 1) normal distribution to initialize the N individuals of the population to obtain the first population POP; for each element in the weight set S, use the (0, 1) normal distribution to initialize 1 individual according to the neural network topology MOD of the object detection model to obtain a second population GPOP composed of |S| individuals solved by the hill climbing search algorithm; The dictionary initialization unit is used to initialize the dictionary to obtain the historyElites dictionary; The extraction unit is used to extract a data sample batchSample with a size of batchSize from the data set, and place the number corresponding to the data sample batchSample into sample_id; An evaluation unit, configured to evaluate based on the first population POP, and select the best λ individuals from the offspring as the next-generation individuals of the first population POP; A migration unit, configured to migrate the individuals in the second population GPOP to the first population POP to obtain a migrated population; An addition unit, configured to form a dictionary with the best individual in the migrated population and the sample_id of the current generation, and add the dictionary to the historyElites dictionary; A judgment unit, configured to set the population iteration number epochIndex = epochIndex + 1, and judge whether the current population iteration number satisfies epochIndex < maxEpoch, where maxEpoch is the maximum number of iterations; A determination unit, configured to control the action of the dictionary initialization unit when the output result of the judgment unit is yes, and when the output result of the judgment unit is no, use the NSGA-II algorithm to sort the first population POP to obtain a Pareto front and acquire a final solution set.
Citation Information
Patent Citations
Method for partitioning communities in complex dynamic network by virtue of multi-objective local search based on decomposition
CN102413029A
Method for solving emergency scheduling problem by a hybrid multi-objective particle swarm optimization algorithm
CN104392099A