Image segmentation algorithm based on novel electromagnetic storm

By employing a novel image segmentation algorithm based on electromagnetic storms, combined with 3D feature histograms and adaptive optimization strategies, the limitations of traditional image segmentation techniques are overcome, achieving high-precision and robust image segmentation results. This algorithm is applicable to fields such as medical image analysis, remote sensing image interpretation, and industrial defect detection.

CN121616611APending Publication Date: 2026-03-06GUILIN UNIVERSITY OF TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511735042.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-03-06

AI Technical Summary

Technical Problem

Existing image segmentation techniques suffer from problems such as a single search strategy, susceptibility to local optima, reliance on experience for parameter adjustment, difficulty in adapting to diverse image processing needs, and weak generalization ability, resulting in inconsistent segmentation results and insufficient robustness.

Method used

A novel image segmentation algorithm based on electromagnetic storms is adopted. By constructing a three-dimensional feature histogram and combining the magnetoelectric spiral motion and magnetotope current sheet walk strategy, the threshold combination is optimized using the three-dimensional Shannon entropy objective function. Adaptive weights and an elite archive mechanism are introduced to achieve a balance between global exploration and local development.

Benefits of technology

It improves the accuracy and robustness of image segmentation, significantly enhances the consistency and generalization ability of segmentation results, especially in complex boundaries and diverse image scenes, it can more accurately capture target regions and reduce segmentation errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121616611A_ABST
    Figure CN121616611A_ABST
Patent Text Reader

Abstract

The invention discloses an image segmentation algorithm based on a novel electromagnetic storm algorithm, and aims to solve the problems that an existing method is prone to local optimum, depends on experience to adjust parameters, needs a large amount of labeled data or is poor in robustness. According to the algorithm, an original image is preprocessed, an RGB image is converted into a grey-scale image, local contrast is calculated after bilateral filtering, denoising and edge preserving, and a three-dimensional feature histogram fusing the original gray scale, the filtering gray scale and the local contrast is constructed. Then, taking the three-dimensional Shannon entropy as a target function, converting segmentation into an optimization problem of optimal threshold combination search, and performing interplanetary magnetic field factor population generation, opposite learning and elite file construction initialization; and in the main cycle, precise optimization is realized through adaptive weight control magnetoelectric spiral local search, magnetic layer top current sheet global exploration and a particle collision strategy, and finally, an optimal threshold value is output and a segmentation result is generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to an image segmentation algorithm based on a novel electromagnetic storm. This method is applicable to various core image segmentation applications, including medical image analysis, remote sensing image interpretation, industrial defect detection, and intelligent monitoring target extraction. Background Technology

[0002] Image segmentation is a core technology in image processing and computer vision. Its purpose is to divide an image into sub-regions with specific semantics, providing a foundation for subsequent feature extraction, target recognition, and quantitative analysis. In various practical applications, staff need to clarify the morphological features, spatial distribution, and relationship with the background of the target region through the segmentation results. However, manual segmentation is not only time-consuming and labor-intensive, but also easily affected by subjective factors such as operator experience and visual fatigue, resulting in poor consistency of segmentation results and making it difficult to meet the needs of precise processing of quantitative data.

[0003] Existing automatic segmentation techniques have significant limitations: traditional thresholding and region growing algorithms heavily rely on manually set parameters, often resulting in incomplete or over-segmentation when faced with complex situations where the target and background grayscale overlaps and boundaries are blurred. Machine learning-based methods require manual design of texture, shape, and other features, exhibiting weak generalization ability and failing to effectively adapt to image data from different imaging devices and scenarios. While deep learning methods perform exceptionally well in image segmentation, they require large amounts of labeled data for training and have high model complexity, making them difficult to apply in scenarios with limited computing resources or scarce data.

[0004] Heuristic optimization algorithms, as an alternative, have gradually gained attention in the field of image segmentation due to their advantages such as no need for complex model training, fast convergence speed, and simple implementation. However, most existing heuristic algorithms applied to image processing are general-purpose designs and have not been optimized for the diverse features of images in different scenarios. These algorithms often get stuck in local optima when faced with irregular boundaries and complex texture structures in images due to their single search strategy, failing to achieve complete and accurate capture of the target region. At the same time, parameter tuning relies heavily on experience, resulting in insufficient robustness to image data generated by different devices and under different imaging conditions, making it difficult to stably adapt to diverse image processing needs.

[0005] Therefore, developing a general heuristic segmentation algorithm that combines high accuracy and strong robustness has become a key technological bottleneck in promoting the application of intelligent image processing technology in multiple fields. Summary of the Invention

[0006] The purpose of this invention is to overcome the limitations of traditional heuristic algorithms in the background art. In view of the problems of existing algorithms, such as single search strategy, easy to get trapped in local optima, parameter adjustment relying on experience, difficulty in stably adapting to diverse image processing needs and weak generalization ability, this invention proposes an image segmentation algorithm based on a novel electromagnetic storm.

[0007] To achieve the above objectives, the technical solution adopted by this invention is: an image segmentation algorithm based on a novel electromagnetic storm, characterized by comprising the following steps:

