An image segmentation optimization method for power component images

By improving the Cheetah optimization algorithm and using gradient descent and random nonlinear steering factors to optimize the multi-threshold Otsu algorithm, the problem of slow speed and low accuracy of the Otsu algorithm in multi-threshold segmentation is solved, and a more efficient image segmentation effect is achieved.

CN117372463BActive Publication Date: 2024-08-27INNOVATION & INNOVATION CENT OF STATE GRID ZHEJIANG ELECTRIC POWER CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311405942.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-27
Publication Date
2024-08-27
Estimated Expiration
2043-10-27

AI Technical Summary

Technical Problem

In the existing technology, the Otsu algorithm is slow in multi-threshold segmentation and the image segmentation accuracy is not high. The standard Cheetah optimization algorithm easily falls into a local optimum and the optimization accuracy is not high.

Method used

Improve the cheetah optimization algorithm, introduce the gradient descent update strategy and random nonlinear steering factor, optimize the multi-threshold Otsu algorithm, write the improved algorithm code through Matlab software, optimize the parameter update and position update strategy, and improve the convergence speed and accuracy of the algorithm.

Benefits of technology

It effectively improves the robustness and control accuracy of the system, solves the problems of slow Otsu algorithm and low image segmentation accuracy during multi-threshold segmentation, avoids the shortcomings of the standard Cheetah optimization algorithm falling into local optimality, and improves segmentation speed and accuracy. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117372463B
    Figure CN117372463B
Patent Text Reader

Abstract

The invention discloses an image segmentation optimization method for electric component images, which belongs to the technical field of image segmentation. The specific steps are as follows: step one, using a drone camera to collect the electric component image, and then preprocessing the image to determine the target object in the image; step two, inputting the electric component image to be segmented by threshold value, and reading the preprocessed image in real time, and calculating the grayscale histogram of the electric component image to be segmented; step three, improving the standard cheetah optimization algorithm, writing the improved algorithm code by Matlab software, and testing; step four, using the improved cheetah optimization algorithm to optimize the multi-threshold Otsu algorithm to obtain the best segmentation threshold, and then segmenting the image after finding the best segmentation threshold; the invention optimizes the multi-threshold Otsu image segmentation method by improving the cheetah optimization algorithm, and compares it with the prior art, thereby improving the image segmentation effect and providing great convenience for the inspection of electric components.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image segmentation, and in particular relates to an image segmentation optimization method for power component images. Background Art

[0002] Image segmentation is the process of distinguishing objects from background in an image; it is an essential preprocessing task for many applications that rely on computer vision, such as medical imaging, object localization in satellite imagery, machine vision, finger printing, and face recognition, among many others; the accuracy of image segmentation will have a great impact on the effectiveness of subsequent stages of image processing.

[0003] Image segmentation technology has important applications in visual foreign object detection; through image segmentation, different areas in the image can be separated, so as to more accurately locate and identify foreign objects; image segmentation technology can be used to locate the boundaries of foreign objects and help determine the shape and size of foreign objects, which is very important for distinguishing foreign objects from the background, especially when the foreign objects are similar to the background color or texture; the connection between power component inspection and image segmentation technology is reflected in the use of image segmentation technology to process the image data of power components to improve the accuracy and efficiency of inspection.

[0004] Although image segmentation based on deep learning has good results, it requires a large amount of labeled data to train the neural network; Otsu based on threshold segmentation is a classic image segmentation algorithm. The algorithm is very efficient in single threshold segmentation, but the algorithm is extremely slow in multi-threshold segmentation and the image segmentation effect is poor. This is because the algorithm traverses every pixel point in the image, calculates the intra-class variance and inter-class variance, and the algorithm is slow.

[0005] The Cheetah Optimization Algorithm is a new type of swarm intelligence optimization algorithm proposed by Mohammad AminAkbari and others in 2022, inspired by cheetah hunting in nature. The algorithm achieves position update by simulating three strategies of searching, waiting and attacking during the hunting process of cheetahs. However, it is easy to fall into local optimality during the algorithm exploration stage. At the same time, during the entire algorithm optimization process, it will not jump out of the local optimality, so the optimal parameters cannot be found, and the optimization accuracy is low. Summary of the invention

