Hyper-parameter optimization method of target detection model for identifying object
The genetic evolutionary calculation method optimizes hyperparameters for deep learning models, addressing the inefficiencies of manual adjustment and environmental changes, enhancing object recognition accuracy in mobile robots.
Patent Information
- Application Number
- CN202310666043.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2024-12-10
AI Technical Summary
Deep learning models for object recognition in mobile robots face challenges due to manual hyperparameter adjustment being time-consuming and labor-intensive, and the inability to adapt to rapid changes in object categories, leading to reduced accuracy when feature data sets change significantly.
A hyperparameter optimization method using a genetic evolutionary calculation method with mutation probability and mean average precision to iteratively adjust hyperparameters, optimizing them for real-time object recognition scenarios through weighted random sampling and genetic variation operations.
Improves object recognition accuracy by automatically adapting the target detection model to changing environments, ensuring high optimization accuracy and wide applicability in limited time.
Smart Images

Figure CN119107478A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of genetic mutation algorithms, and in particular to a hyperparameter optimization method for a target detection model for identifying objects. Background Art
[0002] At present, deep learning algorithms or machine learning models involve a large number of hyperparameters and a large number of uncertain factors. They are different from the parameters (weights) learned during the training process and are usually set manually, adjusted by trial and error, or by enumerating a series of exhaustive parameter combinations. Therefore, manual parameter adjustment is time-consuming and labor-intensive, and is highly random.
[0003] During the process of the mobile robot moving and positioning in an indoor environment, the feature data set annotated for identifying objects in the real-time sampled indoors will change significantly at regular intervals, and the type of objects may also change. For example, the image sampled by the mobile robot may change from one category of target objects to another category of target objects. However, if the existing hyperparameters do not change, the existing hyperparameters become unsuitable for the real-time sampled objects. After the existing hyperparameters are configured in the learning model, they become unsuitable for training the currently annotated feature data set, thereby reducing the accuracy of the mobile robot in identifying objects. Summary of the invention
[0004] In order to solve the above technical problems, the present invention discloses a hyperparameter optimization method for a target detection model for identifying objects. The hyperparameter adjustment method, under a model training state in which a data set of objects labeled in the surrounding environment undergoes a significant change, generates a new generation of hyperparameter vectors by designing a genetic evolutionary calculation method dominated by mutation probability, and a mean average precision used to evaluate recognition ability and changing with each iteration, to iteratively adjust the hyperparameters that are most suitable for the actual recognition scene, so as to improve the object recognition accuracy of the target detection model. The specific technical scheme is as follows: A hyperparameter optimization method for a target detection model for identifying objects, the hyperparameter optimization method comprising: selecting hyperparameter vectors with fitness matching from existing hyperparameter vectors, then performing weighted random sampling in the selected hyperparameter vectors, then configuring the selected hyperparameter vectors as the hyperparameter vectors of the current generation, then performing a preset genetic variation operation on the hyperparameter vectors of the current generation to generate the hyperparameter vectors of the next generation, and saving the hyperparameter vectors of the next generation as a new hyperparameter vector in the existing hyperparameter vectors, iterating in this way until the iteration termination condition is met, and then configuring a hyperparameter vector with the largest fitness as the optimal hyperparameter set of the target detection model; wherein, in the process of performing the weighted random sampling, the greater the fitness corresponding to a hyperparameter vector, the greater the probability that the hyperparameter vector is selected; one hyperparameter vector corresponds to one fitness; wherein, after the optimal hyperparameter set is input into the target detection model, the target detection model uses the optimal hyperparameter set to train the feature data of the object to be identified.
[0005] Furthermore, the hyperparameter optimization method also includes: generating an initialized hyperparameter vector, performing the preset genetic variation operation on the initialized hyperparameter vector, generating a first generation of hyperparameter vectors, adding the variant individual library to become a new hyperparameter vector; wherein the variant individual library is configured to store the newly generated hyperparameter vector starting from the initialized hyperparameter vector, so that the variant individual library is used to store the existing hyperparameter vector.
[0006] Furthermore, the method for selecting hyperparameter vectors with matching fitness from existing hyperparameter vectors includes: controlling the existing hyperparameter vectors to be sorted according to the numerical value of fitness, and then selecting a preset screening number of hyperparameter vectors with relatively large fitness; wherein, when the existing hyperparameter vectors are sorted in order from small to large according to the numerical value of fitness, the preset screening number of hyperparameter vectors with relatively large fitness are the preset screening number of hyperparameter vectors arranged in descending order starting from the hyperparameter vector with the largest sorting; wherein, when the existing hyperparameter vectors are sorted in order from large to small according to the numerical value of fitness, the preset screening number of hyperparameter vectors with relatively large fitness are the first hyperparameter vector to the preset screening number of hyperparameter vectors.
[0007] Furthermore, the method for screening out fitness-matched hyperparameter vectors from existing hyperparameter vectors includes: when it is detected that the number of existing hyperparameter vectors is less than the preset screening number, all existing hyperparameter vectors are configured as the fitness-matched hyperparameter vectors.
[0008] Furthermore, in the process of weighted random sampling of the screened hyperparameter vectors, the probability of each hyperparameter vector being selected is set to be proportional to its corresponding fitness.
[0009] Furthermore, the preset genetic variation operation includes: controlling a hyperparameter vector to be multiplied by a genetic variation ratio, and then configuring the vector obtained by the multiplication as a new hyperparameter vector to achieve evolution from the hyperparameter vector of the current generation to the hyperparameter vector of the next generation; wherein a hyperparameter vector participating in the multiplication operation is configured as a population participating in the current preset genetic variation operation; and the genetic variation ratio belongs to a numerical value.
[0010] Furthermore, the preset genetic variation operation specifically includes: controlling the first random function to generate a first random floating-point number vector, wherein the vector length of the first random floating-point number vector generated by the first random function each time is equal to the number of hyperparameters included in the hyperparameter vector participating in the current preset genetic variation operation; controlling the second random function to generate a second random floating-point number vector, wherein the vector length of the second random floating-point number vector generated by the second random function each time is equal to the number of hyperparameters included in the hyperparameter vector participating in the current preset genetic variation operation; the random floating-point numbers included in the second random floating-point number vector follow a standard normal distribution; comparing the numerical value of each random floating-point number in the first random floating-point number vector with the same mutation probability, and then forming a logical value vector with the comparison results corresponding to each random floating-point number; controlling the first random function to generate a third random floating-point number vector, wherein the third random floating-point number vector generated by the first random function each time has a vector length corresponding to the hyperparameter vector. The vector length is equal to the value 1; the hyperparameter vector, the logical value vector, the second random floating-point number vector, the third random floating-point number vector and the crossover probability participating in the current preset genetic variation operation are controlled to be multiplied in sequence to obtain a first product; the sum of the first product and the value 1 is configured as a pre-genetic variation ratio; the pre-genetic variation ratio is then clipped to a preset numerical range, and the clipped result of the pre-genetic variation ratio is configured as a genetic variation ratio, so that it becomes the genetic variation ratio under the current preset genetic variation operation; then, each hyperparameter in the hyperparameter vector participating in the current preset genetic variation operation is controlled to be multiplied by a genetic variation ratio respectively, and the multiplication results are formed into a vector, and the vector is configured as a new hyperparameter vector, and then it is determined that the preset genetic variation operation is completed once; wherein each hyperparameter contained in the hyperparameter vector belongs to a numerical value; the mutation probability and the crossover probability are both pre-configured probability values.
[0011] Further, the method for clipping the pre-genetic variation ratio to a preset numerical range includes: when the pre-genetic variation ratio is less than or equal to a second boundary value, the second boundary value is configured as the clipping result of the pre-genetic variation ratio, and the second boundary value is configured as the genetic variation ratio; when the pre-genetic variation ratio is greater than or equal to the first boundary value, the first boundary value is configured as the clipping result of the pre-genetic variation ratio, and the first boundary value is configured as the genetic variation ratio; when the pre-genetic variation ratio is greater than the second boundary value and the pre-genetic variation ratio is less than the first boundary value, the pre-genetic variation ratio is within the preset numerical range, the pre-genetic variation ratio is directly configured as the clipping result of the pre-genetic variation ratio, and the pre-genetic variation ratio is configured as the genetic variation ratio; wherein the maximum value of the preset numerical range is the first boundary value, and the minimum value of the preset numerical range is the second boundary value.
[0012] Furthermore, the method of comparing the numerical value of each random floating point number in the first random floating point number vector with the same mutation probability, and then forming a logical value vector with the comparison results corresponding to each random floating point number includes: when a random floating point number in the first random floating point number vector is less than the mutation probability, configuring the comparison result of the random floating point number with the mutation probability as a numerical value of 1, and then configuring the numerical value of 1 at the corresponding index in the logical value vector to indicate that the mutation probability is allowed to exert an influence on the random floating point number; when a random floating point number in the first random floating point number vector is greater than or equal to the mutation probability, configuring the comparison result of the random floating point number with the mutation probability as a numerical value of 0, and then configuring the numerical value of 0 at the corresponding index in the logical value vector to indicate that the mutation probability is prohibited from exerting an influence on the random floating point number; wherein, each random floating point number in the first random floating point number vector is greater than or equal to the numerical value of 0, but each random floating point number in the first random floating point number vector is less than the numerical value of 1.
[0013] Furthermore, the method for calculating the fitness includes: for each hyperparameter vector, setting a first mean average precision and a second mean average precision; multiplying the first preset ratio by the first mean average precision to obtain a first precision product; multiplying the second preset ratio by the second mean average precision to obtain a second precision product; and then configuring the sum of the first precision product and the second precision product as the fitness; wherein the first mean average precision and the second mean average precision are both evaluation indicators of the target detection model, which are used to represent the average accuracy of the target detection model in identifying various types of objects; wherein the standard measurements of accuracy used by the first mean average precision and the second mean average precision are different.
[0014] Furthermore, the situations in which the iteration termination condition is met include: if the current number of iterations reaches a predetermined maximum number of iterations, it is determined that the iteration termination condition is met; or, when the accuracy of the fitness corresponding to a newly generated hyperparameter vector meets the convergence accuracy, it is determined that the iteration termination condition is met.
[0015] Furthermore, if the iteration termination condition is not met, the next iteration is entered; wherein one iteration includes: selecting a hyperparameter vector with fitness matching from the existing hyperparameter vectors, then performing weighted random sampling from the selected hyperparameter vectors, and then configuring a selected hyperparameter vector as a hyperparameter vector of the current generation, and then performing the preset genetic mutation operation on the hyperparameter vector of the current generation to generate a hyperparameter vector of the next generation, and saving the hyperparameter vector of the next generation as a new hyperparameter vector in the existing hyperparameter vectors; wherein after each iteration, the corresponding fitness of the newly added hyperparameter vector is calculated.
[0016] Compared with the prior art, the present invention designs a genetic evolutionary computing method dominated by the judgment results of mutation probability and random numbers, starting from the randomly generated first generation of hyperparameter vectors, the next generation of hyperparameter vectors is generated through iteration, and the value range of the genetic evolution ratio between the hyperparameter vectors of two adjacent generations is limited; each time a new generation of hyperparameter vectors is generated, the mean average precision needs to be calculated to match the precision of the model that generates the new hyperparameter vector, thereby obtaining the fitness for preliminarily screening the hyperparameter vector; wherein, these fitness are also used to be configured as weights before entering the next iteration to perform weighted random sampling on the preliminarily screened hyperparameter vectors, and then a hyperparameter vector sampled by weighted random sampling is input into the genetic evolutionary computing method to obtain the next generation of hyperparameter vectors, which is used to continue to generate the next generation of hyperparameter vectors under the premise that the iteration termination condition is not met, so that the hyperparameter vector is iterated in a more precise optimization direction, the optimization process is more reliable, and the recognition accuracy of the target detection model after configuring the latest obtained hyperparameter vector is improved.
[0017] Therefore, the present invention has the advantages of high optimization accuracy and a wide range of applicability for the adjustment of hyperparameter vectors or hyperparameters. Therefore, in the process of training the labeled feature data of the target detection model, if the scenario of the actual task execution of the target detection model is significantly different from the scenario of the pre-trained model (the set of labeled feature data), the adjustment method of the hyperparameter vector disclosed in the present invention allows the target detection model to automatically adapt to the scenario of the actual task execution and obtain a more accurate object recognition result within a limited time. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A flowchart of a method for optimizing hyperparameters of a target detection model for identifying objects disclosed in an embodiment of the present invention. Implementation
[0019] The technical scheme in the embodiment of the present invention will be described in detail below in conjunction with the accompanying drawings in the embodiment of the present invention. It should be understood that the specific embodiments described below are only used to explain the present invention and are not intended to limit the present invention. In the following description, specific details are given to provide a thorough understanding of the embodiments. However, those of ordinary skill in the art will appreciate that embodiments can be implemented without these specific details.
[0020] As an embodiment, the present invention discloses a hyperparameter optimization method for a target detection model for identifying objects, the hyperparameter optimization method is executed by a chip, which can be a visual chip, used for image recognition, laser scanning modeling or map construction to achieve data processing required for navigation and positioning, then the chip is installed on the system circuit board of a mobile robot in the form of an integrated circuit, the chip controls the mobile robot to perform the corresponding hyperparameter optimization function by cooperating with the transferred software algorithm, then the chip, the software algorithm and the driving components of the mobile robot are constructed into a system supporting the aforementioned hyperparameter optimization method, and the hardware is configured with a corresponding memory and power management system. The target detection model disclosed in the present invention is a machine learning model or a deep learning model that can complete many visual tasks, including instance segmentation, posture estimation, feature tracking and object recognition. These computer vision tasks are widely used in monitoring, autonomous driving, obstacle recognition and visual question answering. In the target detection model, each image (training data set) required for training may have different categories of different targets.
[0021] In this embodiment, the target detection model is built using a chip inside the mobile robot, so that the training environment faced by the target detection model can be an indoor environment area where the mobile robot has actually moved, and is used to identify furniture in the indoor environment to avoid obstacles during navigation.
[0022] Therefore, the selection operations, calculation operations, crossover and mutation operations based on genetic algorithms, operations for configuring component vectors or sets, and iterative loop operations involved in the hyperparameter optimization method disclosed in the present invention are all controlled by the chip, and the hyperparameters generated thereby are ultimately configured into the target detection model, so that the target detection model is trained according to the configured hyperparameters to adjust the recognition accuracy of the feature data of the currently identified object.
[0023] The hyperparameter optimization method includes: selecting a hyperparameter vector with fitness matching from an existing hyperparameter vector, wherein when a hyperparameter vector is equivalent to a hyperparameter set, it belongs to a set of feature data for a specific type of object or a set of feature data of a type of annotation, and there is at least one hyperparameter in the hyperparameter vector, and the hyperparameter is used as a parameter required for the target detection model to perform data training, and supports determination by empirical values. In an embodiment of deep learning, hyperparameters may include learning rate, number of iterations, number of layers, number of neurons in each layer, and the like. When the target detection model is different, the corresponding hyperparameters are also different, such as the depth, number of leaves, and more conventional learning rate in a tree model. In some embodiments, the hyperparameter is a framework parameter in the target detection model, such as the number of classes in a clustering method, or the number of topics in a topic model, and the like.
[0024] Then, weighted random sampling is performed in the aforementioned selected hyperparameter vectors, wherein the weighted random sampling is essentially a kind of random sampling, and the result of random sampling in the selected hyperparameter vectors is affected by the weight size assigned to each hyperparameter vector. Specifically, in the process of the chip performing the weighted random sampling, the greater the fitness corresponding to a hyperparameter vector, the greater the probability that the hyperparameter vector is selected.
[0025] Then, the hyperparameter vector selected by the aforementioned weighted random sampling is configured as the hyperparameter vector of the current generation. In this embodiment, only one hyperparameter vector is selected by the weighted random sampling each time, but the weight corresponding to the selected hyperparameter vector is not necessarily the largest. Then, a preset genetic mutation operation is performed on the hyperparameter vector of the current generation to generate a hyperparameter vector of the next generation, that is, a new hyperparameter vector is generated, and the hyperparameter vector of the next generation is saved as a new hyperparameter vector in the existing hyperparameter vectors, that is, the hyperparameter vector of the next generation generated each time is added to the same combination, and this combination is composed of all the existing hyperparameter vectors, and a new generation of hyperparameter vectors is generated in this iteration until the iteration termination condition is met, and then the hyperparameter vector with the largest fitness is configured as the The optimal hyperparameter set of the target detection model, wherein a hyperparameter vector corresponds to a fitness, and the two are in a one-to-one correspondence, but there is no conversion relationship or function mapping relationship between the numerical values of the two, and they can be calculated in the same iteration. Therefore, each time a new hyperparameter vector is generated, a fitness is calculated; the fitness is used to evaluate the recognition accuracy of the target detection model under the hyperparameter vector, so as to screen out a suitable hyperparameter vector as the optimal hyperparameter set (the set is represented by a vector in data operations); after the optimal hyperparameter set is input into the target detection model in this embodiment, the target detection model uses the optimal hyperparameter set to train the feature data of the object to be recognized, thereby improving the recognition accuracy of the target detection model compared to the hyperparameters of the aforementioned hyperparameter optimization method that are not executed.
[0026] In summary, the present invention has the advantages of high optimization accuracy and a wide range of applicability for the adjustment of hyperparameter vectors or hyperparameters. Therefore, in the process of training the labeled feature data of the target detection model, if the actual task execution scenario of the target detection model is significantly different from the pre-trained model scenario (the set of labeled feature data), the adjustment method of the hyperparameter vector disclosed in the present invention allows the target detection model to automatically adapt to the actual task execution scenario, thereby achieving more accurate object recognition results within a limited time.
[0027] In this embodiment, the preset genetic mutation operation is an improvement on the crossover and mutation operations in the genetic algorithm, so that the preset genetic mutation operation becomes a genetic algorithm dominated by the mutation operation, that is, an improved genetic algorithm; in this embodiment, the hyperparameter vector corresponds to the population in the genetic algorithm, and each hyperparameter in the hyperparameter vector corresponds to an individual in each population.
[0028] It should be noted that the genetic algorithm simulates the parameter optimization process into a biological evolution process, which is also a computational process that simulates the natural selection process in the biological world and is often used to search for the optimal solution. The next generation of solutions is generated through operations such as replication, crossover, and mutation, and solutions with low fitness function values are gradually eliminated, and solutions with high fitness function values are increased. In this way, after N generations of evolution, it is very likely that individuals with high fitness function values will evolve; among them, the genetic algorithm represents part or all of the solutions to an optimization problem with individuals, and defines a fitness function to measure the pros and cons of each individual. The algorithm starts with an initial group composed of several individuals, and evolves for several generations. In each generation, the three operators of selection, crossover, and mutation are applied to continuously optimize the fitness of individuals and groups, and finally obtain an approximate optimal solution to the problem. The aforementioned fitness is represented by the fitness function in the genetic algorithm. The fitness function is also called the evaluation function, which is used to distinguish the standard of good and bad individuals in the group; the fitness function is always non-negative, and the fitness is a non-negative number.
[0029] As an example, Figure 1 As shown, the hyperparameter optimization method specifically includes: Step S101, generating an initialized hyperparameter vector, wherein the initialized hyperparameter vector is randomly generated by the chip, and can be performed based on the principle of generating the initialized population by the genetic algorithm, so as to determine the starting point of the hyperparameter adjustment in the hyperparameter optimization method; then performing a preset genetic variation operation on the initialized hyperparameter vector to generate a first-generation hyperparameter vector, and then adding this hyperparameter vector to the variant individual library to become a new hyperparameter vector; then proceeding to step S102. Wherein, each hyperparameter value in the hyperparameter vector has an upper limit and a lower limit, which are preset.
[0030] It should be noted that the variant individual library is configured to store the newly generated hyperparameter vector starting from the initialized hyperparameter vector, so that the variant individual library is used to store the existing hyperparameter vector, wherein the existing hyperparameter vector includes the initialized hyperparameter vector; therefore, whenever a new hyperparameter vector is generated, the hyperparameter vector is stored in the variant individual library. In this embodiment, the variant individual library supports continuous reception of newly generated hyperparameter vectors, and serves as a storage space for recording all generated hyperparameter vectors, and the corresponding fitness will not be lost because some hyperparameter vectors in the variant individual library are screened out. The variant individual library is a storage space opened up in advance, which can be inside the chip or a memory of the chip peripheral.
[0031] Step S102, filter out fitness-matched hyperparameter vectors from the existing hyperparameter vectors, and then proceed to step S103. Among them, there is at least one hyperparameter vector in the existing hyperparameter vectors; there are multiple hyperparameter vectors in the fitness-matched hyperparameter vectors, and preferably, the number of fitness-matched hyperparameter vectors is 5. Among them, the issuer of the screening action of step S102 is the chip. Specifically, the method for filtering out fitness-matched hyperparameter vectors from the existing hyperparameter vectors includes: sorting the existing hyperparameter vectors according to the numerical value of the fitness, filtering out a preset number of hyperparameter vectors with relatively large fitness, corresponding to selecting a preset number of hyperparameter vectors with the largest fitness in a group of hyperparameter vectors as fitness-matched hyperparameter vectors, and when the preset screening number is a value of 5, selecting 5 hyperparameter vectors with the largest fitness.
[0032] As an implementation method of step S102, when the existing hyperparameter vectors (understood as the hyperparameter vectors in the variant individual library) are sorted in order from small to large according to the fitness values, the preset screening number of hyperparameter vectors with relatively large fitness are sorted in descending order starting from the hyperparameter vector with the largest sorting value, that is, when the hyperparameter vectors are arranged in ascending order according to the fitness values, starting from the hyperparameter vector with the largest fitness, the preset screening number of hyperparameter vectors are continuously screened in descending order, including the aforementioned hyperparameter vector with the largest fitness; preferably, the preset screening number is set to a value of 5, then the preset screening number of hyperparameter vectors with relatively large fitness are selected from the existing hyperparameter vectors after sorting, starting from the hyperparameter vector with the largest sequence number, and 5 hyperparameter vectors in continuous descending order; in some possible sortings, there are two hyperparameter vectors with equal fitness among the screened hyperparameter vectors.
[0033] As another implementation of step S102, when the existing hyperparameter vectors (understood as the hyperparameter vectors in the mutant individual library) are sorted in order from large to small according to the numerical values of fitness, the preset screening number of hyperparameter vectors with relatively large fitness are respectively the first hyperparameter vector to the preset screening number of hyperparameter vectors, that is, when the hyperparameter vectors are arranged in descending order according to the numerical values of fitness, starting from the hyperparameter vector with the largest fitness, the preset screening number of hyperparameter vectors are continuously screened in ascending order, including the aforementioned hyperparameter vector with the largest fitness; preferably, the preset screening number is set to a value of 5, then the preset screening number of hyperparameter vectors with relatively large fitness are the existing hyperparameter vectors after sorting, starting from the hyperparameter vector with the smallest sequence number, and 5 hyperparameter vectors in continuous ascending order are selected; in some possible sortings, there are two hyperparameter vectors with equal fitness among the screened hyperparameter vectors.
[0034] As another implementation of step S102, the method for screening out fitness-matching hyperparameter vectors from existing hyperparameter vectors includes: when it is detected that the number of existing hyperparameter vectors is less than the preset screening number, all existing hyperparameter vectors are configured as fitness-matching hyperparameter vectors, that is, all hyperparameter vectors in the variant individual library are screened out as the screened fitness-matching hyperparameter vectors.
[0035] Step S103, weighted random sampling is performed on the hyperparameter vectors screened out in step S102, and the selected hyperparameter vector is configured as the hyperparameter vector of the current generation, where the hyperparameter vector of the current generation is a hyperparameter vector obtained by random sampling based on the fitness corresponding to the hyperparameter vector screened out in step S102; the preset genetic variation operation is then performed on the hyperparameter vector of the current generation to generate a hyperparameter vector of the next generation, and the hyperparameter vector of the next generation is saved as a new hyperparameter vector in the existing hyperparameter vectors, and then the process proceeds to step S104. In step S103, the execution subject of the weighted random sampling of multiple hyperparameter vectors, the configuration of the hyperparameter vector of the current generation (the hyperparameter vector of the parent generation), and the preset genetic variation operation on the hyperparameter vector are all the chips.
[0036] Step S104, determine whether the iteration termination condition is met, if yes, proceed to step S105, otherwise return to step S102 to start the next iteration, and determine that one iteration is completed after returning to step S102. Among them, the execution subject of step S104 is the chip; in step S103, the next generation of hyperparameter vectors are stored in the variant individual library, and the calculation of the corresponding fitness can be selected in the next iteration.
[0037] Step S105: Among the existing hyperparameter vectors, the chip configures a hyperparameter vector with the largest fitness as the optimal hyperparameter set of the target detection model; that is, after the chip calculates the fitness corresponding to the newly added hyperparameter vector, the chip selects a hyperparameter vector with the largest fitness from the existing hyperparameter vectors as the optimal hyperparameter vector; it can be that the fitness corresponding to the newly added hyperparameter vector is calculated among the existing hyperparameter vectors, and then sorted according to the numerical value of the fitness, and then the hyperparameter vector with the largest fitness is directly configured as the optimal hyperparameter set.
[0038] In this embodiment, the fitness of the hyperparameter vector that can be stored in the variant individual library is generally greater than the fitness corresponding to the hyperparameter vector of the previous generation. Thus, by executing the aforementioned steps S101 to S105, the hyperparameter vectors with smaller fitness are eliminated, and the hyperparameter vectors with higher fitness are continuously generated, so that the hyperparameter vector newly added to the variant individual library is iterated in a more precise optimization direction, making the optimization process more reliable, so that the object recognition accuracy of the target detection model after configuring the latest hyperparameter vector is improved.
[0039] Preferably, in the process of weighted random sampling of the screened hyperparameter vectors, the probability of each hyperparameter vector being selected is set to be proportional to its corresponding fitness, so that it is easier to sample a hyperparameter vector with relatively large fitness from the screened hyperparameter vectors, but it is not necessarily necessary to sample the hyperparameter vector with the largest fitness from the hyperparameter vectors screened in step S102 every time. The fitness corresponding to the hyperparameter vector is configured as the sampling weight of the hyperparameter vector in the screened hyperparameter vectors, forming a random sampling strategy selected in proportion. In some embodiments, the fitness corresponding to the hyperparameter vector is equal to the selection probability of the hyperparameter vector in the preset number of hyperparameter vectors screened in step S102. It should be noted that all the hyperparameter vectors screened out in step S102 can be regarded as a sample set. In this sample set, each sample in the sample set (i.e., each hyperparameter vector) is attached with a weight greater than 0, corresponding to a fitness corresponding to the hyperparameter vector. The probability of each sample being selected is determined by the fitness, so that in the process of weighted random sampling, the hyperparameter vector with relatively large fitness is easily extracted as the hyperparameter vector of the current generation, which can be understood as the hyperparameter vector of the parent generation, so as to realize the use of the hyperparameter vector with relatively large fitness to generate the hyperparameter vector of the next generation in the preset genetic variation operation.
[0040] As an embodiment, the fitness calculation method includes: for each hyperparameter vector, the chip sets a first mean average precision and a second mean average precision, then a hyperparameter vector matches a first mean average precision and a second mean average precision, the first mean average precision and the second mean average precision are both evaluation indicators of the target detection model, used to represent the average accuracy of the target detection model in identifying various types of objects, wherein the first mean average precision and the second mean average precision use different standard metrics of accuracy. In this embodiment, in order to calculate the fitness corresponding to a hyperparameter vector, the first preset ratio is multiplied by the first mean average precision to obtain a first precision product; at the same time, the second preset ratio is multiplied by the second mean average precision to obtain a second precision product; then the sum of the first precision product and the second precision product is configured as the fitness, which is used to describe the recognition effect of the target detection model on the object to be recognized under the corresponding hyperparameter vector. Preferably, the first preset ratio is set to 0.1, and the second preset ratio is set to 0.9.
[0041] It should be noted that in each iteration, the changes in the evaluation indicators such as the accuracy, recall rate, first mean average precision, and second mean average precision of the target detection model must also be taken into account. The modified evaluation indicators can be used to determine the convergence effect on the target detection model, so as to select a better hyperparameter vector based on the corresponding evaluation indicators to start the formal training of the target detection model. In this embodiment, in order to use a single numerical value to represent the object recognition accuracy of a target detection model under the hyperparameter vector (a metric to unify them), the average value of the average precision values of all categories of features is taken, that is, the mean average precision, to cope with the different targets of different categories that the target detection model needs to identify, and is used to configure the classification of the objects to be identified and the classification of the framed features. The fitness effectively describes the accuracy of the target detection model in identifying various types of objects and various feature areas in the traversed image. Among them, the accuracy rate indicates the percentage of the number of correctly identified objects that meet the requirements to the total number of identified objects; the recall rate indicates the percentage of the number of correctly identified objects that meet the requirements to the total number of objects in the test set; the effect of the first mean average precision and the second mean average precision on feature recognition is the accuracy of the object recognition box for the specific category marked in the data set. Specifically, during the training process of the target detection model, the overlap between the predicted box used to identify the target object and the real box surrounding the target object is configured as the box overlap; a specific value of the box overlap is equal to the first mean average precision. The box overlap of the preset average value corresponds to the average accuracy of the second mean; wherein the preset average value is an average value including a specific value and multiple values greater than the specific value; the multiple values greater than the specific value are: starting from the specific value, obtained by increasing according to a predetermined increment value until increasing to a preset maximum value, wherein the specific value and the multiple values greater than the specific value constitute an increasing sequence, and a value obtained by each increment constitutes a value in the increasing sequence. For the increasing sequence, if from the second item of the increasing sequence, the value of each item is not less than the value of the previous item.
[0042] As an embodiment, the preset genetic variation operation includes the chip controlling a hyperparameter vector to multiply a genetic variation ratio, and then configuring the vector obtained by the multiplication as a new hyperparameter vector to achieve the evolution from the current generation of hyperparameter vectors to the next generation of hyperparameter vectors, wherein a hyperparameter vector participating in the multiplication operation is configured as a population participating in the current preset genetic variation operation, and the genetic variation ratio belongs to a numerical value, then the product of a hyperparameter vector and a genetic variation ratio is still a vector, which can be used as a new hyperparameter vector. Specifically, the preset genetic variation operation specifically includes: the chip controls the first random function to generate a first random floating point vector, wherein the vector length of the first random floating point vector generated by the first random function each time is equal to the number of hyperparameters contained in the hyperparameter vector participating in the current preset genetic variation operation; each first random floating point number contained in the first random floating point vector is greater than or equal to 0, but less than 1; in this embodiment, the first random floating point number is configured to compare the size with the mutation probability. Among them, the random floating point numbers in the first random floating point vector do not follow any data distribution and are pseudo-random numbers. The chip controls the second random function to generate a second random floating point vector, wherein the vector length of the second random floating point vector generated by the second random function each time is equal to the number of hyperparameters included in the hyperparameter vector participating in the current preset genetic variation operation; the random floating point numbers included in the second random floating point vector follow the standard normal distribution; in some embodiments, the first random function is executed by a random number generator built into the chip and generates the first random floating point vector, and the second random function is executed by a random number generator built into the chip and generates the second random floating point vector. The chip compares the numerical value of each random floating point number in the first random floating point vector with the same mutation probability to determine whether each random floating point number in the first random floating point vector needs to mutate. Only after controlling the influence of the mutation probability can the convergence speed trend of the hyperparameter vector generated by subsequent calculations be grasped, and on this basis, the comparison results corresponding to each random floating point number are formed into a logical value vector, and the mutation probability is configured to be dominant in the preset genetic variation operation. The chip also controls the first random function to generate a third random floating point number vector, wherein the vector length of the third random floating point number vector generated by the first random function each time is equal to the value 1. A random floating point number included in the third random floating point number vector is used to influence the crossover probability, which is weaker than the role played by the mutation probability in the preset genetic mutation operation.The chip controls the hyperparameter vector, the logic value vector, the second random floating point vector, the third random floating point vector and the crossover probability that participate in the current preset genetic variation operation to be multiplied in sequence to obtain a first product; then the sum of the first product and the value 1 is configured as the pre-genetic variation ratio; then the pre-genetic variation ratio is clipped to a preset numerical range, and then the clipping result of the pre-genetic variation ratio is configured as the genetic variation ratio, that is, the pre-genetic variation ratio is valued within the preset numerical range, and the value obtained is the genetic variation ratio, making it the genetic variation ratio under the current preset genetic variation operation. Then, the chip controls each hyperparameter in the hyperparameter vector that participates in the current preset genetic variation operation to be multiplied by a genetic variation ratio, and then the multiplication results are formed into a vector, and then the vector is configured as a new hyperparameter vector, that is, the hyperparameter vector of the next generation, and then it is determined that the preset genetic variation operation is completed once; wherein, each hyperparameter contained in the hyperparameter vector belongs to a numerical value; the mutation probability and the crossover probability are both pre-configured probability values.
[0043] In the above embodiment, the method of clipping the pre-genetic variation ratio to a preset numerical range includes: when the pre-genetic variation ratio is less than or equal to the second boundary value, the second boundary value is configured as the clipping result of the pre-genetic variation ratio, and the second boundary value is configured as the genetic variation ratio; when the pre-genetic variation ratio is greater than or equal to the first boundary value, the first boundary value is configured as the clipping result of the pre-genetic variation ratio, and the first boundary value is configured as the genetic variation ratio; when the pre-genetic variation ratio is greater than the second boundary value and the pre-genetic variation ratio is less than the first boundary value, the pre-genetic variation ratio is within the preset numerical range, the pre-genetic variation ratio is directly configured as the clipping result of the pre-genetic variation ratio, and the pre-genetic variation ratio is configured as the genetic variation ratio; wherein the maximum value of the preset numerical range is the first boundary value, and the minimum value of the preset numerical range is the second boundary value; the first boundary value is preferably 0.3, and the second boundary value is preferably 3. This ensures that the pre-genetic variation ratio is kept within the given interval limit in each iteration.
[0044] In the embodiment corresponding to the aforementioned preset genetic mutation operation, the method of comparing the numerical value of each random floating point number in the first random floating point number vector with the same mutation probability, and then forming a logical value vector with the comparison results corresponding to each random floating point number includes: when a random floating point number in the first random floating point number vector is less than the mutation probability, configuring the comparison result of the random floating point number with the mutation probability as a numerical value of 1, and then configuring the numerical value of 1 at the corresponding index in the logical value vector to indicate that the mutation probability is allowed to exert an influence on the random floating point number; when a random floating point number in the first random floating point number vector is greater than or equal to the mutation probability, configuring the comparison result of the random floating point number with the mutation probability as a numerical value of 0, and then configuring the numerical value of 0 at the corresponding index in the logical value vector to indicate that the mutation probability is prohibited from exerting an influence on the random floating point number; wherein, each random floating point number in the first random floating point number vector is greater than or equal to the numerical value of 0, but each random floating point number in the first random floating point number vector is less than the numerical value of 1.
[0045] In the aforementioned embodiment, the situation where the iteration termination condition is met includes: if the chip detects that the current number of iterations reaches a predetermined maximum number of iterations, it is determined that the iteration termination condition is met, wherein the predetermined maximum number of iterations is pre-set and is fixed before the aforementioned optimal hyperparameter set is obtained. Alternatively, when the accuracy of the fitness corresponding to a hyperparameter vector newly generated by the chip meets the convergence accuracy, it is determined that the iteration termination condition is met; wherein the accuracy of the fitness can be defined or converted into the accuracy of the mantissa bits and the accuracy of the exponent bits. When the accuracy of the fitness corresponding to a hyperparameter vector meets the convergence accuracy, it can be said that the fitness corresponding to the hyperparameter vector is equal to a preset threshold; it can also be said that the accuracy of the fitness corresponding to the hyperparameter vector is equal to the convergence accuracy for the first time, at which time the fitness is not a fixed value.
[0046] On the basis of the above embodiment, if the chip detects that the iteration termination condition is not met, it enters the next iteration, corresponding to returning from step S104 to step S102, and also determines that the current iteration is completed. Among them, one iteration includes: selecting a hyperparameter vector with fitness matching from the existing hyperparameter vector, corresponding to step S102; then performing weighted random sampling on the selected hyperparameter vector, and then configuring a selected hyperparameter vector as the hyperparameter vector of the current generation, and then performing the preset genetic variation operation on the hyperparameter vector of the current generation to generate the next generation of hyperparameter vectors, and saving the next generation of hyperparameter vectors as a new hyperparameter vector in the existing hyperparameter vectors, corresponding to step S103. Among them, after each iteration, the corresponding fitness of the newly added hyperparameter vector is calculated. Specifically, when step S104 determines that the iteration termination condition is not met, in the next iteration, the corresponding fitness of the newly added hyperparameter vector is calculated, so that the chip can select the hyperparameter vector with fitness matching in step S102. When step S104 determines that the iteration termination condition is met, the corresponding fitness of the newly added hyperparameter vector is calculated so that the chip selects a hyperparameter vector with the largest fitness from the existing hyperparameter vectors and configures it as the optimal hyperparameter set of the target detection model.
[0047] Those skilled in the art will appreciate that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. These programs can be stored in a computer-readable storage medium (such as ROM, RAM, magnetic disk or optical disk, etc., which can store program codes). When the program is executed, the steps of the above-mentioned method embodiments are executed.
[0048] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. Hyperparameter optimization methods for target detection models used to identify objects, It is characterized in that The hyperparameter optimization method includes: A hyperparameter vector with fitness matching is screened out from the existing hyperparameter vectors, and then a weighted random sampling is performed in the screened hyperparameter vectors, and then the selected hyperparameter vector is configured as the hyperparameter vector of the current generation, and then a preset genetic mutation operation is performed on the hyperparameter vector of the current generation to generate a hyperparameter vector of the next generation, and the hyperparameter vector of the next generation is saved as a new hyperparameter vector in the existing hyperparameter vectors, and iterates in this way until the iteration termination condition is met, and then a hyperparameter vector with the largest fitness is configured as the optimal hyperparameter set of the target detection model; Wherein, in the process of performing the weighted random sampling, when the fitness corresponding to a hyperparameter vector is greater, the probability that the hyperparameter vector is selected is greater; a hyperparameter vector corresponds to a fitness; After the optimal hyperparameter set is input into the target detection model, the target detection model uses the optimal hyperparameter set to train feature data of the object to be identified.
2. According to the hyperparameter optimization method of claim 1, It is characterized in that The hyperparameter optimization method further includes: Generate an initialized hyperparameter vector, perform the preset genetic variation operation on the initialized hyperparameter vector, generate a first-generation hyperparameter vector, and then add the first-generation hyperparameter vector to the variant individual library to become a new hyperparameter vector; The variant individual library is configured to store newly generated hyperparameter vectors starting from the initialized hyperparameter vectors, so that the variant individual library is used to store the existing hyperparameter vectors.
3. According to the hyperparameter optimization method of claim 2, It is characterized in that The method for selecting a hyperparameter vector with fitness matching from existing hyperparameter vectors includes: Control the existing hyperparameter vectors to be sorted according to the numerical value of fitness, and then select a preset number of hyperparameter vectors with relatively large fitness; When the existing hyperparameter vectors are sorted in ascending order according to the values of fitness, the preset number of hyperparameter vectors with relatively large fitness are the preset number of hyperparameter vectors arranged in descending order starting from the largest hyperparameter vector; Among them, when the existing hyperparameter vectors are sorted in descending order according to the fitness values, the preset screening number of hyperparameter vectors with relatively large fitness are the first hyperparameter vector to the preset screening number of hyperparameter vectors.
4. According to the hyperparameter optimization method of claim 3, It is characterized in that The method for selecting a hyperparameter vector with fitness matching from existing hyperparameter vectors includes: When it is detected that the number of existing hyperparameter vectors is less than the preset screening number, all existing hyperparameter vectors are configured as hyperparameter vectors with fitness matching.
5. According to the hyperparameter optimization method of claim 2, It is characterized in that In the process of weighted random sampling of the screened hyperparameter vectors, the probability of each hyperparameter vector being selected is set to be proportional to its corresponding fitness.
6. According to the hyperparameter optimization method of claim 2, It is characterized in that The preset genetic variation operation includes: Control a hyperparameter vector to multiply a genetic variation ratio, and then configure the multiplied vector as a new hyperparameter vector to achieve evolution from the hyperparameter vector of the current generation to the hyperparameter vector of the next generation; Among them, a hyperparameter vector involved in the multiplication operation is configured as a population participating in the current preset genetic variation operation; the genetic variation ratio is a numerical value.
7. The hyperparameter optimization method according to claim 6, It is characterized in that The preset genetic variation operation specifically includes: Controlling the first random function to generate a first random floating point number vector, wherein the vector length of the first random floating point number vector generated each time by the first random function is equal to the number of hyperparameters included in the hyperparameter vector participating in the current preset genetic variation operation; Controlling the second random function to generate a second random floating point number vector, wherein the vector length of the second random floating point number vector generated by the second random function each time is equal to the number of hyperparameters included in the hyperparameter vector participating in the current preset genetic variation operation; the random floating point numbers included in the second random floating point number vector follow a standard normal distribution; Compare the numerical values of each random floating point number in the first random floating point number vector with the same mutation probability, and then form a logical value vector with the comparison results corresponding to each random floating point number; Controlling the first random function to generate a third random floating point number vector, wherein the vector length of the third random floating point number vector generated by the first random function each time is equal to the value 1; Control the hyperparameter vector, the logic value vector, the second random floating point number vector, the third random floating point number vector and the crossover probability involved in the current preset genetic variation operation to be multiplied in sequence to obtain a first product; then configure the sum of the first product and the value 1 as the pre-genetic variation ratio; Then the pre-genetic variation ratio is clipped to a preset value range, and the clipping result of the pre-genetic variation ratio is configured as a genetic variation ratio, so that it becomes the genetic variation ratio under the current preset genetic variation operation; Then, each hyperparameter in the hyperparameter vector participating in the current preset genetic variation operation is controlled to be multiplied by a genetic variation ratio, and the multiplication results are formed into a vector, and the vector is configured as a new hyperparameter vector, and it is determined that the preset genetic variation operation is completed once; Each hyperparameter contained in the hyperparameter vector is a numerical value; the mutation probability and crossover probability are both pre-configured probability values.
8. According to the hyperparameter optimization method of claim 7, It is characterized in that The method of clipping the predicted genetic variation ratio to a preset value range includes: When the pre-genetic variation ratio is less than or equal to the second boundary value, the second boundary value is configured as a clipping result of the pre-genetic variation ratio, and the second boundary value is configured as the genetic variation ratio; When the pre-genetic variation ratio is greater than or equal to the first boundary value, the first boundary value is configured as a clipping result of the pre-genetic variation ratio, and the first boundary value is configured as the genetic variation ratio; When the pre-genetic variation ratio is greater than the second boundary value, and the pre-genetic variation ratio is less than the first boundary value, the pre-genetic variation ratio is within the preset value range, the pre-genetic variation ratio is directly configured as the clipping result of the pre-genetic variation ratio, and the pre-genetic variation ratio is configured as the genetic variation ratio; The maximum value of the preset numerical range is a first boundary value, and the minimum value of the preset numerical range is a second boundary value.
9. The hyperparameter optimization method according to claim 7, It is characterized in that The method of comparing the numerical values of each random floating point number in the first random floating point number vector with the same mutation probability, and then forming a logical value vector with the comparison results corresponding to each random floating point number comprises: When a random floating point number in the first random floating point number vector is less than the mutation probability, a comparison result between the random floating point number and the mutation probability is configured as a value of 1, and then a value of 1 is configured at the corresponding index in the logic value vector to indicate that the mutation probability is allowed to affect the random floating point number; When a random floating point number in the first random floating point number vector is greater than or equal to the mutation probability, a comparison result between the random floating point number and the mutation probability is configured as a value of 0, and then a value of 0 is configured at the corresponding index in the logic value vector to indicate that the mutation probability is prohibited from affecting the random floating point number; Each random floating point number in the first random floating point number vector is greater than or equal to the value 0, but each random floating point number in the first random floating point number vector is less than the value 1.
10. The hyperparameter optimization method according to claim 2 or 5, It is characterized in that The fitness calculation method includes: For each hyperparameter vector, the first mean average precision and the second mean average precision are set; Multiplying the first preset ratio by the first mean average precision to obtain a first precision product; Multiplying the second preset ratio by the second mean average precision to obtain a second precision product; Then configuring the sum of the first precision product and the second precision product as the fitness; The first mean average precision and the second mean average precision are both evaluation indicators of the target detection model, and are used to indicate the average accuracy of the target detection model in identifying various types of objects; The first mean average precision and the second mean average precision use different standard measures of precision.
11. The hyperparameter optimization method according to claim 1, It is characterized in that The situations that meet the iteration termination conditions include: If the current number of iterations reaches a predetermined maximum number of iterations, it is determined that the iteration termination condition is met; or, when the accuracy of the fitness corresponding to a newly generated hyperparameter vector meets the convergence accuracy, it is determined that the iteration termination condition is met.
12. The hyperparameter optimization method according to claim 1 or 11, It is characterized in that If the iteration termination condition is not met, the next iteration is entered; Among them, one iteration includes: selecting a hyperparameter vector with fitness matching from the existing hyperparameter vectors, then performing weighted random sampling in the selected hyperparameter vectors, then configuring a selected hyperparameter vector as a hyperparameter vector of the current generation, then performing the preset genetic mutation operation on the hyperparameter vector of the current generation to generate a hyperparameter vector of the next generation, and saving the hyperparameter vector of the next generation as a new hyperparameter vector in the existing hyperparameter vectors; After each iteration, the corresponding fitness is calculated for the newly added hyperparameter vector.
Citation Information
Patent Citations
A spatio-temporal prediction model parameter optimization method for infrastructure network
CN109242142A
User classification model determination method, apparatus and device, and storage medium
CN111612528A
Tuning hyper-parameters of a computer-executable learning algorithm
US20140344193A1
Hyperparameter optimization method and apparatus
US20200057944A1