[0008] Step 1: Image Preprocessing and Feature Extraction: In the initial population generation formula of the electromagnetic storm optimization algorithm, the interplanetary magnetic field factor is designed to map the modulation effect of the interplanetary magnetic field on the distribution of solar wind particles in real space physics. Its core function is to enhance the spatial diversity of the initial population by introducing the randomness of the magnetic field direction, breaking the uniformity of the traditional random distribution. At the same time, reverse learning is introduced in the initialization stage to generate high-quality initial solutions, and an elite archive is built to lay the foundation for directional guidance.

[0009] Step 1.1: Load the original image to be segmented and convert the RGB color image to a grayscale image I(x,y), where x and y represent pixel coordinates, and the grayscale value range is [0, 255]. The grayscale conversion formula is:

[0010] I(x,y)+0.299R(x,y)+0.857G(x,y)+0.114B(x,y)(1)

[0011] Where R(x,y), G(x,y), and B(x,y) represent the red, green, and blue channel components of the original image at coordinates (x,y), respectively.

[0012] Step 1.2: Perform bilateral filtering on the grayscale image to suppress noise while preserving edge details. Bilateral filter output I f The formula for calculating (x, y) is:

[0013]

[0014] Where p = (x, y) represents the current pixel position, q = (i, j) represents the neighboring pixel positions, Ω represents the filtering window centered at p, and G s Let G be the Gaussian kernel function in the spatial domain. r W is the Gaussian kernel function for the grayscale range. p Normalization coefficients:

[0015]

[0016] Where σ s Controlling the smoothness of the spatial domain, σ rControl the smoothness of the grayscale range.

[0017] Step 1.3: Calculate local contrast features of the image. Using the sliding window method, calculate the local mean μ(x,y) and local variance σ of the neighborhood of each pixel (x,y). 2 (x,y):

[0018]

[0019] Where N(x, y) represents the neighborhood window centered at (x, y), and |N| represents the total number of pixels within the window. The local contrast C(x, y) is defined as:

[0020]

[0021] Where ε is a minimal constant (value 10^-6) to avoid division by zero. Local contrast is normalized to the range [0, L-1], where L represents the quantization level.

[0022] Step 1.4: Construct a 3D feature histogram H(i,j,k), and fuse the original grayscale I(x,y) and the filtered grayscale I... f Information in three dimensions: (x,y) and local contrast C(x,y):

[0023] H(i,j,k)={(x,y)|I(x,y)=i,I f (x, y) = j, C(x, y) = k} (9)

[0024] Where i, j, k∈[0,L-1] represent the number of pixels that satisfy the conditions. The three-dimensional histogram comprehensively depicts the gray-level distribution characteristics and spatial structure information of the image.

[0025] Step 2: Constructing the objective function based on the three-dimensional Shannon entropy:

[0026] Step 2.1: For a given threshold vector T, divide the 3D feature space into m+1 sub-regions. Sub-regions Ω k Defined as:

[0027] Ω k ={(i,j,c)t k <i <t k+1}, k = 0, 1, ..., m (10)

[0028] Step 2.2: Calculate the probability distribution of each sub-region. Sub-region Ω k Total frequency N k And probability P k for:

[0029]

[0030] Where M×N represents the total number of pixels in the image. Sub-region Ω k The conditional probability at the inner coordinates (i, j, c) is:

[0031]

[0032] Step 2.3: Define the objective function of the three-dimensional Shannon entropy. The Shannon entropy H of each sub-region... k The calculation is as follows:

[0033]

[0034] The overall three-dimensional Shannon entropy objective function J(T) is the weighted sum of the entropies of each subregion:

[0035]

[0036] The multi-threshold image segmentation problem is transformed into searching for the optimal threshold combination T* in the threshold space that maximizes J(T):

[0037]

[0038] Where J(T) is the overall three-dimensional Shannon entropy objective function.

[0039] Step 3: Algorithm Initialization:

[0040] Step 3.1: Set the algorithm parameters. Population size N = 30, maximum function evaluation times MaxFEs = 5000, search space dimension D (number of thresholds), and the upper and lower bounds of each dimension are [0, L-1].

[0041] Step 3.2: Generate the initial population based on the interplanetary magnetic field factor. The initial position of the i-th particle in the j-th dimension is calculated as follows:

[0042] IMF i,j = 2 × rand() - 1 (17)