[0006] In response to the above-mentioned technical problems, the present technical solution provides an image segmentation optimization method for power component images, which realizes image segmentation based on the Otsu algorithm of multi-threshold segmentation, and improves the Cheetah optimization algorithm at the same time. The improved Cheetah optimization algorithm is used to optimize the Otsu algorithm of multi-threshold segmentation, and the optimal threshold is found to segment the image; thereby solving the problems mentioned in the background technology of slow speed of the Otsu algorithm and low image segmentation accuracy in multi-threshold segmentation, and the standard Cheetah optimization algorithm easily falling into local optimum and low optimization accuracy.

[0007] In order to achieve the above object, the present invention adopts the following technical scheme:

[0008] An image segmentation optimization method for power component images, characterized in that it comprises the following steps:

[0009] Step 1: Use the drone camera to collect images of power components, then pre-process the images to determine the target objects in the images.

[0010] Step 2: Input the power component image to be segmented by threshold value, read the pre-processed image in real time, and calculate the grayscale histogram of the power component image to be segmented.

[0011] Step 3: Improve the standard cheetah optimization algorithm, write the improved algorithm code through Matlab software, and test it. The improvement steps are as follows:

[0012] First, the gradient descent update strategy is introduced, as shown in formula (1):

[0013] (1);

[0014] In the formula, is the latest parameter vector to be optimized, is the learning rate, which controls the size of the update step. is the gradient;

[0015] Further improve the learning rate, the improved formula is: (2);

[0016] In the formula, is the learning rate of the current iteration, is the learning rate of the last iteration, is the worst fitness value of the current iteration, is the random value of the current iteration, is the optimal fitness value of the current iteration.

[0017] Finally, by improving the steering factor , introducing a random nonlinear steering factor , update the cheetah attack phase position update formula, the random nonlinear steering factor formula is:

[0018] (3);

[0019] In the formula, Max_iter is the maximum number of iterations, is the current iteration number.

[0020] Step 4: Use the improved Cheetah optimization algorithm to optimize the multi-threshold Otsu algorithm to obtain the optimal segmentation threshold, and then segment the power component image after finding the optimal segmentation threshold.

[0021] Furthermore, in step one, image preprocessing requires first loading the image file into memory, then scaling the image using bilinear interpolation, adjusting the image size to the size of the model input, normalizing the image through grayscale, de-scaling, edge detection, and feature extraction, and finally saving the preprocessed image for analysis.

[0022] Furthermore, in step 2, the grayscale histogram of the power component image to be segmented is calculated. First, the grayscale value is calculated by weighted averaging the pixel values ​​of the color channel, and then the number of pixels at each grayscale level in the image is counted, and finally a histogram chart is drawn.

[0023] Furthermore, in step 3, in the gradient descent update strategy, the gradient calculation is as follows:

[0024] ;

[0025] The gradient is a vector of partial derivatives that represents the rate of change of the function in the direction of each variable.

[0026] Furthermore, in step three, the introduction of the gradient descent update strategy can guide the search direction of the Cheetah Optimization Algorithm and accelerate the convergence process, especially when trapped in a local optimum, it can help the algorithm jump out of the local optimal solution; at the same time, the gradient descent update strategy can provide the direction and step size of the parameter update, so as to better control the parameter update process and avoid the situation where the update step size is too large or too small.

[0027] Furthermore, in step three, the position update strategy of the cheetah in the waiting stage is improved. The waiting strategy only considers the position of the current population individuals and does not effectively utilize the optimal position of the population, which is not conducive to the convergence of the algorithm and the improvement of the optimization accuracy. Combining t distribution and optimal position can effectively improve the optimization accuracy of the algorithm.

[0028] Furthermore, in step three, during the algorithm attack phase, a random nonlinear steering factor is introduced. Through nonlinear improvement, it is convenient for global search in the early stage of algorithm iteration, for improving search speed and escaping from local optimal search in the middle stage of algorithm iteration, and for local search in the later stage to find the optimal solution, which can effectively improve the robustness and control accuracy of the system.

