A method, device, medium and equipment for lupus nephritis image segmentation
By introducing the foraging-storage optimization stage, adaptive rime factor and individual optimal solution into the rime algorithm, the local optimal problem in lupus nephritis image segmentation is solved, and the accuracy of segmentation and the diversity of thresholds are improved.
Patent Information
- Application Number
- CN202411378303.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-09-30
AI Technical Summary
In the prior art, the problem of inaccurate image segmentation of lupus nephritis caused by local optimum.
By adding the forage-storage-seeking stage in parallel with the excitation stage to the original rime algorithm, and randomly performing the original rime algorithm's excitation stage and the forage-storage-seeking stage, the search ability of the rime algorithm is enhanced. At the same time, adaptive rime factor and individual optimal replacement of global optimal solutions are introduced to avoid falling into local optimality.
The risk of rime algorithm falling into local optimality is effectively avoided, the accuracy of image segmentation and the diversity of segmentation thresholds are improved, and the opportunity to find more accurate segmentation results are enhanced.
Smart Images

Figure CN118941581B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image segmentation, and in particular to a method, device, medium and equipment for lupus nephritis image segmentation. Background Art
[0002] Lupus nephritis (Lupus Nephritis, LN) is a complication of systemic lupus erythematosus (Systemic Lupus Erythematosus, SLE), which mainly attacks the kidneys, which may lead to clinical symptoms such as proteinuria, hematuria, hypertension and renal failure. Accurate segmentation of lupus nephritis images to separate the regions of interest such as lesions from the background can help doctors understand the disease and better formulate treatment plans. Therefore, how to select a set of optimal thresholds that can maximally distinguish between normal and lesions is the key to achieving effective segmentation of lupus nephritis images.
[0003] In the prior art, the RIME Algorithm (RIME) is a threshold optimization method, which finds the maximum segmentation threshold of an objective function by iteratively optimizing an objective function. The objective function is usually based on statistical properties of an image grayscale histogram, such as variance or uniformity.
[0004] However, there are complex and diverse local features in lupus nephritis images, which may cause the segmentation threshold to be optimized using the rime algorithm and fall into the local optimum, so that the final segmentation threshold does not meet the standard of optimizing the objective function. Using this final threshold to segment lupus nephritis images will result in the segmentation effect that needs to be improved. Summary of the invention
[0005] Based on this, in order to solve the technical problem of inaccurate lupus nephritis image segmentation caused by falling into local optimum in the prior art, the present invention provides a lupus nephritis image segmentation method, device, medium and equipment.
[0006] The present invention provides a lupus nephritis image segmentation method, comprising:
[0007] Get the size of Lupus nephritis images to be segmented ; The lupus nephritis image to be segmented Converted to grayscale value range The grayscale image of lupus nephritis to be segmented, where Represents the maximum gray value in the lupus nephritis image to be segmented.
[0008] Perform non-local mean operation on the lupus nephritis grayscale image to be segmented to obtain a non-local mean filtered image:
[0009]
[0010]
[0011]
[0012]
[0013] in, is the predicted value obtained by the non-local mean; and Pixels and pixels Gray value of and Pixels and pixels The local mean of and Pixels and pixels centered Pixel matrix, is the weight for weighted averaging; is the non-mean filter strength.
[0014] Based on the non-local mean filtering image, a two-dimensional histogram is constructed. x The axis represents the grayscale value of the lupus nephritis grayscale image to be segmented. y The axis represents the gray value of the non-local mean filtered image, and the two-dimensional histogram z Axis value for:
[0015]
[0016] in, It's pixels The number of occurrences, express The probability density of .
[0017] set up M The initial threshold value is M The initial threshold is used for non-local mean operation; The initial threshold and the result of the non-local mean operation form a set U :
[0018] U= {( q , g ),...,( q M , gM )}
[0019] in, q ~ q M They are An initial threshold; g ~ g M They are q ~ q M The result obtained after non-local means.
[0020] use The initial threshold is used to segment the lupus nephritis grayscale image into M + 1 Different areas: B , S 1 , ...., S M};get M + 1 different areas B , S 1 , ...., S M The sum of Renyi entropies corresponding to Re ( U ):
[0021] Re ( U )= Re ( B )+ Re ( S 1 )+...+ Re ( S M )
[0022] in, Re ( B )~ Re ( S M ) are regions B ~ S M The Renyi entropy of .
[0023] Use the improved rime algorithm to obtain Re ( U )The largest threshold set U* :
[0024] U*= argmax( Re (U ))
[0025] Among them, argmax() means finding a set of U* , so that Re ( U )maximum.
[0026] Improved rime algorithm includes:
[0027] A foraging-storage optimization phase is added to the original rime algorithm in parallel with the optimization phase of the original rime algorithm, and the optimization phase of the original rime algorithm and the foraging-storage optimization phase are randomly executed; in the optimization phase of the original rime algorithm, the step size when searching for the optimal segmentation threshold is adjusted by an adaptive rime factor to reduce the search step size in the second half of the search; and in the optimization phase of the original rime algorithm, individual solutions are used instead of the global optimal solution to increase the population size.
[0028] In the foraging-storage optimization stage, the segmentation threshold information carried by individuals is exchanged within the population through foraging strategies and storage strategies, so as to encourage all individuals in the population to move towards the individual carrying the optimal segmentation threshold.
[0029] The foraging strategy is:
[0030]
[0031] in, is the position of the candidate individual, For the Individuals, For the Dimension; For the Individual The value of the dimension; For the The average value of all individuals on the dimension; is a Levy distributed random number; 、 and There are three individuals in the population , and In the The value of the dimension; and The upper and lower limits of the solution space corresponding to the optimization problem are The value of the dimension; , , , , and All are random numbers between [-1, 1]; is a uniformly distributed random number between [-1, 1]; is a normally distributed random number; is a Levy distributed random number; is a constant with a value of 0.05; FEs is the current evaluation number; MaxFEs is the maximum number of evaluations; the meaning of the above formula is: when the foraging strategy generates candidate solutions, it provides two random update methods for the current solution in different dimensions: the first update method is: the value of the current solution in some dimensions is not changed and is directly passed to the candidate solution; the second update method is divided into two stages. The first stage is in the first half of the algorithm, and it is updated through the average value of the current solution in each dimension, the difference between two random individuals in each dimension, and the upper and lower limits of the optimization target in each dimension; the second stage is in the second half of the algorithm, and it is updated through another random individual generated, the difference between the first two random individuals in each dimension, and the upper and lower limits of the optimization target in each dimension.
[0032] The storage strategy is:
[0033]
[0034]
[0035] in, is a Levy distributed random number, and They are uniformly distributed random numbers between [-1, 1]; For individuals within a population In the The value of the dimension; is the current optimal individual in The meaning of the above formula is: for the generation of candidate solutions, the storage strategy provides three update methods for the current solution in different dimensions: the first update method is: generating candidate solutions through the value of the current solution in several dimensions, the difference between the optimal solution and the current solution in these dimensions, and the difference between two random individuals in these dimensions; the second update method is: generating candidate solutions by using the current optimal solution in several dimensions and the difference between two random solutions in these dimensions; the third update method is: scaling the current optimal solution in several dimensions and passing it to the candidate solution.
[0036] Adaptive rime factor for:
[0037]
[0038] in, The value of is between [-1, 1]. FEs is the current evaluation number, MaxFEs is the maximum number of evaluations.
[0039] Using individual solutions instead of the global optimal solution is to improve the method of obtaining the candidate individual positions in the original rime algorithm to:
[0040]
[0041] in, is the position of the candidate individual, For the Individuals, For the Dimension; The optimal position found by each individual during the update process; arimefactor is the adaptive rime factor; is a random position in the solution space at The value of the dimension; The value of is between [-1, 1], which is the parameter that determines the individual's soft rime in a certain dimension. If E Then the soft rime process is performed on this dimension; E It is the ratio of the current evaluation number to the maximum evaluation number.
[0042] The present invention provides a lupus nephritis image segmentation device, comprising:
[0043] A data acquisition module, used for obtaining a grayscale image of lupus nephritis to be segmented and a two-dimensional histogram corresponding to the grayscale image;
[0044] The threshold optimization module is used to use the improved rime algorithm to search for a set of optimal segmentation thresholds in the two-dimensional histogram so that the segmented lupus nephritis grayscale image has the maximum discrimination degree; the improved rime algorithm includes:
[0045] A foraging-storage optimization phase is added to the original rime algorithm in parallel with the optimization phase of the original rime algorithm, and the optimization phase of the original rime algorithm and the foraging-storage optimization phase are randomly executed; wherein, in the foraging-storage optimization phase, the segmentation threshold information carried by individuals is exchanged within the population through the foraging strategy and the storage strategy, so as to prompt all individuals in the population to move toward the individual carrying the optimal segmentation threshold;
[0046] The image segmentation module is used to perform threshold segmentation on the lupus nephritis grayscale image to be segmented based on an optimal segmentation threshold.
[0047] The present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned lupus nephritis image segmentation method is implemented.
[0048] The present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned lupus nephritis image segmentation method when executing the program.
[0049] At least one of the above technical solutions adopted by the present invention can achieve the following beneficial effects:
[0050] In the lupus nephritis image segmentation method provided by the present invention, a foraging-storage optimization phase in parallel with the optimization phase of the original rime algorithm is added to the original rime algorithm, and the optimization phase of the original rime algorithm and the foraging-storage optimization phase are randomly executed to improve the rime algorithm, thereby enhancing the search capability of the rime algorithm and preventing it from falling into a local optimum. Specifically: the foraging-storage optimization phase exchanges information between individuals in the population through foraging strategies and storage strategies to expand the information sharing capability within the population, and prompts all individuals in the population to move toward the individual carrying the optimal segmentation threshold, thereby introducing different search mechanisms and behavior patterns, and randomly executing different optimization phases helps to avoid the optimization process from falling into a fixed search mode, prevents stagnation near a local optimal solution, and increases the chance of finding a threshold that makes lupus nephritis image segmentation more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0052] Figure 1 A schematic diagram of a lupus nephritis image segmentation method provided by the present invention;
[0053] Figure 2 A schematic diagram of a process for obtaining a two-dimensional histogram corresponding to a lupus nephritis grayscale image to be segmented provided by the present invention;
[0054] Figure 3 A schematic diagram of a process for obtaining multiple optimal segmentation thresholds provided by the present invention;
[0055] Figure 4 A comparison chart of the original rime factor value and the adaptive rime factor value as the number of iterations provided by the present invention changes; Figure 4 (a) is the graph showing the change of the original rime factor value with the number of iterations; Figure 4(b) is a graph showing the change of the adaptive rime factor value with the number of iterations;
[0056] Figure 5 This is a schematic diagram of a lupus nephritis image segmentation device provided by the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in combination with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0058] Image multi-threshold segmentation is one of the main methods for processing medical images. In particular, the application and development of meta-heuristic algorithms have made it possible to find a more reliable means of finding threshold combinations in image multi-threshold segmentation. After multi-threshold segmentation, LN images can be divided into several non-overlapping areas, thus helping doctors diagnose the disease. However, in the existing methods, the performance of solving the problem of image multi-threshold segmentation needs to be optimized.
[0059] Based on this, the present invention proposes a lupus nephritis image segmentation method, which can solve the optimal threshold combination of multi-threshold image segmentation. The method can enhance the information sharing capability within the rime algorithm group by using foraging and storage strategies, and can also improve the exploration capability of the rime algorithm. And because the rime algorithm is prone to fall into the local optimum and poor convergence accuracy in the later stage of updating, in order to solve these problems, the present invention proposes an adaptive rime factor and a method of using individual optimum instead of global optimum. In addition, the present invention also combines a non-local mean two-dimensional histogram for denoising.
[0060] Figure 1 The process of the lupus nephritis image segmentation method provided in this embodiment is shown. Figure 1 The lupus nephritis image segmentation method is described in detail, and specifically comprises the following steps:
[0061] S1: Obtain a lupus nephritis grayscale image to be segmented and a two-dimensional histogram corresponding to the grayscale image.
[0062] Figure 2 The process of obtaining the two-dimensional histogram corresponding to the lupus nephritis grayscale image to be segmented provided by this embodiment is shown, which specifically includes the following steps:
[0063] S101: Get the size m × n Lupus nephritis images to be segmented Ia; The lupus nephritis image to be segmented Ia Converted to grayscale values in the range [0, 1, ..., V -1] to be segmented lupus nephritis grayscale image, where V Represents the maximum gray value in the lupus nephritis image to be segmented.
[0064] S102: Perform a non-local mean operation on the lupus nephritis grayscale image to be segmented to obtain a non-local mean filtered image:
[0065]
[0066]
[0067]
[0068]
[0069] in, is the predicted value obtained by the non-local mean; and Pixels and pixels Gray value of and Pixels and pixels The local mean of and Pixels and pixels centered Pixel matrix, is the weight for weighted averaging, is the non-mean filter strength.
[0070] S103: constructing a two-dimensional histogram based on the non-local mean filtering image.
[0071] Two-dimensional histogram x The axis represents the grayscale value of the lupus nephritis grayscale image to be segmented. y The axis represents the gray value of the non-local mean filtered image, and the two-dimensional histogram z The values of the axes are:
[0072]
[0073] in, It's pixels The number of occurrences, express The probability density of .
[0074] S2: Use the improved rime algorithm to search for a set of optimal segmentation thresholds in the two-dimensional histogram so that the segmented lupus nephritis grayscale image has the maximum discrimination degree; the improved rime algorithm includes: adding a foraging-storage optimization stage in parallel with the optimization stage of the original rime algorithm to the original rime algorithm, and randomly executing the optimization stage of the original rime algorithm and the foraging-storage optimization stage; wherein, the foraging-storage optimization stage exchanges the segmentation threshold information carried by individuals within the population through foraging strategies and storage strategies, so as to encourage all individuals in the population to move toward the individual carrying the optimal segmentation threshold.
[0075] In addition, the improved rime algorithm also includes adjusting the step size when searching for the optimal segmentation threshold through an adaptive rime factor, so as to reduce the search step size in the later stage of the search and realize a small range search.
[0076] Renyi entropy is an information measurement method that can evaluate the degree of confusion or uncertainty of a data set. Therefore, by using the maximum Renyi entropy as the objective function, the threshold combination that makes the image segmentation result most discriminative can be found by optimizing the Renyi entropy. Assume and They represent the background area and target area in the image to be segmented respectively. According to the definition of Renyi entropy, we can get and The Renyi entropies are and :
[0077]
[0078]
[0079]
[0080]
[0081] in, is the threshold value in the original grayscale image, for The result after non-local means. In order to find the threshold Divide the useful area as much as possible to ensure that and Contains a lot of information, making and The total value of entropy is the largest, that is Therefore, the optimization problem can be expressed as: find satisfy:
[0082] .
[0083] Since the single threshold segmentation method often has limitations in practical applications and cannot meet the needs of lupus nephritis image segmentation, it is considered to expand the single threshold segmentation to multi-threshold segmentation technology. Based on the basic principle of single threshold segmentation, the process of obtaining multiple optimal segmentation thresholds is as follows: Figure 3 As shown, the specific steps include:
[0084] S201: Settings M The initial threshold value is M The initial threshold is used for non-local mean operation; The initial threshold and the result of the non-local mean operation form a set U :
[0085] U= {( q , g ),...,( q M , g M )}
[0086] in, q ~ q M They are An initial threshold; g ~ g M They are q ~ q M The result obtained after non-local means.
[0087] S202: Use M The initial threshold is used to segment the lupus nephritis grayscale image into M + 1 Different areas: B , S 1 , ...., S M};get M + 1 different areas B , S 1 , ...., S M The sum of Renyi entropies corresponding to Re ( U ):
[0088] Re ( U )= Re ( B )+ Re ( S1 )+...+ Re ( S M )
[0089] in, Re ( B )~ Re ( S M ) are regions B ~ S M Renyi entropy; B is the background, S 1 ~ S M Indicates a target of interest.
[0090] S203: Use the improved rime algorithm to obtain Re ( U )The largest threshold set U* :
[0091] U*= argmax( Re ( U ))
[0092] Among them, argmax() means finding a set of U* , so that Re ( U )maximum.
[0093] Among them, the process of improving the rime algorithm is:
[0094] I: Initialize population size , Problem Dimension and the maximum number of evaluations Among them, the population size express Individuals ( A set of candidate segmentation thresholds), each of which contains M Group( q, g ), so the problem dimension for M .
[0095] II: Initialize the population , Indicates The first dimensions; one of which M Dimensional population correspondence M Group( q, g ), based on this M Group( q, g ) can segment the lupus nephritis grayscale image to be segmented intoM + 1 different areas B , S 1 , ...., S M}, based on this M + 1 different areas B , S 1 , ...., S M} can be calculated Re ( U ); therefore, Renyi entropy Re ( U ) is used as the fitness value of the evaluation population.
[0096] III: Generate two uniformly distributed random numbers in the interval [0, 1] rand 1 and rand 2 ,if rand 1 < rand 2 , then execute step IV; otherwise, execute step V;
[0097] IV: Execute the soft rime stage and hard rime stage of the improved rime algorithm. The mathematical model of the soft rime stage is:
[0098]
[0099]
[0100]
[0101]
[0102] in, is the position of the candidate individual, For the Individuals, For the Dimension; is the current optimal individual in The value of the dimension; For the rime factor; is a random position in the solution space at The value of the dimension, The value of is between [0, 1], which is the parameter that determines the individual's soft rime in a certain dimension. If E Then the soft rime process is performed on this dimension; The value of is between [0, 1]; and Represent the upper and lower limits of the solution space in The value of the dimension; The value of is between [-1, 1]. is the current evaluation number, is the maximum number of evaluations; The value of is 5; Indicates rounding.
[0103] After the soft rime stage is completed, the hard rime stage is executed. The mathematical model of the hard rime stage is:
[0104]
[0105] in, The value of is between [0, 1]. Indicates The fitness value of each individual, Represents the result after normalizing the fitness value.
[0106] Rime Factor It is a parameter in the rime algorithm, which affects the moving step length of individuals in the algorithm in the search space, and the step length determines the distance that individuals explore new areas in each iteration. Since the rime factor will cause the rime algorithm to stagnate in the later stages of the iteration, an adaptive rime factor is proposed. To improve this shortcoming of the rime algorithm. The specific mathematical expression is as follows:
[0107] .
[0108] The comparison of the original rime factor value and the adaptive rime factor value with the number of iterations is shown in Figure 2. Figure 4 As shown, the horizontal axis is ; Figure 4 (a) is the graph showing the change of the original rime factor value with the number of iterations; Figure 4 (b) in the figure is the graph showing the change of the adaptive rime factor value with the number of iterations. Figure 4 It is not difficult to see that the adaptive rime factor takes a larger value in the early stage of iteration, that is, the search step is large, and takes a smaller value in the later stage of iteration, that is, the search step is small. Through improvements, the step size is larger in the early stage of the algorithm to promote extensive search and exploration; and the step size is smaller in the later stage to promote more refined search and convergence.
[0109] In addition, the rime algorithm always uses the global individual information in the update process, which will make the algorithm easily fall into the trap of local optimality. Therefore, the soft rime stage is improved. The specific mathematical model is as follows:
[0110]
[0111] in, For each individual, the optimal position found in the updating process is replace The advantage is that it can provide more population information and also ensure the quality of the population. Using each individual's own optimal solution (individual optimality) instead of the best solution found by all individuals (global optimality) to guide its next search means that each individual will rely more on its own experience rather than the experience of the entire population. This not only ensures that individuals in the population have different characteristics or solutions, thereby avoiding the algorithm from converging to a local optimal solution too early, but also helps reduce the risk of the entire population converging to a solution that may not be the global optimal solution too early.
[0112] V: Execute the foraging strategy phase and storage strategy phase of the improved rime algorithm.
[0113] The original rime algorithm lacks information exchange between individuals in the population. The foraging strategy and storage strategy make full use of the information between different individuals in the population. The foraging strategy and storage strategy are also two parallel strategies. The probability of choosing these two strategies is Less than If there is no solution, the foraging strategy is executed; otherwise, the storage strategy is implemented. In the foraging strategy, full use is made of other individuals in the population, as well as the upper and lower limits of the problem itself. Based on the interaction of this information, the algorithm's exploration and search capabilities can be improved, helping the algorithm to open up new solution spaces. In the storage strategy, full use is made of the current solution and the optimal solution. Through the information exchange between the current solution and the optimal solution, the current solution develops in the direction where a better solution is more likely to exist, fully tapping the potential of the current location; individuals further develop the current area based on the storage strategy, enhancing the algorithm's development capabilities.
[0114] Among them, the mathematical model of foraging strategy is:
[0115]
[0116] Among them, among them, is the position of the candidate individual, For the Individuals, For the Dimension; For the Individual The value of the dimension; For the The average value of all individuals on the dimension; is a Levy distributed random number; 、 and There are three individuals in the population , and In the The value of the dimension; and The upper and lower limits of the solution space corresponding to the optimization problem are The value of the dimension; , , , , and All are random numbers between [-1, 1]; is a uniformly distributed random number between [-1, 1]; is a normally distributed random number; is a Levy distributed random number; is a constant with a value of 0.05; FEs is the current evaluation number; MaxFEs is the maximum number of evaluations.
[0117] For the generation of candidate solutions, the foraging strategy provides two update methods for different dimensions of the current solution, and these two update methods are randomly selected. The first update method is to directly pass the value of the current solution on some dimensions to the candidate solution without changing it; the second update method is divided into two stages. The first stage is in the first half of the algorithm. The average value of the current solution of the accounting algorithm on the dimension is calculated, and then the difference between two random individuals on these dimensions and the upper and lower limits of the problem on these dimensions are used for update. This part uses more information in the population, such as the average value of the solution in the population on some dimensions, and two random solutions. In the second half of the algorithm, the average value of the current solution on the dimension is no longer calculated, but another random individual is generated, and then the difference between two random individuals on these dimensions and the upper and lower limits of the problem on these dimensions are used for update. This part also uses information of other solutions other than the current solution, such as the other three random solutions in the population.
[0118] The mathematical model of the storage strategy is:
[0119]
[0120]
[0121] in, is a Levy distributed random number, and They are uniformly distributed random numbers between [-1, 1]; For individuals within a population In the The value of the dimension; is the current optimal individual in The value of the dimension.
[0122] Executing foraging and storage strategies will The probability of executing:
[0123] .
[0124] Generates a uniformly distributed random number between [0, 1] p ,when p< When , the foraging strategy is executed; otherwise, the storage strategy is executed.
[0125] For the generation of candidate solutions, the storage strategy provides three update methods for different dimensions of the current solution. The first method uses the values of certain dimensions of the current solution, the difference between the optimal solution and the current solution in certain dimensions, and the difference between two random individuals in certain dimensions. Based on these three results, certain dimensions of the candidate solution are generated. The second method uses certain dimensions of the current optimal solution and the difference between two random solutions in these dimensions. Based on these two results, certain dimensions of the candidate solution are generated. The third method is to scale the current optimal solution in certain dimensions and transfer it to the candidate solution. The storage strategy makes full use of random solutions and optimal solutions within the population.
[0126] VI: Update individuals according to the greedy selection strategy , and ;if , then return to step III; otherwise, the loop ends and outputs a set of segmentation thresholds U* .
[0127] S3: Perform threshold segmentation on the lupus nephritis grayscale image to be segmented based on the optimal segmentation threshold.
[0128] based on Figure 1The lupus nephritis image segmentation method shown in the figure proposes a method that combines the rime algorithm with the foraging storage strategy, uses the individual optimal position instead of the global optimal position, and innovatively proposes an adaptive rime factor. The above strategy improves the shortcomings of the rime algorithm that it is easy to fall into the local optimal position and has weak convergence accuracy and exploration capabilities. Specifically, the introduction of the adaptive rime factor enables the algorithm to adaptively adjust the step size according to the algorithm stage and explore the solution space more effectively; in order to increase the diversity of thresholds and avoid falling into local optimality, the individual optimal strategy is adopted to replace the traditional global optimal strategy. By focusing on the optimal performance of each set of thresholds, more diverse search directions can be retained, allowing the algorithm to discover more potential high-quality solutions during the exploration process.
[0129] The above is a lupus nephritis image segmentation method provided by one or more embodiments of the present invention. Based on the same idea, the present invention also provides a corresponding Figure 5 The lupus nephritis image segmentation device shown comprises:
[0130] The data acquisition module is used to obtain the lupus nephritis grayscale image to be segmented and a two-dimensional histogram corresponding to the grayscale image.
[0131] The threshold optimization module is used to use the improved rime algorithm to search for a set of optimal segmentation thresholds in the two-dimensional histogram so that the segmented lupus nephritis grayscale image has the maximum discrimination degree; the improved rime algorithm includes:
[0132] A foraging-storage optimization phase is added to the original rime algorithm in parallel with the optimization phase of the original rime algorithm, and the optimization phase of the original rime algorithm and the foraging-storage optimization phase are randomly executed; wherein, in the foraging-storage optimization phase, the segmentation threshold information carried by individuals is exchanged within the population through foraging strategies and storage strategies, so as to prompt all individuals in the population to move toward the individual carrying the optimal segmentation threshold.
[0133] The image segmentation module is used to perform threshold segmentation on the lupus nephritis grayscale image to be segmented based on an optimal segmentation threshold.
[0134] The specific definition of the lupus nephritis image segmentation device can be found in the definition of the lupus nephritis image segmentation method above, which will not be repeated here. Each module in the above lupus nephritis image segmentation device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0135] The present invention also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1The lupus nephritis image segmentation method provided.
[0136] The present invention also provides a computer device structure. At the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory. Of course, it may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 The lupus nephritis image segmentation method provided.
[0137] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0138] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.
Claims
1. A lupus nephritis image segmentation method, characterized in that: include: Obtaining a lupus nephritis grayscale image to be segmented and a two-dimensional histogram corresponding to the grayscale image; An improved rime algorithm is used to search for a set of optimal segmentation thresholds in a two-dimensional histogram so that the segmented lupus nephritis grayscale image has the maximum discrimination degree; The improved rime algorithm comprises: A foraging-storage optimization phase is added to the original rime algorithm in parallel with the optimization phase of the original rime algorithm, and the optimization phase of the original rime algorithm and the foraging-storage optimization phase are randomly executed; wherein, in the foraging-storage optimization phase, the segmentation threshold information carried by individuals is exchanged within the population through the foraging strategy and the storage strategy, so as to prompt all individuals in the population to move toward the individual carrying the optimal segmentation threshold; The foraging strategy specifically includes: Among them, Xnew i,j is the position of the candidate individual, i is the i-th individual, j is the j-th dimension; X i,j is the value of the jth dimension of the ith individual; Xm j is the average value of all individuals in the jth dimension; β is a random number from Levy distribution; X A,j , X B,j and X C,j They are three individuals X in the population A , X B and X C The value in the jth dimension; ub j and lb j are the upper and lower limits of the solution space corresponding to the optimization problem in the jth dimension; k1, k2, k3, k4, τ1 and τ2 are all random numbers between [-1, 1]; τ3 is a uniformly distributed random number between [-1, 1]; τ4 is a normally distributed random number; τ5 is a Levy distributed random number; δ is a constant with a value of 0.05; FEs is the current number of evaluations; MaxFEs is the maximum number of evaluations; The meaning of the above formula is: when the foraging strategy generates candidate solutions, it provides two random update methods for different dimensions of the current solution: the first update method is: the value of the current solution in some dimensions is not changed and is directly passed to the candidate solution; the second update method is divided into two stages, the first stage is in the first half of the algorithm, and the update is performed through the average value of the current solution in each dimension, the difference between two random individuals in each dimension, and the upper and lower limits of the optimization target in each dimension; the second stage is in the second half of the algorithm, and the update is performed through another random individual generated, the difference between the first two random individuals in each dimension, and the upper and lower limits of the optimization target in each dimension; The storage strategy specifically includes: l=r2×(1-FEs / MaxFEs) Where λ is a Levy distribution random number, r1 and r2 are uniformly distributed random numbers between [-1, 1]; X D,j is the individual X in the population D The value in the jth dimension; Xb j is the value of the current optimal individual in the jth dimension; The meaning of the above formula is: for the generation of candidate solutions, the storage strategy provides three update methods for the current solution in different dimensions: the first update method is to generate candidate solutions through the value of the current solution in several dimensions, the difference between the optimal solution and the current solution in the several dimensions, and the difference between two random individuals in the several dimensions; the second update method is to generate candidate solutions using the current optimal solution in several dimensions and the difference between two random solutions in these dimensions; the third update method is to scale the current optimal solution in several dimensions and pass it to the candidate solution; Threshold segmentation is performed on the lupus nephritis grayscale image to be segmented based on the optimal segmentation threshold.
2. The lupus nephritis image segmentation method according to claim 1, characterized in that: The improved rime algorithm further includes: In the optimization stage of the original rime algorithm, the step size when searching for the optimal segmentation threshold is adjusted by an adaptive rime factor to reduce the search step size in the second half of the search; and in the optimization stage of the original rime algorithm, individual solutions are used instead of global optimal solutions to increase the population size; The adaptive rime factor arimefactor is: Among them, the value of α is between [-1, 1], FEs is the current evaluation number, and MaxFEs is the maximum evaluation number; The use of individual solutions instead of the global optimal solution is to improve the method of obtaining the candidate individual positions in the original rime algorithm to: Xnew i,j =Xpb j +arimefactor×Xr j p1<E Among them, Xnew i,j is the position of the candidate individual, i is the i-th individual, and j is the j-th dimension; Xpb j is the best position found by each individual during the update process; arimefactor is the adaptive rime factor; Xr j is the value of the random position in the solution space at the j-th dimension; the value of p1 is between [0, 1], which is a parameter determining whether the individual performs soft rime in a certain dimension. If p1 < E, the soft rime process is performed on this dimension; E is the ratio of the current evaluation times to the maximum evaluation times.
3. The lupus nephritis image segmentation method according to claim 1, characterized in that: The step of obtaining the lupus nephritis grayscale image to be segmented and the two-dimensional histogram corresponding to the grayscale image specifically includes: Obtain a lupus nephritis image Ia to be segmented with a size of m×n; convert the lupus nephritis image Ia to be segmented into a lupus nephritis grayscale image to be segmented with a grayscale value range of [0,1,...,V-1], wherein V represents the maximum grayscale value in the lupus nephritis image to be segmented; Perform non-local mean operation on the lupus nephritis grayscale image to be segmented to obtain a non-local mean filtered image: Where NLM(i) is the predicted value obtained by the non-local mean; Ia(i) and Ia(j) are the grayscale values of pixel i and pixel j respectively; d(i) and d(j) are the local means of pixel i and pixel j respectively; V(i) and V(j) are the k×k pixel matrices centered on pixel i and pixel j respectively, ω(i,j) is the weight for weighted averaging; σ is the non-mean filter strength; A two-dimensional histogram is constructed based on the non-local mean filter image. The x-axis of the two-dimensional histogram represents the grayscale value of the lupus nephritis grayscale image to be segmented, and the y-axis represents the grayscale value of the non-local mean filter image. The value P(x,y) of the z-axis of the two-dimensional histogram is: Among them, C(x,y) is the number of times the pixel (x,y) appears, and P(x,y) represents the probability density of C(x,y).
4. The lupus nephritis image segmentation method according to claim 3, characterized in that: The discrimination is characterized by Renyi entropy.
5. The lupus nephritis image segmentation method according to claim 4, characterized in that: The method of using the improved rime algorithm to search for a set of optimal segmentation thresholds in the two-dimensional histogram so that the segmented lupus nephritis grayscale image has the maximum discrimination degree specifically includes: Set M initial thresholds, perform non-local mean operations on the M initial thresholds, and combine the results of the M initial thresholds and non-local mean operations into a set U: U={(q,g),...,(q M ,g M )} Among them, q~q M are M initial thresholds; g~g M They are q~q respectively M The result obtained after non-local means; Use M initial thresholds to segment the lupus nephritis grayscale image into M+1 different regions: {B, S1, ..., S M }; obtain M+1 different regions {B, S1, ...., S M The corresponding Renyi entropy sum Re(U): Re(U)=Re(B)+Re(S1)+...+Re(S M ) Among them, Re(B)~Re(S M ) are respectively areas B~S M Renyi entropy; Use the improved rime algorithm to obtain the threshold set U* that maximizes Re(U): U*=argmax(Re(U)) Among them, argmax() means finding a set of U* that maximizes Re(U).
6. A lupus nephritis image segmentation device, characterized in that: include: A data acquisition module, used for obtaining a grayscale image of lupus nephritis to be segmented and a two-dimensional histogram corresponding to the grayscale image; A threshold optimization module is used to use an improved rime algorithm to search for a set of optimal segmentation thresholds in a two-dimensional histogram so that the segmented lupus nephritis grayscale image has the maximum discrimination degree; The improved rime algorithm comprises: A foraging-storage optimization phase is added to the original rime algorithm in parallel with the optimization phase of the original rime algorithm, and the optimization phase of the original rime algorithm and the foraging-storage optimization phase are randomly executed; wherein, in the foraging-storage optimization phase, the segmentation threshold information carried by individuals is exchanged within the population through the foraging strategy and the storage strategy, so as to prompt all individuals in the population to move toward the individual carrying the optimal segmentation threshold; The foraging strategy specifically includes: Among them, Xnew i,j is the position of the candidate individual, i is the i-th individual, j is the j-th dimension; X i,j is the value of the jth dimension of the ith individual; Xm j is the average value of all individuals in the jth dimension; β is a random number from Levy distribution; X A,j , X B,j and X C,j They are three individuals X in the population A , X B and X C The value in the jth dimension; ub j and lb j are the upper and lower limits of the solution space corresponding to the optimization problem in the jth dimension; k1, k2, k3, k4, τ1 and τ2 are all random numbers between [-1, 1]; τ3 is a uniformly distributed random number between [-1, 1]; τ4 is a normally distributed random number; τ5 is a Levy distributed random number; δ is a constant with a value of 0.05; FEs is the current number of evaluations; MaxFEs is the maximum number of evaluations; The meaning of the above formula is: when the foraging strategy generates candidate solutions, it provides two random update methods for different dimensions of the current solution: the first update method is: the value of the current solution in some dimensions is not changed and is directly passed to the candidate solution; the second update method is divided into two stages, the first stage is in the first half of the algorithm, and the update is performed through the average value of the current solution in each dimension, the difference between two random individuals in each dimension, and the upper and lower limits of the optimization target in each dimension; the second stage is in the second half of the algorithm, and the update is performed through another random individual generated, the difference between the first two random individuals in each dimension, and the upper and lower limits of the optimization target in each dimension; The storage strategy specifically includes: l=r2×(1-FEs / MaxFEs) Where λ is a Levy distribution random number, r1 and r2 are uniformly distributed random numbers between [-1, 1]; X D,j is the individual X in the population D The value in the jth dimension; Xb j is the value of the current optimal individual in the jth dimension; The meaning of the above formula is: for the generation of candidate solutions, the storage strategy provides three update methods for the current solution in different dimensions: the first update method is to generate candidate solutions through the value of the current solution in several dimensions, the difference between the optimal solution and the current solution in the several dimensions, and the difference between two random individuals in the several dimensions; the second update method is to generate candidate solutions using the current optimal solution in several dimensions and the difference between two random solutions in these dimensions; the third update method is to scale the current optimal solution in several dimensions and pass it to the candidate solution; The image segmentation module is used to perform threshold segmentation on the lupus nephritis grayscale image to be segmented based on an optimal segmentation threshold.
7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
8. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Multi-threshold image segmentation method based on entropy
CN117455941A
Defect image segmentation method and device based on multiple thresholds and electronic equipment
CN117974705A