[0043] X i,j =LB j +R×(UB j -LB j )+k×IMF i,j ×(UB j -LB j (18)

[0044] Where R is a uniform random number in [0, 1], and LB j and UB j , respectively, represent the lower and upper bounds of the j-th dimension, and k is the interplanetary magnetic field factor adjustment coefficient. The interplanetary magnetic field factor simulates the modulation effect of the interplanetary magnetic field on particle distribution, and expands the solution space coverage through positive and negative randomness.

[0045] Step 3.3: Generate the complementary solution. For the initial particle X i Its complementary solution X′ i The calculation is as follows:

[0046] X′ i,j =LB j +UB j -X i,j (19)

[0047] Step 3.4: Evaluate fitness and select the initial population. For each candidate particle, use its position vector as a threshold set T, and calculate the optimal threshold combination that maximizes the three-dimensional Shannon entropy according to Equation (7). Select the N particles with the highest fitness from the 2N candidate particles as the initial population.

[0048] Step 3.5: Initialize the Elite Archive. Select the top 0.08N particles with the highest fitness from the initial population and store them in the Elite Archive. The Elite Archive is used to guide the search in subsequent iterations.

[0049] Step 4: Main Loop Optimization. First, the magnetoelectric spiral motion manifests as particles spiraling asymptotically along magnetic field lines, exhibiting a fine-grained search characteristic around the current solution. This motion mode emphasizes local development and fine-tuning, aiming to deeply explore the potential of the local solution space and optimize the neighborhood structure of the current solution. This corresponds to the local search phase in metaheuristic algorithms, improving the quality of the solution through fine-grained movements with small steps, allowing it to find better solutions near its current position. Second, the magnetopause current sheet walk involves rapid exploratory movement along the boundary of the solution space. This mode emphasizes global exploration characteristics, with particles performing gradient drift in the boundary region with larger steps to discover new promising regions. This corresponds to the global exploration phase in metaheuristic algorithms, escaping local optima and finding the global optimum through boundary-oriented large-step searches.

[0050] Step 4.1: Calculate the adaptive weights. Define the algorithm execution progress, where p is the current function evaluation count. The weights W1 for the magnetoelectric spiral motion and W2 for the magnetosphere top current sheet walk are calculated as follows:

[0051]

[0052] W1 exhibits an S-shaped curve, increasing from 0.3 in the early stages to nearly 1 in the later stages, thus strengthening local development; W2 exhibits a convex curve, decreasing from 1 in the early stages, thus strengthening global exploration in the early stages.

[0053] Step 4.2: Execute the magnetoelectric spiral motion strategy. For the i-th particle X i :

[0054]

[0055] Calculate the electric field strength E and the magnetic field strength B. The electric field direction points towards the elite region.

[0056] E i =El g -X i (twenty three)

[0057] Magnetic field strength reflects the degree of population dispersion:

[0058]

[0059] in It serves as the population center.

[0060] Calculate particle velocities. Introduce a damping factor γ to simulate plasma damping effects:

[0061] v i =γ×[v d,i +v h,i (25)

[0062] Where the drift velocity v d,i and spiral motion velocity v h,i They are respectively:

[0063]

[0064] v h,i =randn()×(E i +B i ×randn()) (27)

[0065] Where randn() represents a random number distributed according to a standard normal distribution, and ε is the numerical stability constant (10^-8).

[0066] Calculate magnetoelectric displacement:

[0067] S i =v i ×Δt (28)

[0068] Step 4.3: Execute the magnetotope current sheet walk strategy:

[0069] The magnetic field gradient vector is calculated using the central difference approximation:

[0070]

[0071] Where randn(D) is a D-dimensional standard normal random vector.

[0072] In the magnetopause current sheet walk mechanism, we use gradient-driven Lévy flight to simulate particle drift in the current sheet, as shown in equation (30):

[0073]

[0074] Calculate the current plate drift displacement:

[0075]

[0076] Step 4.4: Merge the two strategies to update particle positions:

[0077]

[0078] Where α = 0.01 is the amplitude of the random disturbance.

[0079] Step 4.5: Particle collision strategy. With probability p c =0.2 triggers collision: if rand() <p c Then, differential mutation is performed. Three different particles X are randomly selected. a X b X c Generate mutated individuals:

[0080] V i =X a +F×(X b -X c (33)

[0081] The difference factor F = 0.5 + 0.3 × rand().

[0082] Perform crossover operations to generate experimental individuals:

[0083]

[0084] Where the crossover probability CR = 0.9, j rand Indexed by random dimensions.

[0085] Step 4.6: Boundary Handling. A bounce strategy is used for out-of-bounds particles:

[0086]

[0087] Step 4.7: Greedy selection. Calculation. fitness If it is better than the current particle, then update:

[0088]

[0089] Step 4.8: Update the elite profile. Merge the current population with the elite profile, and reselect the 0.08N particles with the highest fitness as the new elite profile.

[0090] Step 4.9: Update the function evaluation count FEs, and repeat steps 4.1 to 4.8 until FEs≥MaxFEs.

[0091] The algorithm introduces an equation describing the change of charged particle velocity over time through linear acceleration and helical motion. This equation combines the Lorentz force law and Newton's second law. Furthermore, considering the damping effect of the plasma region on charged particles in an electromagnetic storm environment, a damping factor γ is introduced into the equation, improving its accuracy. In the magnetopause current sheet walk mechanism, we employ gradient-driven Lévy flight to simulate particle drift within the current sheet, significantly enhancing the algorithm's boundary exploration capability. This allows it to quickly traverse the boundary regions of the entire solution space, searching for potential high-quality solutions that are easily overlooked by traditional methods. The search process follows two main motion modes: magnetoelectric helical motion and magnetopause current sheet walk, representing different search strategies and behavioral characteristics. Together, they constitute the complete optimized trajectory of the particle from its initial divergent state to the exploration of the system boundary.

[0092] Step 5: Output the optimal threshold and perform image segmentation:

[0093] Step 5.1: Select the particle X with the highest fitness from the final population. best As the optimal combination of thresholds.

[0094] Step 5.2: Segment the original grayscale image according to the optimal threshold. Generate the segmentation result image S(x,y):

[0095]

[0096] Where k∈{0,1,...,m}, different gray levels are assigned to each region to achieve visualization.

[0097] Step 5.3: Output color segmentation results. To enhance the visual effect, the segmentation results are mapped to a pseudo-color space, assigning different colors to different regions for easier subsequent image analysis and applications. Attached Figure Description

[0098] Figure 1 This is a schematic diagram of the overall algorithm flow;

[0099] Figure 2 This is a schematic diagram of the overall process of combining algorithms with image segmentation, showing the complete technical path from original image input to segmentation result output;

[0100] Figure 3 This is a schematic diagram comparing images before and after bilateral filtering, illustrating the effects of noise suppression and edge preservation.

[0101] Figure 4A schematic diagram of constructing a 3D feature histogram is provided to illustrate the fusion of information from three dimensions: original grayscale, filtered grayscale, and local contrast.

[0102] Figure 5 This is a schematic diagram of a magnetoelectric spiral motion strategy, illustrating a combined motion mode of electric field acceleration and magnetic field spiral deflection.

[0103] Figure 6 This is a schematic diagram of a particle collision strategy, illustrating the collision machine with differential mutation and crossover operations;

[0104] Figure 7 A comparison chart of the curves showing the changes in adaptive weights W1 and W2 as the iteration progress;

[0105] Figure 8 The images show a comparison of the segmentation results of bladder cancer pathological images at different threshold levels, specifically Example 1 (low threshold level) and Example 2 (high threshold level).

[0106] Figure 9 The image shows the segmentation results of the Slide 002(14) sample at the low threshold level compared with the comparison algorithm, specifically Example 1: Low threshold bladder cancer pathological image segmentation;

[0107] Figure 10 The image shows the segmentation results of the Slide 002(31) sample at a high threshold level compared with the comparison algorithm. Specifically, it is Example 2: High threshold bladder cancer pathological image segmentation.

[0108] Figure 11 Box plots showing the performance metrics of the algorithm of this invention and the comparison algorithm on the CoNIC2022 dataset, specifically Example 3: Generalization validation of bladder cancer at different pathological stages;

[0109] Figure 12 Visualization results of different algorithms on the Pascal voc 2012 validation set, including (a) Image, (b) U-Net-Transformer, (c) FCN-Transformer, and (d) ESPO-Deeplabv3+, specifically Example 4: Comparative analysis with deep learning methods;

[0110] Figure 13 The figure shows the convergence performance of the algorithm of this invention and the comparison algorithm on the test set IEEE CEC2025, specifically Example 5. Detailed Implementation

[0111] The technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings and embodiments. Obviously, the embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0112] Example 1: Low-threshold bladder cancer pathological image segmentation (threshold number m = 2)

[0113] Step 1: Select the Slide 002(14) sample from the CoNIC2022 dataset. The original image size is 600×450 pixels. Complete the conversion from RGB to grayscale image I(x,y) according to Equation (1).

[0114] Step 2: Set the bilateral filtering parameters and calculate the filtered image according to equations (2)-(5). This effectively suppresses HE staining noise and preserves the lesion boundary, as shown in the attached figure. Figure 3 The effect of bilateral filtering is shown.

[0115] Step 3: Calculate the local mean and variance using a 7×7 sliding window, and obtain the normalized local contrast C(x,y) through equations (6)-(8). The C(x,y) value of the cancerous area is significantly higher than that of normal tissue, providing feature support for segmentation.

[0116] Step 4: Construct a three-dimensional feature histogram H(i, j, k) according to equation (9), and fuse the original grayscale, filtered grayscale, and local contrast information. Figure 4 A schematic diagram for constructing a 3D histogram.

[0117] Step 5: Parameter settings: Population size N=30, MaxFEs=5000, m=2, D=2, Search range [0, 255].

[0118] Step 6: Generate the initial population according to equations (17)-(19), merge the complementary solutions and select 30 optimal particles as the initial population, and construct an elite file containing 3 particles.

[0119] Step 7: Iterate the main loop to evaluate the function 5000 times, and finally obtain the optimal threshold T* = [78, 165].

[0120] Step 8: Generate the segmentation result S(x,y) according to formula (37) and assign pseudo-colors: blue for background, green for normal tissue, and red for cancerous areas.

[0121] Step 9: Performance Evaluation: mIoU = 0.7466, DSC = 0.8547, MR = 0.1436, outperforming algorithms such as PSO (mIoU = 0.6873) and BOA (mIoU = 0.7215). (See attached image) Figure 10As shown, the segmentation results of this algorithm show more accurate boundaries of cancerous regions, with no obvious under-segmentation or over-segmentation, and are consistent with the attached data. Figure 8 The comparison results for medium and low threshold levels are consistent, verifying the effectiveness of low threshold scenarios.

[0122] Example 2: High-threshold bladder cancer pathological image segmentation (threshold number m = 24)

[0123] Steps 1-4: Consistent with Example 1, process the CoNIC2022 dataset Slide 002(31) samples, and attach... Figure 11 With consistent labeled samples, grayscale conversion, bilateral filtering, local contrast calculation, and 3D feature histogram construction were completed.

[0124] Step 5: Parameter settings: m=24, D=24, the remaining parameters are the same as in Example 1.

[0125] Step 6: During the initialization phase, 60 candidate particles are generated, and 30 of the best particles are selected to form the initial population. The elite files contain 3 particles.

[0126] Step 7: In the main loop, the adaptive weights are dynamically adjusted according to the iteration progress. Figure 7 The curves show the changes in W1 and W2. The particle moves through a magnetoelectric spiral motion, with... Figure 5 Schematic diagram, co-optimization of magnetosphere top current sheet walk, particle collision strategy, attached. Figure 6 The diagram shows that after being triggered 3 times, the system successfully escaped the local optimum.

[0127] Step 8: After the iteration terminates, the optimal threshold T* = [11, 18, ..., 214] in 24 dimensions is obtained. The grayscale space is divided into 25 sub-regions and assigned differential pseudo-color.

[0128] Step 9: Performance Evaluation: mIoU = 0.8262, DSC = 0.9046, MR = 0.0924, mIoU improved by 10.7% in lower threshold scenarios. (See attached image) Figure 11 As shown, the segmentation results of this algorithm clearly present the hierarchical structure of background, normal epithelium, inflammatory infiltration area, and well- and poorly differentiated carcinoma tissue, which is highly consistent with the pathological diagnosis and outperforms comparative algorithms such as PSO (mIoU = 0.8095). (See attached diagram.) Figure 8 Advantages at medium to high threshold levels.

[0129] Example 3: Verification of the generalization of bladder cancer at different pathological stages

[0130] Step 1: Select four typical samples from the CoNIC2022 dataset: Ta stage (Slide 002(2)), T1 stage (Slide de002(10)), T2 stage (Slide 002(5)), and inflammation combined with tumor (Slide 002(7)), covering different pathological scenarios.

[0131] Step 2: Set threshold numbers for each sample characteristic: Ta phase m=4, T1 phase m=16, T2 phase m=20, inflammation combined with tumor m=6, and other parameters are uniformly set as N=30, MaxFEs=5000, and k=0.1.

[0132] Step 3: Complete the 3D feature extraction, algorithm optimization and segmentation operations according to the process of Example 1-2, and dynamically adapt the adaptive weights and particle motion strategies to the gray-scale distribution and boundary characteristics of different samples.

[0133] Step 4: Performance evaluation: Ta phase mIoU = 0.8823, boundary positioning error < 5 pixels, T1 phase mIoU = 0.8214, T2 phase MR = 0.1175, inflammation combined with tumor mIoU = 0.7509.

[0134] Step 5: Generalization verification: as shown in the appendix Figure 9 As shown in the box plot, in all test samples of the CoNIC2022 dataset, the mIoU and DSC indices of this algorithm are more concentrated and have higher mean, while the MR index is lower, which is significantly better than the comparative algorithms such as GWO and MSCA, proving its stable generalization ability under different pathological stages and complex scenarios.

[0135] Example 4: Comparative Analysis with Deep Learning Methods

[0136] Step 1: Select the Pascal voc 2012 validation set and the CoNIC2022 dataset for scenario adaptability comparison and clinical data comparison, respectively.

[0137] Step 2: Test subjects: the algorithm of this invention, U-Net-Transformer, FCN-Transformer, and ESPO-Deeplab v3+, all of which are supplementary. Figure 12 Comparison algorithm for annotations.

[0138] Step 3: Testing dimensions: data requirements, computing resources, segmentation performance, interpretability, and clinical applicability.

[0139] Step 4: Compare the results

[0140] Data and Resources: This algorithm requires no labeled data and takes 8 seconds to segment a single image on a CPU (Intel i5); U-Net-like methods require 800 labeled images and 36 hours of training on an RTX 3090 GPU.

[0141] Performance: On the Pascal voc 2012 validation set, the mIoU of this algorithm for segmenting the core target is 0.812, which is slightly lower than U-Net-Transformer (0.853). However, on the CoNIC2022 scarce Ta-period samples, the mIoU of this algorithm is 0.8823, which is better than U-Net's 0.7215.

[0142] Visualization: as attached Figure 12 As shown, the segmentation results of this algorithm are close to those of deep learning methods in terms of boundary integrity, and there is no obvious semantic confusion, especially in the segmentation of small objects.

[0143] Step 5: This algorithm has unique advantages in scenarios with scarce data and limited resources. It complements deep learning methods and can be directly integrated into existing medical PACS systems, resulting in lower implementation costs.

[0144] Example 5: Image segmentation of urban scenes for intelligent driving (threshold number m = 6)

[0145] Step 1: Select 50 urban scene images from the Cityscapes dataset, covering sunny days, cloudy days, congested road sections, etc., convert them to grayscale images and normalize them to [0, 255].

[0146] Step 2: Set bilateral filter parameters, calculate local contrast using a 5×5 sliding window, and construct a 3D feature histogram of level L=64.

[0147] Step 3: Parameter settings: m=6, corresponding to 6 categories: background, road, small car, large car, pedestrian, traffic sign, D=6, N=30, MaxFEs=5000, search range [0, 63], k=0.1.

[0148] Step 4: After initialization, construct an elite profile containing 2 particles. In the main loop, global exploration and local development are coordinated through dynamic weights. The particle collision strategy is triggered at iterations 1203 and 2841. Step 5: After the iteration terminates, obtain the optimal threshold T* = [12, 25, 38, 46, 55, 62], generate the segmentation result, and assign pseudo-color.

[0149] Step 6: Performance evaluation: mIoU = 0.8312, DSC = 0.9057, single frame segmentation time 8.2 seconds, an improvement of 10.2% over PSO and 16.6% over GWO.

[0150] Step 7: Convergence effect: as shown in the attached document. Figure 13 As shown, the convergence curve of this algorithm on the IEEE CEC2025 test set enters the stable stage earlier and has higher convergence accuracy, which is better than the comparison algorithm. This verifies its efficient optimization capability in dynamic scenarios and meets the real-time requirements of automotive embedded platforms.

[0151] The implementation principle of this invention is as follows:

[0152] 1. Principle of 3D Feature Space Modeling: Traditional single grayscale histograms only reflect pixel intensity distribution, ignoring crucial spatial structural information and texture features in the image. This invention innovatively constructs a 3D feature histogram, integrating three dimensions: original grayscale, bilaterally filtered grayscale, and local contrast. Bilateral filtering removes noise while preserving the sharpness of target region boundaries, crucial for accurate target boundary identification in various images. Local contrast features capture the heterogeneous changes in tissue or target texture, effectively distinguishing subtle differences between the target region and the background. The 3D Shannon entropy, as the objective function, not only quantifies the information purity within each segmented region but also characterizes the structural differences between the target region and the background through a cross-dimensional joint probability distribution, ensuring, from an information theory perspective, that the segmentation results maximize the preservation of the core information value of the original image.

[0153] 2. Algorithm Mapping of Electromagnetic Storm Physical Mechanisms: The core innovation of this invention lies in accurately mapping the complex motion laws of high-energy charged particles in electromagnetic storms to the search strategy design of the optimization algorithm. In the electromagnetic storm environment, high-energy particles released by the sun exhibit three typical motion modes under the combined influence of the interplanetary magnetic field and the Earth's magnetosphere: Magnetoelectric spiral motion corresponds to the algorithm's local fine search, where particles accelerate directionally along the electric field direction while being constrained by the magnetic field to spiral deflect, and the plasma damping factor simulates the velocity decay caused by particle collisions, achieving a smooth transition from exploration to development; Magnetosphere current sheet drift step corresponds to global boundary exploration, where particles drift in the magnetosphere current sheet region driven by the magnetic field gradient, and the algorithm performs large-step jumps in the solution space boundary region through Levy flight combined with gradient guidance, effectively discovering high-quality boundary solutions that are easily missed by traditional methods; Particle collision strategy corresponds to the mechanism of escaping local optima, where chaotic collisions of particles in the solar wind trigger energy transfer and trajectory mutations, and the algorithm draws on the mutation idea of ​​differential evolution, generating new positions through collisions of random individuals within the population, significantly enhancing population diversity and preventing premature convergence of the algorithm.

[0154] 3. Dynamic Coordination of Adaptive Search Strategy: Addressing the multi-peak and high-dimensional characteristics of image segmentation problems, this invention employs an adaptive weighting mechanism based on iteration progress. The magnetoelectric spiral motion weight W1 is modeled using a Sigmoid function, maintaining a small value in the early stages of iteration to ensure sufficient global exploration capability and avoid getting trapped in local optima; it rapidly increases to near 1 as iterations progress, enhancing the particle's refined exploration of known high-quality regions and improving convergence accuracy. The magnetopause current sheet drift step weight W2 uses a Gaussian decay function, initially taking a large value to endow the algorithm with strong boundary exploration capability, quickly locating potential regions containing global optima; it decays to near 0 in the later stages, concentrating computational resources on refined local search. This dynamic weighting mechanism simulates the physical process of an electromagnetic storm from its outbreak to its subsidence, ensuring that the algorithm adaptively adjusts the ratio of exploration to development at different stages, adapting to image segmentation tasks of varying complexity without manual intervention.

[0155] 4. Balancing Elite Guidance and Population Diversity: The elite profile mechanism is a key design element in this invention, maintaining both search direction stability and population diversity. During the initialization phase, a high-quality initial population with spatial symmetry is generated through an adversarial learning strategy modulated by interplanetary magnetic field factors, and the top 8% of particles are selected to construct the elite profile. During iteration, the elite guidance strategy employs a hybrid approach: a 50% probability of randomly selecting a single elite particle and a 50% probability of using the average elite position. This design ensures that the search progresses towards the known optimal region while avoiding the loss of diversity caused by rapid population aggregation through randomness. Simultaneously, a particle collision strategy continuously injects perturbations with a 20% trigger probability throughout the iteration process, simulating the random collision behavior of particles in an electromagnetic storm. This ensures that the population maintains a moderate level of exploration capability, effectively preventing the algorithm from getting trapped in local suboptimal solutions.

[0156] 5. Problem-Specific Boundary Handling and Greedy Selection: Addressing the discrete and bounded nature of threshold optimization problems, this invention employs a bounce-back boundary handling strategy. When a particle crosses the boundary, it is not simply truncated to the boundary value, but rather bounced back using the boundary as a mirror, maintaining the continuity of particle motion and the integrity of the search space. This design avoids the problem of particle aggregation near the boundary caused by traditional boundary handling methods, which is particularly important for various image segmentation scenarios where the threshold may be distributed across the grayscale space. The greedy selection mechanism ensures that each iteration retains only updates that improve fitness, forming a monotonically non-decreasing convergence curve. This is crucial for various image applications, where users require the algorithm to provide stable and reliable segmentation results, rather than randomly fluctuating outputs.

[0157] 6. Hierarchical Information Extraction Based on Multi-Threshold Segmentation: After obtaining the optimal threshold combination, the algorithm divides the grayscale space into m+1 sub-regions, each corresponding to different structures or targets in the image: background areas, various target subjects, detailed feature areas, etc. By assigning different grayscale levels or pseudo-colors to each region, hierarchical segmentation results are generated. This preserves the core information of the original image while enhancing visual perception to facilitate quick target identification and key feature extraction, providing a reliable data foundation for subsequent quantitative analysis and target recognition. This hierarchical segmentation strategy meets the needs of various image applications, from macroscopic to microscopic and from qualitative to quantitative analysis, and has broad applicability.

[0158] In summary, this algorithm, by deeply integrating the principles of space physics, information theory, and intelligent optimization techniques, constructs a complete technical chain from image feature extraction, objective function design, intelligent optimization search to segmentation result output, providing a scientific, rigorous, robust, and efficient solution for accurate image segmentation.

[0159] The outstanding advantages of this invention are:

[0160] 1. The proposed algorithm organically integrates three strategies: magnetoelectric spiral motion, magnetopause current sheet drift step, and particle collision, constructing a search framework with both global exploration and local exploitation capabilities. The magnetoelectric spiral motion strategy derives the time-varying equation of particle velocity based on the Lorentz force law and Newton's second law, introducing a plasma damping factor to simulate particle velocity decay, achieving a smooth transition from large-scale exploration to local fine-grained search, effectively avoiding the premature convergence problem of traditional algorithms when facing complex boundaries in bladder cancer pathological images. The magnetopause current sheet drift step strategy employs gradient-driven Levy flight, combined with adaptive weights and an elite guidance mechanism, enabling particles to efficiently explore along the solution space boundary, overcoming the blindness of traditional random walks. In experiments, compared with classic algorithms such as PSO and GWO, the mIoU index is significantly improved. The accuracy improved by 4.4%-10.14%, and the DSC index improved by 1.3%-8.1%, significantly enhancing the ability to capture irregular boundaries of bladder cancer lesions. The particle collision strategy, based on the differential evolution mechanism, continuously injects diversity perturbations throughout the iteration process, giving the algorithm a strong ability to escape local optima. In high-threshold segmentation scenarios (threshold number ≥ 16), the MR index is as low as 0.0703-0.0980, far superior to the 0.1264-0.3326 range of the comparison algorithm, effectively solving the segmentation deviation problem of traditional methods when dealing with gray-level overlapping areas formed by the invasive growth of bladder cancer.

[0161] 2. Unlike traditional heuristic algorithms that rely on experience to set fixed parameters or use heuristic adjustment rules, the algorithm parameters in this invention are designed with clear physical meaning, achieving true adaptive parameter control. The magnetoelectric spiral motion weight W1 is modeled using a Sigmoid function to simulate the gradual process of electromagnetic field constraint from extremely weak to strong. Its S-shaped growth curve ensures that the algorithm maintains an initial exploration capability of 0.3 in the early stages, and converges to near 1 in the later stages to enhance local development. The magnetopause current sheet drift step weight W2 uses a Gaussian decay function, corresponding to the physical scenario where solar wind pressure gradually weakens rather than abruptly stops. Its convex curve achieves a smooth transition from global exploration to local development. This physically-based adaptive parameter mechanism eliminates the need for tedious parameter tuning for different datasets. It exhibits stable high performance when processing bladder cancer pathological images with different staining methods and different stages (Ta-T4), demonstrating significantly better generalization ability than traditional algorithms that require manual parameter tuning. On 10 bladder cancer pathology images in the CoNIC2022 dataset, the algorithm of this invention maintained the first place ranking in both low and high threshold scenarios, while the ranking of the comparison algorithm fluctuated drastically in different scenarios, which fully verified its robustness advantage.

[0162] 3. This invention's algorithm overcomes the limitations of traditional one-dimensional grayscale histograms, innovatively constructing a three-dimensional feature histogram that integrates original grayscale, bilaterally filtered grayscale, and local contrast. Combined with a three-dimensional Shannon entropy objective function, it ensures, from an information theory perspective, that the segmentation results maximize the preservation of the diagnostic value of the original image. Bilateral filtering effectively preserves the sharpness of lesion boundaries while suppressing noise introduced during HE staining, which is crucial for identifying the degree of bladder cancer muscle layer invasion. Local contrast features quantify tissue texture heterogeneity, accurately distinguishing subtle morphological differences between cancerous epithelial cells and normal transitional epithelial cells. The three-dimensional Shannon entropy, through cross-dimensional joint probability distribution, not only evaluates the internal information purity of each segmented region but also characterizes the structured difference patterns of the lesion background interface, enabling the segmentation results to accurately locate the invasion front while ensuring regional continuity. Experiments show that, compared with the BOA algorithm based on unidimensional histograms, this method improves mIoU by 27.6% when the threshold number is 4 and DSC by 13.0% when the threshold number is 20. It significantly reduces the risk of misdiagnosis of pathological staging caused by segmentation errors in clinical diagnosis, and provides a reliable quantitative basis for accurate staging of bladder cancer (Ta / T1 / T2-T4), and has the potential to be directly transformed into a clinical auxiliary diagnostic tool.

[0163] The above description is merely a preferred embodiment of the algorithm and is not intended to limit the algorithm. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the algorithm of this invention should be included within the protection scope of this invention. Those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions in the embodiments without departing from the essence and scope of the technical solutions of this invention, and such modifications or equivalent substitutions should be covered within the scope of the claims of this invention.

Claims

1. A new electromagnetic storm based image segmentation algorithm, characterized in that, The method comprises the following steps: Step 1: image preprocessing and feature extraction, loading the original image and converting it into a gray image, calculating the local contrast feature after bilateral filtering processing of the gray image, and constructing a three-dimensional feature histogram fused with the original gray, filtered gray and local contrast; Step 2: target function construction based on three-dimensional Shannon entropy, dividing the three-dimensional feature space into sub-regions through a threshold vector, calculating the probability distribution of each sub-region, and defining a three-dimensional Shannon entropy weighted target function, converting the multi-threshold segmentation into searching for the optimal threshold combination that maximizes the target function; Step 3: algorithm initialization, setting parameters such as population size and maximum function evaluation times, generating an initial population based on the interplanetary magnetic field factor and generating an opposite solution, screening the initial population and initializing the elite archive after evaluating the fitness; Step 4: main loop optimization, calculating the adaptive weight, sequentially executing the magnetoelectric spiral motion strategy and the magnetosphere top current sheet wandering strategy to update the particle position, triggering the particle collision strategy, performing boundary processing and greedy selection, updating the elite archive, and repeating the iteration until the maximum function evaluation times are reached; Step 5: output the optimal threshold and perform image segmentation, select the optimal threshold combination from the final population to segment the original gray image, and output the color segmentation result.

2. The method of claim 1, wherein, The bilateral filtering in step 1 cooperates with the spatial domain Gaussian kernel function and the gray value domain Gaussian kernel function, the spatial domain Gaussian kernel controls the spatial smoothing degree, the gray value domain Gaussian kernel controls the gray smoothing degree, and the normalized coefficient realizes the balance between noise suppression and lesion edge preservation; The three-dimensional feature histogram is constructed by counting the pixel frequency of different combinations of the original gray, filtered gray and local contrast in three dimensions, and the quantization level is set according to the detail richness of the bladder cancer pathological image.

3. The method of claim 1, wherein, In step 2, the number of sub-regions is the number of thresholds plus 1, each sub-region is defined by a specific feature value range to ensure uniqueness and integrity; the sub-region probability distribution is calculated by the ratio of the total frequency of the sub-region to the total number of image pixels, the conditional probability at the coordinates in the sub-region is determined based on the frequency ratio of the coordinates in the sub-region, and the weights of the three-dimensional Shannon entropy target function are allocated according to the importance of the diagnostic value of each sub-region.

4. The method of claim 1, wherein, In step 3, the algorithm parameters are set as follows: the population size is fixed at 30, the maximum function evaluation times is 5000, the search space dimension is consistent with the number of thresholds, and the upper and lower bounds of each dimension correspond to the quantization level range [0, L-1]; when generating the initial population based on the interplanetary magnetic field factor, the interplanetary magnetic field factor adjustment coefficient is 0.1, the spatial diversity of the initial population is enhanced by the randomness of the magnetic field direction, the opposite solution and the initial population together constitute a candidate particle set with twice the population size, and the elite archive is initialized as the top 0.08 times the population size of the optimal particles selected from the initial population.

5. The method of claim 1, wherein, In step 4, the adaptive weight includes the magnetoelectric spiral motion weight and the magnetosphere top current sheet wandering weight: the magnetoelectric spiral motion weight increases from 0.3 at the beginning to nearly 1 at the end of the iteration, to strengthen the local development in the later stage; the magnetosphere top current sheet wandering weight gradually decreases from 1 at the beginning, to strengthen the global exploration in the early stage, and the weight changes are dynamically adjusted based on the algorithm execution progress.

6. The method of claim 1, wherein, The magnetoelectric spiral motion strategy in Step 4 obtains the particle velocity by calculating the electric field intensity and the magnetic field intensity: the electric field direction points to the elite area, the magnetic field intensity reflects the population dispersion degree, and the damping factor is introduced to simulate the plasma damping effect to obtain the magnetoelectric displacement; the magnetic layer top current sheet wandering strategy uses central difference approximation to calculate the magnetic field gradient vector, and combines the gradient driven Levy flight to simulate particle drift to obtain the current sheet drift displacement, which realizes local fine search and global boundary exploration.

7. The method of claim 1, wherein, The particle collision strategy in Step 4 triggers with a probability of 0.2: after triggering, three different particles are randomly selected for differential mutation, the differential factor is 0.3 times a random number plus 0.5, and then the crossover operation is performed to generate trial individuals, the crossover probability is set to 0.9, and the population diversity is enhanced to avoid premature convergence of the algorithm.

8. The method of claim 1, wherein, The boundary processing in Step 4 adopts the bounce-back strategy: when the particle position exceeds the upper and lower boundaries of the dimension, the boundary is used as a mirror for bounce-back to maintain the continuity of particle motion and the integrity of the search space; the greedy selection mechanism compares the fitness of the trial individual and the current particle, and retains the individual with better fitness to form a monotonic non-decreasing convergence curve to ensure the stability of the segmentation result.

9. The method of claim 1, wherein, The elite archive updating method in Step 4 is: the current population and the existing elite archive are combined, and the 0.08 times the population size particles with the highest fitness are reselected as the new elite archive to maintain the balance between search direction stability and population diversity.

10. The method of claim 1, wherein, In Step 5, when image segmentation, the gray image is divided into multiple regions and assigned different gray levels according to the optimal threshold to realize visualization; the color segmentation result is generated by mapping the gray level to the pseudo-color space, and the colors of different regions are set based on the clinical diagnosis habit, which is convenient for doctors to identify the lesion range, evaluate the infiltration depth and judge the tumor stage.