[0029] Furthermore, in step 4, the multi-threshold Otsu algorithm is optimized by using the improved Cheetah optimization algorithm to obtain the optimal segmentation threshold. The specific steps are as follows:

[0030] S1. According to the power component image data, the power component image segmentation accuracy is used as the fitness function value. The present invention proposes a fitness function designed by using the ratio of the between-class variance and the within-class variance. The formula is:

[0031] ;

[0032] In the formula, For the power component image The pixel ratio of each sub-area is For the power component image The average gray value of the sub-regions, is the average gray value of the entire power component image, For the power component image A set of pixels in a sub-region, is the pixel gray value;

[0033] S2. Initialize the number of thresholds to be segmented, and initialize the relevant parameters of the improved cheetah optimization algorithm according to the set number of thresholds, including the initial position of the cheetah, the overall size of the population N , Problem Dimension d 、 Search space upper and lower bounds[ ub , lb ] and the maximum number of iterations Max_iter ; Randomly generate a certain number of cheetah individuals, each cheetah individual represents a threshold combination in the multi-threshold Otsu algorithm;

[0034] S3, using the threshold value range of the power component image segmentation as the search space of the algorithm, the range is [0,255], and randomly selecting a set of threshold parameters within the value range as the initial position of the cheetah population;

[0035] S4, calculate the fitness value of each cheetah, and record the fitness value of the best individual generated in each iteration, set the individual with the best fitness value as the prey, and the position of the prey at this time is the trend of the algorithm's current threshold optimization;

[0036] S5, use the current iteration optimal fitness value , and the optimal fitness value of the previous iteration Comparison, the minimum fitness value of the two is updated to ; The fitness value is used to measure the quality of the threshold combination when segmenting each power component image;

[0037] S6, using the coefficient of variation to determine whether the current iteration falls into a local optimum; if it falls into a local optimum, execute S3; if it does not fall into a local optimum, execute S7;

[0038] S7, using the gradient descent mechanism, updates the parameters in the reverse direction of the function gradient, reduces the fitness value, and jumps out of the local optimum;

[0039] S8. In the cheetah search phase, the cheetah conducts a full-range scan in the territory or surrounding area, and updates the position of the individual population according to formula (4):

[0040] , (4);

[0041] In the formula, is the j-dimensional position of the i-th cheetah at the t+1-th iteration, is the j-dimensional position of the i-th cheetah in the t-th iteration, is the random number of the jth dimension of the normal distribution of the i-th cheetah, is the search step length of the j-th iteration dimension of the i-th cheetah, is the maximum number of iterations of the algorithm;

[0042] S9, in the cheetah waiting stage, the cheetah stops moving and updates the position of the individual population according to formula (5):

[0043] (5);

[0044] In the formula, is the updated position of cheetah i in arrangement j, is the current position of cheetah i in array j;

[0045] S10. In the cheetah attack phase, a random nonlinear steering factor is introduced, and then the positions of the individuals in the population are updated:

[0046] (6);

[0047] In the formula, is the j-dimensional prey position of the t-th iteration, i.e., the current best position, is the j-th dimension interaction factor of the t-th iteration of the i-th cheetah;

[0048] S11, according to S8-S10, select different position update strategies to update the position of the cheetah population, the latest position of the population is the solution set of the threshold of the power component image segmentation, and retain the optimal threshold solution according to the value of the fitness function;

[0049] S12, generating new cheetah individuals by changing the threshold parameters of the cheetah individuals;

[0050] S13, updating the current number of iterations, and determining whether the current number of iterations reaches the preset maximum number of iterations, if not, returning to step S4, if yes, returning the threshold value corresponding to the optimal fitness value as the optimal segmentation threshold value of the power component image;

[0051] S14, outputting the optimal threshold value and performing multi-threshold segmentation on the power component image.

