An Object Detection Method and System Integrating Grey Wolf Strategy and Whale Algorithm
The Grey Wolf and Whale Optimization Algorithm hybrid approach iteratively trains target detection model parameters to address the challenges of small target detection in autonomous driving, enhancing accuracy and reliability.
Patent Information
- Application Number
- CN202310216918.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-02
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2043-03-02
AI Technical Summary
The existing target detection model has low accuracy when detecting small targets, and manual parameters are time-consuming and cannot meet specific application needs, which affects the safety and reliability of autonomous driving.
Fusion of gray wolf strategy and whale algorithm, controlling the execution probability of predation strategy through scaling factors and population concentration, training and iterating the parameters of the target detection model, and optimizing the parameter combination of the detection model.
The detection capability of the target detection model, especially the detection capability of small targets, provides higher accuracy and reliability for autonomous driving.
Smart Images

Figure CN116453076B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and particularly relates to an object detection method and system integrating grey wolf strategy and whale algorithm. Background Technique
[0002] The statements in this part only provide background technical information related to the present invention, and do not necessarily constitute prior art.
[0003] Autonomous driving technology is one of the fields that have attracted much attention in recent years. Among them, object detection technology is an important part of realizing autonomous driving. Object detection technology aims to enable a computer to automatically identify objects in images or videos and classify them into different categories (such as pedestrians, vehicles, traffic signs, etc.). The development of object detection technology can help autonomous vehicles better perceive the surrounding environment and thus make more accurate driving decisions. Detecting small objects is a common problem. The definition of small objects varies depending on the application scenario, but generally refers to objects with relatively small sizes and occupying a small proportion in the image, such as pedestrians, bicycles, traffic signs, etc. The problems encountered when detecting small objects mainly include the following aspects: unclear features, insufficient resolution, and occlusion problems.
[0004] Many existing researchers use default parameters or adjust the parameters of the object detection model manually. Using default parameters or manual parameter adjustment may result in a low accuracy rate of the object detection model in some scenarios, thus misdetecting or missing target objects, which affects the safety and reliability of autonomous driving. At the same time, default parameters or manual adjustment may not meet specific application requirements, such as detecting specific types of target objects, achieving specific accuracy rates, etc., resulting in the model not meeting the actual application requirements. And manual parameter adjustment requires a lot of time and effort and may not consider all parameter combinations and scenarios, resulting in poor performance of the object detection model. Summary of the Invention
[0005] To solve the technical problems existing in the above background technique, the present invention provides an object detection method and system integrating grey wolf strategy and whale algorithm. By integrating the grey wolf strategy and whale algorithm, the parameters of the object detection model are trained iteratively, improving the detection ability of the object detection model, especially the detection ability of small objects.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] The first aspect of the present invention provides an object detection method integrating grey wolf strategy and whale algorithm, which includes:
[0008] Obtain the image to be detected;
[0009] Based on the image to be detected, an optimal object detection model is used to obtain the objects in the image to be detected;
[0010] Among them, the optimal object detection model is obtained by training and iterating the parameters of the object detection model using an algorithm that combines the gray wolf strategy and whale predation; the algorithm that combines the gray wolf strategy and whale predation controls the execution probabilities of the whale spiral predation strategy, gray wolf predation strategy, and random walk strategy based on the scaling factor and population concentration, and updates the positions of each individual; the scaling factor is related to the ratio of the optimal fitness of two adjacent cycles; the population concentration is related to the sum of the fitnesses of all individuals.
[0011] Furthermore, the fitness of the algorithm that combines the gray wolf strategy and whale predation is calculated using a comprehensive performance evaluation function;
[0012] The comprehensive performance evaluation function combines the average correct rate, precision, and recall rate of all category detections.
[0013] Furthermore, after several cycles, the scaling factor is calculated using the following formula:
[0014]
[0015] Among them, t represents the t-th cycle, T represents the total number of cycle times, represents the optimal fitness of the t-th cycle.
[0016] Furthermore, within several cycles, the scaling factor adopts a set fixed value.
[0017] Furthermore, the population concentration in the t-th cycle is: the ratio of the product of the number of individuals in the population and the optimal fitness of the (t - 1)-th cycle to the sum of the fitnesses of all individuals in the (t - 1)-th cycle.
[0018] Furthermore, the gray wolf predation strategy performs weighted processing on the guiding vectors of the lead wolf and local minimum according to the fitness values of the guiding vectors of the lead wolf and local minimum, and obtains the position of the updated individual.
[0019] Furthermore, the parameters of the object detection model include: initial learning rate, final learning rate, momentum, weight decay, number of warm-up cycles, warm-up momentum, warm-up initial offset learning rate, box loss coefficient, classification loss coefficient, classification loss positive weight, object loss coefficient, and object loss positive weight.
[0020] The second aspect of the present invention provides an object detection system that combines the gray wolf strategy and whale algorithm, which includes:
[0021] An image acquisition module, which is configured to: acquire the image to be detected;
[0022] A target detection module, which is configured to: based on an image to be detected, use an optimal target detection model to obtain targets in the image to be detected;
[0023] Wherein, the optimal target detection model is obtained by training and iterating the parameters of the target detection model using an algorithm that combines the gray wolf strategy and whale predation; the algorithm that combines the gray wolf strategy and whale predation controls the execution probabilities of the whale spiral predation strategy, gray wolf predation strategy, and random walk strategy based on a scaling factor and population concentration, and updates the position of each individual; the scaling factor is related to the ratio of the optimal fitness of two adjacent cycles; the population concentration is related to the sum of the fitnesses of all individuals.
[0024] A third aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, it implements the steps in a target detection method that combines the gray wolf strategy and whale algorithm as described above.
[0025] A fourth aspect of the present invention provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the steps in a target detection method that combines the gray wolf strategy and whale algorithm as described above.
[0026] Compared with the prior art, the beneficial effects of the present invention are:
[0027] The present invention provides a target detection method that combines the gray wolf strategy and whale algorithm, which combines the predation branch of the gray wolf algorithm and the whale optimization algorithm, and controls the execution probabilities of the whale spiral predation strategy, gray wolf predation strategy, and random walk strategy based on a scaling factor and population concentration, and has better optimization ability and accuracy.
[0028] The present invention provides a target detection method that combines the gray wolf strategy and whale algorithm, which uses an algorithm that combines the gray wolf strategy and whale predation to train and iterate the parameters of the target detection model, improves the detection ability of the target detection model, especially the detection ability of small targets, provides a basis for the practical application of autonomous driving target detection, and has important significance. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings forming a part of the present invention are used to provide a further understanding of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention.
[0030] Figure 1 It is a flowchart of obtaining a target detection model in Embodiment 1 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0031] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0032] It should be noted that the following detailed description is illustrative and is intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs.
[0033] Embodiment 1
[0034] This embodiment provides an object detection method that combines the gray wolf strategy and the whale algorithm.
[0035] The object detection method that combines the gray wolf strategy and the whale algorithm provided in this embodiment is applicable to the detection of small objects such as pedestrians and cyclists during the automatic driving process.
[0036] The object detection method that combines the gray wolf strategy and the whale algorithm provided in this embodiment includes the following steps:
[0037] Step 1, obtain the image to be detected;
[0038] Step 2, based on the image to be detected, use the optimal object detection model to obtain the objects in the image to be detected, and label and classify the objects in the image to be detected and their position information.
[0039] Among them, the image to be detected can be the image information collected during road driving; the objects in the image to be detected can be traffic participants (people, vehicles, cyclists, etc.).
[0040] Among them, the object detection model uses the YOLOv5 model, and the parameters of the object detection model are trained and iterated using an algorithm that combines the gray wolf strategy and whale predation to obtain the optimal object detection model.
[0041] The process of training and iterating the parameters of the object detection model using an algorithm that combines the gray wolf strategy and whale predation includes:
[0042] (1) Initialize the population, encode a combination of parameters of an object detection model as an individual, and several individuals form a population; and set the total number of iteration cycles T, and initialize the cycle t = 0.
[0043] Among them, the parameters of the target detection model include a total of 12 parameters: initial learning rate lr0, final learning rate lrf, momentum, weight decay, number of warm-up epochs warmup_epochs, warm-up momentum warmup_momentum, warm-up initial offset learning rate warmup_bias_lr, box loss coefficient box, classification loss coefficient cls, classification loss positive weight cls_pw, object loss coefficient obj, and object loss positive weight obj_pw.
[0044] Take the 12 parameters as the optimization objectives and set their upper and lower optimization limits.
[0045] (2) Let the cycle t = t + 1. For each individual, based on the parameter combination it represents, train the target detection model using the training set, optimize the parameters of the target detection model, and calculate the fitness at cycle t.
[0046] Among them, the training set is an autonomous driving dataset.
[0047] The fitness is calculated using a comprehensive performance evaluation function:
[0048]
[0049]
[0050]
[0051]
[0052]
[0053] Among them, TP represents the number of correct detection results, TP + FP represents the number of all detection results, TP + FN represents the number of actual objects, AP represents the average correct rate of single-class detection, mAP represents the average correct rate of all-class detection, and k represents the number of classes of detected objects.
[0054] Calculate the average correct rate of all-class detection based on precision and recall. Its comprehensive performance evaluation function considers the average correct rate mAP, precision P, and recall R of all-class detection.
[0055] (3) According to the fitness, select the optimal position (optimal individual) at cycle t among all individuals The fitness corresponding to the optimal individual is the optimal fitness f at cycle t * t. And determine whether the end condition is reached. If it is reached, the object detection model trained based on the optimal individual (global optimum) is output as the optimal object detection model; otherwise, go to step (4).
[0056] (4) Use an adaptive scaling factor to control the optimization process.
[0057] Specifically, a smaller scaling factor a = 0.1 is adopted in the first N warmup cycles to obtain the best optimization direction; after N warmup cycles, the scaling factor a is adjusted according to the ratio of the optimal fitness of the population in the previous cycle and the optimal fitness f * t in the current cycle. When , expand the search range; when , narrow the search range, as shown in the following formula:
[0058]
[0059] where N warmup is a set value, t represents the current iteration cycle, T represents the total number of iteration cycles, f * t-1 represents the optimal fitness in the previous cycle, f * t represents the optimal fitness in the current cycle, let f * 0 = f * 1 .
[0060] (5) According to the fitness of each individual, select the three individuals with the best fitness as the leading wolves, select the optimal position of each individual in the historical iteration process as the local optimal vector (local minimum), and update the position of each individual.
[0061] Based on the guiding vectors of the leading wolves (alpha wolf, beta wolf, delta wolf), add the local minimum guiding vector l. Weight the above four guiding vectors according to their corresponding fitness (taking the problem of solving the minimum value as an example), and the position update formula of each individual is as follows:
[0062]
[0063]
[0064] where w α , w β , w δ and w l represent the weights of the alpha wolf, beta wolf, delta wolf and the local minimum l respectively; Denote the fitness of the k-th individual in cycle t; Respectively denote the guiding vectors of the α wolf, β wolf, δ wolf, and the local minimum l.
[0065] Use the scaling factor a to balance global optimization and local optimization, and its formula is as follows:
[0066]
[0067]
[0068] A = 2a·r1 - a
[0069] Where, Denote the position of the k-th individual in cycle t, k can be the α wolf, β wolf, or δ wolf, l represents the local optimal vector, r1 and r2 denote random numbers in [0, 1].
[0070] (6) Based on the scaling factor and population concentration, control the execution probabilities of the whale spiral predation strategy, gray wolf predation strategy, and random walk strategy, update the position of each individual again, and return to step (2).
[0071] Introduce population concentration to keep the population concentration within a reasonable range, use p h Control the execution probabilities of the whale spiral predation branch and the improved gray wolf predation branch, and its formula is as follows:
[0072]
[0073]
[0074] Where, θ represents the population concentration, Denote the sum of the fitnesses of all individuals in the previous cycle, N represents the number of individuals in the population, f * t-1 Represents the optimal fitness in the previous cycle.
[0075] Adopt the spiral predation strategy and random walk strategy to obtain better global optimal solution ability, and their calculation formulas are as follows respectively:
[0076]
[0077] Where, And Are the position vectors of the i-th individual at the t-th and t + 1-th iterations respectively, Is the optimal position at the t-th iteration, Denotes the guiding vector calculated from random individuals, r is a random number in [-1, 1], and b is the spiral constant.
[0078] A target detection method integrating the gray wolf strategy and the whale algorithm provided by this embodiment calculates the scaling factor using an update formula based on population fitness, and uses an adaptive scaling factor to control the optimization process; improves the predation behavior of the gray wolf algorithm, and weights and substitutes the position vectors of the local optimal solution, the alpha wolf, the beta wolf, and the delta wolf according to fitness into the guidance vector formula; integrates the improved gray wolf hunting behavior into the whale optimization algorithm, and uses population concentration to control the switching between the whale predation branch and the gray wolf predation branch; constructs an autonomous driving dataset and selects 12 relevant parameters of YOLOv5 as optimization variables, and comprehensively uses the average correct rate, precision, and recall rate of all category detections as measurement indicators; uses the whale optimization algorithm integrating the gray wolf strategy to train and iterate the optimization variables to obtain the optimal parameters and the optimal target detection model.
[0079] A target detection method integrating the gray wolf strategy and the whale algorithm provided by this embodiment combines the predation branch of the gray wolf algorithm and the whale optimization algorithm, and has better optimization ability and accuracy; uses the algorithm integrating the gray wolf strategy and whale predation to train and iterate the parameters of the target detection model, improves the detection ability of the target detection model, especially the detection ability of small targets, and provides a basis for the practical application of autonomous driving target detection, which has important significance.
[0080] Embodiment 2
[0081] This embodiment provides a target detection system integrating the gray wolf strategy and the whale algorithm, which specifically includes:
[0082] An image acquisition module, which is configured to: acquire an image to be detected;
[0083] A target detection module, which is configured to: based on the image to be detected, use the optimal target detection model to obtain the targets in the image to be detected;
[0084] Among them, the optimal target detection model is obtained by training and iterating the parameters of the target detection model using the algorithm integrating the gray wolf strategy and whale predation; the algorithm integrating the gray wolf strategy and whale predation controls the execution probabilities of the whale spiral predation strategy, the gray wolf predation strategy, and the random walk strategy based on the scaling factor and population concentration, and updates the position of each individual; the scaling factor is related to the ratio of the optimal fitness of two adjacent cycles; the population concentration is related to the sum of the fitnesses of all individuals.
[0085] It should be noted here that each module in this embodiment corresponds to each step in Embodiment 1 one by one, and its specific implementation process is the same, so it will not be repeated here.
[0086] Embodiment 3
[0087] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the steps in a target detection method that combines the grey wolf strategy and the whale algorithm as described in Embodiment 1 above.
[0088] Embodiment 4
[0089] This embodiment provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the steps in a target detection method that combines the grey wolf strategy and the whale algorithm as described in Embodiment 1 above.
[0090] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories and optical memories, etc.) that contain computer-usable program code.
[0091] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the specified functions in Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.
[0092] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the specified functions in Figure 1 one or more flows and / or blocks Figure 1 one or more blocks.
[0093] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide means for implementing the specified functions in Figure 1One process or multiple processes and / or boxes Figure 1 Steps of functions specified in one box or multiple boxes.
[0094] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it may include the processes of the embodiments of the above methods. Among them, the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc.
[0095] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A target detection method integrating the gray wolf strategy and the whale algorithm, characterized in that Including: Obtain the image to be detected; Based on the image to be detected, use the optimal object detection model to obtain the objects in the image to be detected; Among them, the optimal object detection model is obtained by training and iterating the parameters of the object detection model using an algorithm that combines the grey wolf strategy and the whale hunting algorithm; the algorithm that combines the grey wolf strategy and the whale hunting algorithm controls the execution probabilities of the whale spiral hunting strategy, the grey wolf hunting strategy, and the random walk strategy based on the scaling factor and the population concentration, and updates the position of each individual; the scaling factor is related to the ratio of the optimal fitness of two adjacent cycles; the population concentration is related to the sum of the fitnesses of all individuals.
2. The object detection method integrating the grey wolf strategy and the whale algorithm according to claim 1, characterized in that, The fitness of the algorithm that combines the grey wolf strategy and the whale hunting algorithm is calculated using a comprehensive performance evaluation function; The comprehensive performance evaluation function combines the average correct rate, precision, and recall rate of all category detections.
3. The object detection method integrating the grey wolf strategy and the whale algorithm according to claim 1, characterized in that, After several cycles, the scaling factor is calculated using the following formula: Among them, t represents the t-th cycle, and T represents the total number of cycle times. represents the optimal fitness of the t-th cycle.
4. The object detection method integrating the grey wolf strategy and the whale algorithm according to claim 1, characterized in that, Within several cycles, the scaling factor uses a set fixed value.
5. The object detection method integrating the grey wolf strategy and the whale algorithm according to claim 1, characterized in that, The population concentration in the t-th cycle is: the ratio of the product of the number of individuals in the population and the optimal fitness in the (t - 1)-th cycle to the sum of the fitnesses of all individuals in the (t - 1)-th cycle.
6. The object detection method integrating the grey wolf strategy and the whale algorithm according to claim 1, characterized in that, The grey wolf hunting strategy performs weighted processing on the guiding vectors of the alpha wolf and the local minimum according to the fitness values of the guiding vectors of the alpha wolf and the local minimum, and obtains the position of the updated individual.
7. The object detection method integrating the grey wolf strategy and the whale algorithm according to claim 1, characterized in that, The parameters of the object detection model include: initial learning rate, final learning rate, momentum, weight decay, number of warm-up cycles, warm-up momentum, warm-up initial offset learning rate, box loss coefficient, classification loss coefficient, classification loss positive weight, object loss coefficient, and object loss positive weight.
8. An object detection system integrating the grey wolf strategy and the whale algorithm, characterized in that, Including: An image acquisition module configured to: obtain the image to be detected; An object detection module configured to: based on the image to be detected, use the optimal object detection model to obtain the objects in the image to be detected; Among them, the optimal object detection model is obtained by training and iterating the parameters of the object detection model using an algorithm that combines the grey wolf strategy and the whale hunting algorithm; the algorithm that combines the grey wolf strategy and the whale hunting algorithm controls the execution probabilities of the whale spiral hunting strategy, the grey wolf hunting strategy, and the random walk strategy based on the scaling factor and the population concentration, and updates the position of each individual; the scaling factor is related to the ratio of the optimal fitness of two adjacent cycles; the population concentration is related to the sum of the fitnesses of all individuals.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the steps in an object detection method that combines the grey wolf strategy and the whale algorithm as described in any one of claims 1-7.
10. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in an object detection method that combines the grey wolf strategy and the whale algorithm as described in any one of claims 1-7.
Citation Information
Patent Citations
A methodfor fractional order controller in delta domain for electrochemical process
AU2020104117A4
Fault section positioning method and system based on self-adaptive whale algorithm, and medium
CN113281620A