[0052] Furthermore, in step S1, the fitness function The Otsu algorithm is an adaptive image binarization method that uses the ratio of the between-class variance to the within-class variance. In this fitness function, the numerator represents the difference between categories, and the denominator represents the difference within a category. When the fitness value is smaller, the difference between categories is relatively small, while the difference within categories is relatively large, and the image segmentation effect of power components is better.

[0053] Furthermore, in step S2, the improved cheetah optimization algorithm is initialized, and the cheetah initialization position is the initial value of the power component image segmentation threshold, which is described as:

[0054] , ;

[0055] In the formula, is the j-dimensional position of the i-th cheetah, are the upper and lower limits of the j-th dimension search space, is a random number between 0 and 1; N is the size of the cheetah population, and d is the problem dimension.

[0056] Furthermore, in step S3, a set of threshold parameters are randomly selected within the value range as the initial position of the cheetah population, and the mapping between the threshold and the cheetah population position adopts real number coding to represent the cheetah position as a real number vector, in which each element corresponds to a parameter.

[0057] Furthermore, in step S6, the specific steps of using the coefficient of variation to determine whether the current iteration falls into a local optimum are:

[0058] S5.1. Calculate the standard deviation of the fitness value within the current period σ and mean μ ;

[0059] S5.2. Calculate the coefficient of variation CV. The formula is: CV = ;

[0060] S5.3, set the threshold value P = 0.5, if , the current iteration falls into a local optimum.

[0061] Furthermore, in step S7, the improved gradient descent mechanism method is designed as follows:

[0062] S6.1. Select an initial solution ;

[0063] S6.2. Calculate the gradient of the current position ;

[0064] S6.3. Update the parameters using the gradient descent method, combining equation (1) and equation (2) to improve the formula: .

[0065] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:

[0066] The present invention introduces a gradient descent mechanism on the basis of a standard cheetah optimization algorithm to guide the search direction of the cheetah optimization algorithm and accelerate the convergence process. In particular, when trapped in a local optimum, the standard cheetah optimization algorithm can be helped to jump out of the local optimal solution. Then, in the attack phase of the algorithm, a random nonlinear steering factor is introduced. Through nonlinear improvement, in the early stage of algorithm iteration, global search is facilitated. In the middle stage of algorithm iteration, search speed is improved and local optimal search is jumped out. In the later stage, local search is facilitated to find the optimal solution, which can effectively improve the robustness and control accuracy of the system. Through the above two improvements, the problems mentioned in the background technology that the Otsu algorithm is slow and the image segmentation accuracy is not high in multi-threshold segmentation and the standard cheetah optimization algorithm is easy to fall into the local optimum and the optimization accuracy is not high are solved, and at the same time, the shortcomings of the Otsu algorithm that the segmentation speed is slow and the anti-noise performance is poor in multi-threshold segmentation are solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 The present invention is a flow chart of an image segmentation optimization method for power component images.

[0068] Figure 2 It is a graph of random nonlinear steering factor changes.

[0069] Figure 3 Flowchart for optimizing multi-threshold Otsu-based image segmentation for the improved Cheetah optimization algorithm.

[0070] Figure 4 Comparison curve of the optimal individual fitness values ​​of the improved cheetah optimization algorithm, the standard cheetah optimization algorithm and the Harris Hawk algorithm.

[0071] Figure 5 is the grayscale histogram of the electrical component to be segmented.

[0072] Figure 6 The effect diagram of optimizing image segmentation of power components by the improved Cheetah optimization algorithm and the standard Cheetah optimization algorithm. DETAILED DESCRIPTION

[0073] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0074] See also Figure 1-Figure 6 , the present invention provides a technical solution:

[0075] An image segmentation optimization method for power component images, characterized in that the specific steps are as follows:

[0076] like Figure 1 As shown, step 1, using the drone camera to collect images of power components, and then preprocessing the images to determine the target objects in the images.

[0077] Step 2: Input the power component image to be segmented by threshold value, read the pre-processed image in real time, and calculate the grayscale histogram of the power component image to be segmented.

[0078] Step 3: Improve the standard cheetah optimization algorithm, write the improved algorithm code through Matlab software, and test it. The improvement steps are as follows:

[0079] First, the gradient descent update strategy is introduced, as shown in formula (1):

[0080] (1);

[0081] In the formula, is the latest parameter vector to be optimized, is the learning rate, which controls the size of the update step. is the gradient;

[0082] Further improve the learning rate, the improved formula is: (2);

[0083] In the formula, is the learning rate of the current iteration, is the learning rate of the last iteration, is the worst fitness value of the current iteration, is the random value of the current iteration, is the optimal fitness value of the current iteration.

[0084] Finally, by improving the steering factor , introducing a random nonlinear steering factor , update the cheetah attack phase position update formula, the random nonlinear steering factor formula is:

[0085] (3);

[0086] In the formula, Max_iter is the maximum number of iterations, is the current iteration number.

[0087] Step 4: Use the improved Cheetah optimization algorithm to optimize the multi-threshold Otsu algorithm to obtain the optimal segmentation threshold, and then segment the power component image after finding the optimal segmentation threshold.

[0088] Furthermore, in step 1, image preprocessing requires first loading the image file into memory, then scaling the image using bilinear interpolation, adjusting the image size to the model input size, and then normalizing the image through grayscale, de-scaling, edge detection, and feature extraction, and finally saving the preprocessed image, such as Figure 5 As shown, it is used for analysis.

[0089] Furthermore, in step 2, the grayscale histogram of the power component image to be segmented is calculated. First, the grayscale value is calculated by weighted averaging the pixel values ​​of the color channel, and then the number of pixels at each grayscale level in the image is counted, and finally a histogram chart is drawn.

[0090] Furthermore, in step 3, in the gradient descent update strategy, the gradient calculation is as follows:

[0091] ;

[0092] The gradient is a vector of partial derivatives that represents the rate of change of the function in the direction of each variable.

[0093] Furthermore, in step three, the introduction of the gradient descent update strategy can guide the search direction of the Cheetah Optimization Algorithm and accelerate the convergence process, especially when trapped in a local optimum, it can help the algorithm jump out of the local optimal solution; at the same time, the gradient descent update strategy can provide the direction and step size of the parameter update, so as to better control the parameter update process and avoid the situation where the update step size is too large or too small.

[0094] Furthermore, in step three, the position update strategy of the cheetah in the waiting stage is improved. The waiting strategy only considers the position of the current population individuals and does not effectively utilize the optimal position of the population, which is not conducive to the convergence of the algorithm and the improvement of the optimization accuracy. Combining t distribution and optimal position can effectively improve the optimization accuracy of the algorithm.

[0095] Furthermore, in step three, in the algorithm attack phase, a random nonlinear steering factor is introduced. Through nonlinear improvement, it is convenient for global search in the early stage of algorithm iteration, convenient for improving search speed and jumping out of local optimal search in the middle stage of algorithm iteration, and convenient for local search in the later stage to find the optimal solution, such as Figure 2 shown.

[0096] Furthermore, in step 4, the multi-threshold Otsu algorithm is optimized using the improved Cheetah optimization algorithm to obtain the optimal segmentation threshold, such as Figure 3 As shown, the specific steps are as follows:

[0097] S1. According to the power component image data, the power component image segmentation accuracy is used as the fitness function value. The present invention proposes a fitness function designed by using the ratio of the between-class variance and the within-class variance. The formula is:

[0098] ;

[0099] In the formula, For the power component image The pixel ratio of each sub-area is For the power component image The average gray value of the sub-regions, is the average gray value of the entire power component image, For the power component image A set of pixels in a sub-region, is the pixel gray value;

[0100] S2. Initialize the number of thresholds to be segmented, and initialize the relevant parameters of the improved cheetah optimization algorithm according to the set number of thresholds, including the initial position of the cheetah, the overall size of the population N , Problem Dimension d 、 Search space upper and lower bounds[ ub , lb ] and the maximum number of iterations Max_iter ; Randomly generate a certain number of cheetah individuals, each cheetah individual represents a threshold combination in the multi-threshold Otsu algorithm;

[0101] S3, using the threshold value range of the power component image segmentation as the search space of the algorithm, the range is [0,255], and randomly selecting a set of threshold parameters within the value range as the initial position of the cheetah population;

[0102] S4, calculate the fitness value of each cheetah, and record the fitness value of the best individual generated in each iteration, set the individual with the best fitness value as the prey, and the position of the prey at this time is the trend of the algorithm's current threshold optimization;

[0103] S5, use the current iteration optimal fitness value , and the optimal fitness value of the previous iteration Comparison, the minimum fitness value of the two is updated to ; The fitness value is used to measure the quality of the threshold combination when segmenting each power component image;

[0104] S6, using the coefficient of variation to determine whether the current iteration falls into a local optimum; if it falls into a local optimum, execute S3; if it does not fall into a local optimum, execute S7;

[0105] S7, using the gradient descent mechanism, updates the parameters in the reverse direction of the function gradient, reduces the fitness value, and jumps out of the local optimum;

[0106] S8. In the cheetah search phase, the cheetah conducts a full-range scan in the territory or surrounding area, and updates the position of the individual population according to formula (4):

[0107] , (4);

[0108] In the formula, is the j-dimensional position of the i-th cheetah at the t+1-th iteration, is the j-dimensional position of the i-th cheetah in the t-th iteration, is the random number of the jth dimension of the normal distribution of the i-th cheetah, is the search step length of the j-th iteration dimension of the i-th cheetah, is the maximum number of iterations of the algorithm;

[0109] S9, in the cheetah waiting stage, the cheetah stops moving and updates the position of the individual population according to formula (5):

[0110] (5);

[0111] In the formula, is the updated position of cheetah i in arrangement j, is the current position of cheetah i in array j;

[0112] S10. In the cheetah attack phase, a random nonlinear steering factor is introduced, and then the positions of the individuals in the population are updated:

[0113] (6);

[0114] In the formula, is the j-dimensional prey position of the t-th iteration, i.e., the current best position, is the j-th dimension interaction factor of the t-th iteration of the i-th cheetah;

[0115] S11, according to S8-S10, select different position update strategies to update the position of the cheetah population, the latest position of the population is the solution set of the threshold of the power component image segmentation, and retain the optimal threshold solution according to the value of the fitness function;

[0116] S12, generating new cheetah individuals by changing the threshold parameters of the cheetah individuals;

[0117] S13, updating the current number of iterations, and determining whether the current number of iterations reaches the preset maximum number of iterations, if not, returning to step S4, if yes, returning the threshold value corresponding to the optimal fitness value as the optimal segmentation threshold value of the power component image;

[0118] S14, outputting the optimal threshold value and performing multi-threshold segmentation on the power component image.

[0119] Furthermore, in step S1, the fitness function The Otsu algorithm is an adaptive image binarization method that uses the ratio of the between-class variance to the within-class variance. In this fitness function, the numerator represents the difference between categories, and the denominator represents the difference within a category. When the fitness value is smaller, the difference between categories is relatively small, while the difference within categories is relatively large, and the image segmentation effect of power components is better.

[0120] Furthermore, in step S2, the improved cheetah optimization algorithm is initialized, and the cheetah initialization position is the initial value of the power component image segmentation threshold, which is described as:

[0121] , ;

[0122] In the formula, is the j-dimensional position of the i-th cheetah, are the upper and lower limits of the j-th dimension search space, is a random number between 0 and 1; N is the size of the cheetah population, and d is the problem dimension.

[0123] Furthermore, in step S3, a set of threshold parameters are randomly selected within the value range as the initial position of the cheetah population, and the mapping between the threshold and the cheetah population position adopts real number coding to represent the cheetah position as a real number vector, in which each element corresponds to a parameter.

[0124] Furthermore, in step S6, the specific steps of using the coefficient of variation to determine whether the current iteration falls into a local optimum are:

[0125] S5.1. Calculate the standard deviation of the fitness value within the current period σ and mean μ ;

[0126] S5.2. Calculate the coefficient of variation CV. The formula is: CV = ;

[0127] S5.3, set the threshold value P = 0.5, if , the current iteration falls into a local optimum.

[0128] Furthermore, in step S7, the improved gradient descent mechanism method is designed as follows:

[0129] S6.1. Select an initial solution ;

[0130] S6.2. Calculate the gradient of the current position ;

[0131] S6.3. Update the parameters using the gradient descent method, combining equation (1) and equation (2) to improve the formula: .

[0132] In order to verify the superiority of the improved Cheetah optimization algorithm in the present invention in optimizing the multi-threshold Otsu image method for image segmentation, experiments were conducted using Matlab, and the experimental verification of the design method of the present invention was completed by comparing it with the standard Cheetah optimization algorithm.

[0133] The specific implementation experiment sets the cheetah population size N=30 and the maximum iteration Max_iter =500, the optimization of the standard cheetah optimization algorithm and the improved cheetah optimization algorithm is performed successively, and then the optimization effect diagram is drawn, and the program is run. In the present invention, the smaller the fitness value, the better the algorithm performance. After 500 iterations, the optimization value of the improved cheetah optimization algorithm is smaller than that of the standard cheetah optimization algorithm, indicating that the improved cheetah optimization algorithm has better performance.

[0134] The image segmentation method based on the Harris Eagle optimization algorithm of the reference patent number CN201911084150 is compared with the experimental data of the patent of this invention, as shown in the following table:

[0135] image Original Otsu method Harris Hawk Algorithm Cheetah Optimization Algorithm Improved Cheetah Algorithm Power components 1 6.5441 0.7562 0.5362 0.2253 Power components 2 5.6352 0.5895 0.4100 0.3010 Power components 3 8.1365 0.7985 0.6875 0.4124

[0136] Three threshold segmentation is performed on the images of three defective power components. The data in the segmentation time comparison table of the four methods can be analyzed to show that the original Otsu algorithm has the disadvantages of slow segmentation speed and poor noise resistance in multi-threshold segmentation. The improved Cheetah algorithm is used to optimize the Otsu multi-threshold segmentation, which can overcome these shortcomings to a certain extent.

[0137] The traditional Otsu algorithm has low segmentation efficiency. The addition of the intelligent optimization algorithm solves the problem of low efficiency. However, judging from the experimental results of the segmentation time comparison table, the Harris Eagle algorithm and the standard Cheetah optimization algorithm are still obviously slow in segmentation speed.

[0138] like Figure 4As shown in the figure, the optimal individual fitness values ​​of the improved cheetah optimization algorithm are compared with those of the standard cheetah optimization algorithm and the Harris Eagle algorithm. After 50 iterations, it is not difficult to find that compared with other algorithms, the improved cheetah optimization algorithm is the first to stably reach -1800, indicating that when searching for the optimal threshold, the improved cheetah optimization algorithm is faster and can find the optimal threshold in about 20 iterations, showing excellent performance.

[0139] Reanalyze the split time comparison table and combine Figure 6 ,The Harris Eagle algorithm and the standard Cheetah optimization algorithm still have obvious noise, and the segmentation effect in small parts is poor, while the improved Cheetah optimization algorithm has significantly improved the segmentation effect in small parts, and the segmentation time is also shorter.

Claims

1. An image segmentation optimization method for power component images, characterized in that: The improved Cheetah optimization algorithm is used to optimize the multi-threshold Otsu algorithm to obtain the optimal image segmentation threshold. The specific steps are: Step 1: Use the drone camera to collect images of power components, and then pre-process the images; Step 2: input the preprocessed power component image to be segmented by threshold value, read the preprocessed image in real time, and calculate the grayscale histogram of the preprocessed power component image to be segmented; Step 3: Improve the standard cheetah optimization algorithm, write the improved algorithm code through Matlab software, and test it. The improvement steps are as follows: First, the gradient descent update strategy is introduced, as shown in formula (1): In the formula, x t+1 is the latest parameter vector to be optimized, α is the learning rate, which controls the size of the update step. is the gradient; Further improve the learning rate, the improved formula is: In the formula, α t+1 is the learning rate of the current iteration, α t is the learning rate of the last iteration, fit(worst) is the worst fitness value of the current iteration, fit(t) is the random value of the current iteration, and fit(best) is the best fitness value of the current iteration; finally, by improving the steering factor Introducing random nonlinear steering factor r i,j , update the cheetah attack phase position update formula, the random nonlinear steering factor formula is: In the formula, Max_iter is the maximum number of iterations, and t is the current number of iterations; Step 4: Use the improved Cheetah optimization algorithm to optimize the multi-threshold Otsu algorithm to obtain the optimal segmentation threshold. After finding the optimal segmentation threshold, segment the power component image. The specific steps are as follows: S1. According to the power component image data, the power component image segmentation accuracy is used as the fitness function value. The present invention proposes a fitness function designed by using the ratio of the between-class variance and the within-class variance. The formula is: In the formula, w i is the pixel ratio of the ith sub-region of the power component image, u i is the average gray value of the ith sub-region of the power component image, u T is the average gray value of the entire power component image, S i is the pixel set of the ith sub-region of the power component image, and x is the pixel gray value; S2, initialize the number of thresholds to be segmented, and initialize the relevant parameters of the improved cheetah optimization algorithm according to the set number of thresholds, including the initial position of the cheetah, the overall size of the population N, the problem dimension d, the upper and lower bounds of the search space [ub, lb] and the maximum number of iterations Max_iter; randomly generate a certain number of cheetah individuals, each cheetah individual represents a threshold combination in the multi-threshold Otsu algorithm; S3, using the threshold value range of the power component image segmentation as the search space of the algorithm, the range is [0,255], and randomly selecting a set of threshold parameters within the value range as the initial position of the cheetah population; S4, calculate the fitness value of each cheetah, and record the fitness value of the best individual generated in each iteration, set the individual with the best fitness value as the prey, and the position of the prey at this time is the trend of the algorithm's current threshold optimization; S5, compare the current iteration optimal fitness value fit(t) with the previous iteration optimal fitness value fit(best), and update the minimum fitness value of the two to fit(best); the fitness value is used to measure the quality of the threshold combination when segmenting each power component image; S6, using the coefficient of variation to determine whether the current iteration falls into a local optimum; if it falls into a local optimum, execute S3; if it does not fall into a local optimum, execute S7; S7, using the gradient descent mechanism, updates the parameters in the reverse direction of the function gradient, reduces the fitness value, and jumps out of the local optimum; S8, in the cheetah search phase, the cheetah conducts a full range scan in the territory or surrounding area, and the cheetah updates the position of the individual population according to formula (4): In the formula, is the j-dimensional position of the i-th cheetah at the t+1-th iteration, is the j-dimensional position of the i-th cheetah in the t-th iteration, is the random number of the jth dimension of the normal distribution of the i-th cheetah, is the search step length of the j-th iteration dimension of the i-th cheetah, and T is the maximum number of iterations of the algorithm; S9, in the cheetah waiting stage, the cheetah stops moving and updates the position of the individual population according to formula (5): In the formula, is the updated position of cheetah i in arrangement j, is the current position of cheetah i in array j; S10. In the cheetah attack phase, a random nonlinear steering factor is introduced, and then the positions of the individuals in the population are updated: In the formula, is the j-dimensional prey position of the t-th iteration, i.e., the current best position, is the j-th dimension interaction factor of the t-th iteration of the i-th cheetah; S11, according to S8-S10, select different position update strategies to update the position of the cheetah population, the latest position of the population is the solution set of the threshold of the power component image segmentation, and retain the optimal threshold solution according to the value of the fitness function; S12, generating new cheetah individuals by changing the threshold parameters of the cheetah individuals; S13, updating the current number of iterations, and determining whether the current number of iterations reaches the preset maximum number of iterations, if not, returning to step S4, if yes, returning the threshold value corresponding to the optimal fitness value as the optimal segmentation threshold value of the power component image; S14, outputting the optimal threshold value and performing multi-threshold segmentation on the power component image.