A greenhouse crop disease image segmentation method and system
By improving the rime ice algorithm and combining it with the two-dimensional Kapur entropy thresholding method and nonlocal mean filtering, the problem of low segmentation accuracy of crop disease images was solved, achieving efficient and robust disease area identification, reducing the false detection rate, and adapting to complex agricultural environments.
Patent Information
- Application Number
- CN202511375302.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-09-25
AI Technical Summary
Existing crop disease image segmentation methods suffer from low segmentation accuracy and poor generalization ability in agricultural scenarios such as complex lesion morphology, drastic changes in light, and leaf occlusion, making them unable to effectively identify small lesions and resulting in a high false detection rate.
An improved frost-detection algorithm combined with a two-dimensional Kapur entropy thresholding method and nonlocal mean filtering is adopted. Through image preprocessing, grayscale conversion, and construction of a two-dimensional histogram, the improved frost-detection algorithm is used for multi-threshold segmentation. The threshold search is optimized by combining NCC and SW strategies to improve the accuracy of disease area identification.
It significantly improves the recognition accuracy and robustness of disease maps, reduces the false detection rate, enhances the edge clarity and regional integrity of diseased areas, adapts to different lighting and backgrounds, and reduces agricultural production costs.
Smart Images

Figure CN120876525B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing of ground scenes, and also relates to the technical field of crop disease identification. BACKGROUND
[0002] In modern agriculture, in the process of cultivating crops in a greenhouse, timely and accurate identification of diseases of crops in the greenhouse is crucial for timely prevention and protection of the quality and yield of crops. In the prior art, the crop disease identification technology based on images is a relatively advanced technology, and the core technical means in this technology includes image segmentation technology. The image after image segmentation can significantly improve the automation level of greenhouse crop disease identification, reduce the manual misjudgment rate, help improve the efficiency of pesticide use, and reduce the cost of agricultural production.
[0003] Image segmentation refers to the process of dividing an image into regions with different characteristics and extracting the target region, and is also a prerequisite for image processing and pattern recognition. Greenhouse crop disease image segmentation is a necessary prerequisite for assessing the degree of plant disease and identifying disease types. Common methods for greenhouse crop disease image segmentation include threshold segmentation, region extraction, and segmentation based on deep learning, such as UNet and YOLO.
[0004] For region extraction and segmentation based on deep learning, due to factors such as variable lesion morphology, complex color, uneven lighting, and leaf shading in the actual field environment, the existing region extraction and segmentation based on deep learning have insufficient segmentation accuracy, are not sensitive enough to early small lesions, and have limited model generalization ability.
[0005] For threshold segmentation, due to its simplicity, high computational efficiency, and stable performance, it has become the most basic and widely used image segmentation technique in image segmentation. Threshold segmentation methods can be divided into single threshold segmentation and multi-threshold segmentation according to the number of thresholds. Single threshold segmentation uses only one threshold to segment the image into target and background, while multi-threshold segmentation uses multiple thresholds to segment the image into multiple regions as needed. In addition, since the threshold directly affects the results of image segmentation, the threshold also directly affects the final effect of image processing and pattern recognition. However, the calculation amount and calculation time of traditional threshold segmentation optimization methods for solving the optimal threshold are unacceptable.
[0006] In summary, the image segmentation methods in existing crop disease identification technology often face problems such as low segmentation accuracy, poor generalization ability, and difficulty in identifying small lesions in agricultural scenes with complex lesion morphology, severe lighting changes, and leaf shading. SUMMARY
[0007] The present application alleviates the problems of low segmentation accuracy, poor generalization ability and difficulty in identifying small lesions of existing crop disease image segmentation methods in the face of complex lesion morphology, severe light changes, leaf shielding and other agricultural scenes, and improves the disease image segmentation accuracy, processing speed and robustness. The present application provides the following scheme:
[0008] Scheme one, a greenhouse crop disease image segmentation method, comprising the following steps:
[0009] Step one, obtaining a disease image of a greenhouse crop disease plant, preprocessing the disease image to obtain a preprocessed disease image;
[0010] The preprocessing includes image cropping, image scaling, image denoising, color enhancement and image equalization;
[0011] Step two, performing grayscale processing on the preprocessed disease image to obtain a grayscale image; processing the grayscale image using a non-local mean filtering algorithm to obtain a non-local mean filtering image; and constructing a two-dimensional histogram based on the grayscale image and the non-local mean filtering image;
[0012] Step three, using a maximized two-dimensional Kapur entropy function as an objective function, and using a Kapur entropy threshold method to segment the two-dimensional histogram to obtain an initial threshold set;
[0013] Step four, using a maximized two-dimensional Kapur entropy function as an objective function, and using an improved fog and ice algorithm to search for the initial threshold set to obtain an optimal threshold set;
[0014] Step five, performing multi-threshold segmentation on the disease image in step one based on the optimal threshold set to obtain a disease image with segmented lesion areas, and completing the greenhouse crop disease image segmentation.
[0015] Further, in an embodiment of the present application, the two-dimensional Kapur entropy function in step three is:
[0016]
[0017] Wherein, is the number of sub-regions divided on the main diagonal line of the two-dimensional histogram, is the gray value of the grayscale image, is the gray value of the non-local mean filtering image, is the Kapur entropy in the i-th diagonal line region.
[0018] Further, in an embodiment of the present application, the improved fog and ice algorithm in step four comprises the following steps:
[0019] Step 41: Based on the initial threshold set, initialize the key parameters and the rime ice population;
[0020] The key parameters include population size. Dimension Maximum number of evaluations The number of iterations n and the number of evaluations The evaluation number FEs is initialized to 0;
[0021] Step 42: Increment the evaluation number by 1, and determine whether the evaluation number has reached the maximum evaluation number. If the maximum evaluation number has been reached, the obtained threshold set is the optimal threshold set, and the operation ends; if the maximum evaluation number has not been reached, proceed to steps 43 to 47.
[0022] Step 43: Update the location of the rime population using a soft rime search strategy and a hard rime puncture mechanism;
[0023] Step 44: Use the NCC strategy to generate offspring and add them to the rime ice population;
[0024] The NCC strategy includes an improved horizontal cross-search phase and an improved vertical cross-search phase;
[0025] Step 45: Update the location of the rime ice population using the SW strategy;
[0026] The SW strategy introduces a contraction factor. and restart operator;
[0027] Step 46: Update the rime population using a greedy selection strategy to obtain the optimal threshold set.
[0028] Furthermore, in one embodiment of the present invention, the improved horizontal cross-search stage described in step 44 is achieved through...
[0029]
[0030]
[0031] Obtain the The offspring of the nth dimension position vector of an individual rime ice plant The offspring of the j-th individual rime ice and the n-th dimension position vector ,in, and A random number in the range [-1, 1] Let be the position vector of the i-th individual rime ice in the n-th dimension. For the first j The first individual rime ice n A position vector of a dimension.
[0032] Furthermore, in one embodiment of the present invention, the improved vertical cross-search stage described in step 44 is achieved through...
[0033]
[0034] Obtain the offspring of the m-th dimension position vector of the i-th individual rime ice. ,in, The random numbers are uniformly distributed in the range [0,1]. A random number in the range [-1, 1] For the first i The first individual rime ice n A position vector of dimension For the first i The first individual rime ice m A position vector of a dimension.
[0035] Furthermore, in one embodiment of the present invention, the shrinkage factor described in step 45... Through:
[0036]
[0037] The obtained shrinkage factor .
[0038] Furthermore, in one embodiment of the present invention, the restart operator described in step 45 is achieved through:
[0039]
[0040] Obtain the next generation The position vector of each individual rime ice crystal ,in, For the contemporary first The position vector of each individual Let be the position vector of a random individual. When the th in the population When the position of a member is updated The value is assigned to 0 when the population is the first When the position of a member has not been updated Add 1; It is a constant.
[0041] Option 2: A greenhouse crop disease image segmentation system, comprising the following modules:
[0042] Module 1 is used to obtain disease images of diseased plants in greenhouse crops, and to preprocess the disease images to obtain preprocessed disease images.
[0043] The first module further includes:
[0044] a preprocessing submodule for image cropping, image scaling, image denoising, color enhancement, and image equalization;
[0045] Module two, for carrying out gray processing on the preprocessed disease image to obtain a gray image; processing the gray image by using a non-local mean filtering algorithm to obtain a non-local mean filtering image; and constructing a two-dimensional histogram based on the gray image and the non-local mean filtering image;
[0046] Module three, for taking a maximized two-dimensional Kapur entropy function as a target function, and segmenting the two-dimensional histogram by using a Kapur entropy threshold method to obtain an initial threshold set;
[0047] Module four, for taking the maximized two-dimensional Kapur entropy function as the target function, and searching the initial threshold set by using an improved foggy algorithm to obtain an optimal threshold set;
[0048] The module four further includes an improved foggy algorithm submodule, which includes the following units:
[0049] Unit one, for initializing key parameters and a foggy population based on the initial threshold set;
[0050] The key parameters include a population size , a dimension , a maximum evaluation number , an iteration number n, and an evaluation number , wherein the evaluation number FEs is initialized as 0;
[0051] Unit two, for adding 1 to the evaluation number, judging whether the evaluation number reaches the maximum evaluation number, obtaining the threshold set as the optimal threshold set and ending the operation if the maximum evaluation number is reached, and performing steps 43 to 47 if the maximum evaluation number is not reached;
[0052] Unit three, for updating the position of the foggy population by using a soft foggy search strategy and a hard foggy puncture mechanism;
[0053] Unit four, for generating offspring by using an NCC strategy and adding the offspring to the foggy population;
[0054] The NCC strategy includes an improved horizontal cross search stage and an improved vertical cross search stage;
[0055] Unit five, for updating the position of the foggy population by using an SW strategy;
[0056] The SW strategy introduces a contraction factor and a restart operator;
[0057] Unit six, for updating the fog population by using a greedy selection strategy, obtaining an optimal threshold set;
[0058] Module five, for multi-threshold segmentation of the disease image in module one based on the optimal threshold set, obtaining a disease image with segmented disease area, and completing the greenhouse crop disease image segmentation.
[0059] Scheme three, the electronic device provided by the application comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
[0060] The memory is used for storing a computer program;
[0061] The processor is used for executing the program stored on the memory, and realizes the greenhouse crop disease image segmentation method of any one of the above-mentioned methods.
[0062] Scheme four, the computer readable storage medium provided by the application stores a computer program, and the computer program is executed by the processor to realize the greenhouse crop disease image segmentation method of any one of the above-mentioned methods.
[0063] The crop disease image segmentation method provided by the application is realized based on an improved fog algorithm, effectively alleviates the high false detection rate problem of the existing crop disease image segmentation method in the scenes of faded leaves, uneven light and small disease spots, and improves the disease image segmentation precision, processing speed and robustness, so that better segmentation effect can be obtained, and a reliable scheme is provided for agricultural image processing. Specific beneficial effects include:
[0064] 1. The segmentation method provided by the application is used for realizing multi-threshold segmentation of the crop disease image. The gray histogram of the disease spot of the greenhouse crop disease usually presents a distribution characteristic of multiple peaks and a large difference in peak value ratio. For this "multiple peaks + small target + complex light" scene, the segmentation method provided by the application fuses the two-dimensional gray-non-local mean histogram and the maximum Kapur entropy, and constructs a unique greenhouse crop disease segmentation framework. Then, the improved fog algorithm is used for segmenting the greenhouse crop disease in combination with the characteristics of the greenhouse disease image, and high-efficiency multi-threshold optimization is realized.
[0065] The application avoids the bias of the traditional single-threshold method to the main peak, improves the precision and stability of multi-threshold search in image segmentation, significantly enhances the disease area recognition effect, realizes high-quality segmentation of the greenhouse crop disease area, the disease spot edge is clearer, the area integrity is better, and excellent overall performance is shown. The application can meet the actual needs of accurate identification of greenhouse crop diseases, and can also evaluate the growth and health status of greenhouse crop diseases according to the disease condition, and timely perform corresponding treatment.
[0066] 2、The improved fog algorithm used in the method of the present application is a multi-threshold segmentation method based on swarm intelligence optimization algorithm. The calculation amount and calculation time of traditional multi-threshold segmentation method for solving optimal threshold are difficult to accept, while the swarm intelligence optimization algorithm can obtain the approximate optimal solution of multiple thresholds in a relatively short time. At present, multi-threshold segmentation based on swarm intelligence algorithm has performed well in medical imaging field, but it is still in the blank stage in agricultural disease detection. This is because there are obvious differences between medical imaging and agricultural disease image in acquisition conditions and segmentation objects: the medical imaging acquisition environment is relatively stable, and the image contrast and clarity are relatively high; while the agricultural disease image is affected by factors such as natural light change, leaf shielding, disease spot color and morphological complexity, so that the method needs to overcome great technical difficulties for conversion, and the segmentation effect after conversion is not ideal, so there is a problem of insufficient adaptability for direct application in agricultural disease segmentation.
[0067] The improved fog algorithm of the present application integrates NCC strategy and SW strategy on the basis of fog algorithm through population initialization, soft fog search strategy, hard fog piercing mechanism, NCC strategy, SW strategy and fog algorithm greedy selection mechanism. While maintaining high convergence accuracy, it effectively alleviates the defect that fog algorithm is easy to fall into local optimum. Through global guidance and local fine adjustment of threshold search process, the edge of greenhouse crop disease area is clearer, and the integrity of disease spot area is higher. Therefore, the improved fog algorithm of the present application can strengthen exploration or development ability at different stages of the algorithm, the design of NCC strategy can maintain population diversity, adapt to the diversity characteristics of greenhouse crop disease spot in shape and direction, avoid search from falling into a single direction, and thus improve the adaptability to complex disease spot area; SW strategy strengthens the balance between global exploration and local development through the setting of shrinkage control factor and restart operator, which helps to obtain stable threshold combination under the condition of small disease spot, low contrast and complex light. Thus, better segmentation can be achieved in multi-threshold image segmentation task, without manual annotation data, with high calculation efficiency, strong adaptability and good stability, and it is expected to become an effective tool for greenhouse crop disease image segmentation.
[0068] 3、The present application can be widely applied to greenhouse crop disease image segmentation tasks under different light and different background, basically solving the problem of high false detection rate of traditional methods in faded leaves, uneven light and small disease spot scenes, and can obtain better segmentation effect, providing a reliable scheme for agricultural image processing. It can significantly improve the automation level of greenhouse crop disease recognition, reduce manual misjudgment rate, help to improve the efficiency of pesticide use, reduce agricultural production cost, and is suitable for key links such as disease monitoring and precise prevention in intelligent agriculture, has important practical value for intelligent agriculture and precise prevention and control of pests and diseases, and has significant practical value and popularization prospect.
[0069] The method described in the application is suitable for processing strawberry disease images in the field of greenhouse crop disease image processing. BRIEF DESCRIPTION OF DRAWINGS
[0070] The above-mentioned and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments, in conjunction with the accompanying drawings, in which:
[0071] Figure 1 is a flow chart of the crop disease image segmentation method according to embodiment one.
[0072] Figure 2 is a flow chart of the improved fog and snow algorithm according to embodiment two.
[0073] Figure 3 is a comparison chart for example pictures according to embodiment one, in which (a) is the original image before segmentation, (b) is the image after segmentation using the improved fog and snow algorithm described in the application, and (c) is the image after segmentation using the fog and snow algorithm. DETAILED DESCRIPTION
[0074] Various embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described by reference to the accompanying drawings are exemplary and are intended to explain the present application, and cannot be understood as limiting the present application.
[0075] Embodiment one, the greenhouse crop disease image segmentation method according to the present embodiment, comprises the following steps:
[0076] Step one, obtaining a disease image of a greenhouse crop disease plant, pre-processing the disease image to obtain a pre-processed disease image;
[0077] The pre-processing includes image cropping, image scaling, image denoising, color enhancement and image equalization;
[0078] Step two, performing grayscale processing on the pre-processed disease image to obtain a grayscale image; processing the grayscale image using a non-local mean filtering algorithm to obtain a non-local mean filtering image; and constructing a two-dimensional histogram based on the grayscale image and the non-local mean filtering image;
[0079] Step three, using a maximized two-dimensional Kapur entropy function as an objective function, and using a Kapur entropy threshold method to segment the two-dimensional histogram to obtain an initial threshold set;
[0080] Step four, using a maximized two-dimensional Kapur entropy function as an objective function, and using an improved fog and snow algorithm to search for the initial threshold set to obtain an optimal threshold set;
[0081] Step five, multi-threshold segmentation is performed on the disease image in step one based on the optimal threshold set, to obtain a disease image in which the disease area is segmented, and the greenhouse crop disease image segmentation is completed.
[0082] In this embodiment, the disease image of the greenhouse crop disease plant in step one is preferably obtained by periodically collecting the disease image of the greenhouse crop disease plant using an industrial camera or a high-definition monitoring device arranged in the greenhouse crop disease greenhouse.
[0083] In this embodiment, the image cropping in step one is specifically cropping the diseased leaf area. The image scaling is preferably uniform image size, for example, uniform 500x310 pixels, to ensure consistent image dimensions during the segmentation process. The image denoising is specifically to eliminate salt and pepper and fuzzy noise in the image using median filtering. The color enhancement and histogram equalization are specifically to enhance the contrast of the image and enhance the difference between the disease area and the background.
[0084] In this embodiment, the non-local mean filtering algorithm is used to process the gray-scale image in step two to obtain a non-local mean filtering image, specifically according to:
[0085]
[0086] The non-local mean filtering image is obtained , wherein is the weight for weighted average, is the gray value of the pixel point .
[0087] wherein the weight for weighted average is obtained by:
[0088] Step 21, according to
[0089]
[0090] the local mean of the pixel point is obtained; wherein is the gray value of the pixel point , wherein represents the length of the neighborhood window centered on the pixel point , represents the set of pixel points in the window, and the total number of neighborhood pixels is .
[0091] Step 22, according to
[0092]
[0093] Get pixels Local mean ;
[0094] Step 23, according to
[0095]
[0096] The weights for obtaining the weighted average .
[0097] In this embodiment, step two, which involves constructing a two-dimensional histogram based on the grayscale image and the non-local mean filtered image, specifically means that the x-axis of the two-dimensional histogram represents the grayscale value of the grayscale image of the greenhouse crop disease to be segmented, the y-axis represents the grayscale value of the non-local mean filtered image, and the z-axis of the two-dimensional histogram... According to
[0098]
[0099] Obtain the z-axis value of a 2D histogram. ,in It is a pixel Number of times it appears express The probability density, , The size of the preprocessed disease image.
[0100] In this embodiment, step three, which involves maximizing the two-dimensional Kapur entropy function as the objective function, is achieved through...
[0101]
[0102] Obtain the optimal threshold ,in, It is a two-dimensional Kapur entropy function.
[0103] In this embodiment, it is preferable to complete the greenhouse crop disease image segmentation in step five, and then, based on...
[0104]
[0105] The regional disease rate was obtained, among which, This represents the number of pixels in the lesion area of the disease image. This represents the total number of pixels in the diseased image (including both healthy and diseased areas).
[0106] The segmentation method of the embodiment is a high-quality and general-purpose disease image segmentation method for various greenhouse crops. The segmentation precision is enhanced by performing preprocessing operations on the collected images. The problem of color and uneven illumination of greenhouse crop disease pathology images is alleviated by jointly modeling the grayscale image and its corresponding non-local mean image and constructing a two-dimensional grayscale histogram. The two-dimensional histogram can comprehensively consider the pixel itself and its context neighborhood information, which helps to enhance the description ability of the edge and detail area.
[0107] On the basis of the two-dimensional grayscale-non-local mean histogram, a unique greenhouse crop disease segmentation framework is constructed by fusing the maximum Kapur entropy. Then, the improved fog and ice algorithm is used to segment the greenhouse crop diseases in combination with the characteristics of the greenhouse disease images, thereby realizing efficient multi-threshold optimization, avoiding the bias of the main peak in the traditional single-threshold method, and improving the precision and stability of multi-threshold search in image segmentation. The disease area recognition effect is significantly enhanced, and high-quality segmentation of the greenhouse crop disease area is realized. The disease spot edge is clearer, and the area integrity is better, with high efficiency and good segmentation effect.
[0108] In order to demonstrate the segmentation effect of the embodiment on greenhouse crop leaf diseases, an embodiment is provided. The strawberry disease images obtained in the greenhouse area are selected. The 72 greenhouse area strawberry disease collection images are preprocessed, and the size is unified to 500x310. Then, 9 disease images are randomly selected for segmentation. The segmentation method of the embodiment and the fog and ice algorithm are used for effect comparison and verification. The two methods are independently run for 20 times. The segmentation effect comparison is shown in Figure 3 As can be observed, it can be clearly seen that compared with Figure 3 (a), Figure 3 (c) The segmentation effect of the existing fog and ice algorithm has high false detection rate in the scenes of faded leaves, uneven illumination and small disease spots, and even detects part of the non-disease area as disease area, while Figure 3 (b) The segmentation effect of the embodiment is more superior in disease spot edge positioning, area integrity and noise suppression, and can more accurately extract the disease area, and has stronger robustness to background interference.
[0109] Embodiment two, the embodiment is a further limitation of the greenhouse crop disease image segmentation method of embodiment one. In the embodiment, the two-dimensional Kapur entropy objective function in step three is:
[0110]
[0111] wherein, is the number of sub-regions divided on the main diagonal line of the two-dimensional histogram, is the gray value of the grayscale image, is the gray value of the non-local mean filtered image, is the Kapur entropy in the kth diagonal region.
[0112] In this embodiment, the acquisition process is as follows:
[0113] Step 31, according to
[0114]
[0115] obtain the probability value of the kth sub-region , wherein is the probability (i.e. pixel ratio) of the joint occurrence of the gray value in the two-dimensional histogram (original gray image) and j (non-local mean image); , , are the threshold boundaries of the kth sub-region in the gray image direction respectively, , , are the threshold boundaries of the kth sub-region in the non-local mean image direction respectively.
[0116] Step 32, according to
[0117]
[0118] obtain the Kapur entropy in the kth diagonal region .
[0119] This embodiment is a further limitation of step three, which describes the two-dimensional Kapur entropy function in step three. Kapur entropy is an entropy measurement method derived from information theory, which can measure the information uncertainty of different regions of an image. In multi-threshold image segmentation, by maximizing the total Kapur entropy of each sub-region of the image, the optimal threshold combination of information distribution can be obtained, thereby enhancing the discriminability between regions and improving the accuracy and stability of the segmentation result. This embodiment constructs a two-dimensional gray histogram combining the original gray image and the corresponding non-local mean image, and uses the maximum two-dimensional Kapur entropy as the objective function to guide the Kapur entropy threshold method and the improved glaze algorithm to search in the threshold space, so that the diseased region and the healthy region are more separable in the information entropy space, improving the adaptability and universality of the segmentation model. Thus, without manual annotation, it can accurately distinguish between mild disease spots and healthy tissue, and can be widely used in greenhouse crop disease image segmentation tasks under different lighting and different backgrounds, with strong adaptability.
[0120] Embodiment three, the method for image segmentation of greenhouse crop disease according to Embodiment one is further limited, in the embodiment, the improved fog algorithm in step four includes the following steps:
[0121] Step 41, based on the initial threshold set, initialize the key parameters and fog population;
[0122] The key parameters include population size , dimension , maximum evaluation number , iteration number n and evaluation number , wherein the evaluation number FEs is initialized to 0;
[0123] Step 42, add 1 to the evaluation number, judge whether the evaluation number reaches the maximum evaluation number, if the maximum evaluation number is reached, the threshold set obtained is the optimal threshold set, and the operation is ended; if the maximum evaluation number is not reached, steps 43 to 47 are performed;
[0124] Step 43, update the position of the fog population by using the soft fog search strategy and the hard fog puncture mechanism;
[0125] Step 44, generate offspring by using the NCC strategy and add them to the fog population;
[0126] The NCC strategy includes an improved horizontal cross search stage and an improved vertical cross search stage;
[0127] Step 45, update the position of the fog population by using the SW strategy;
[0128] The SW strategy introduces a contraction factor and a restart operator;
[0129] Step 46, update the fog population by using the greedy selection strategy to obtain the optimal threshold set.
[0130] In the embodiment, a random number generator is preferably used to initialize the fog population in step 41 , the is
[0131]
[0132] , wherein ; is the th fog individual, is the th dimension.
[0133] In the embodiment, the soft fog search strategy in step 43 is specifically according to
[0134]
[0135] obtaining the position of the updated fog population wherein, is the current optimal fog individual, representing the optimal solution; and a random number controlling the movement of the fog individual; is the degree of adhesion between two particles; and are the upper and lower boundaries of the problem space, respectively.
[0136] According to
[0137]
[0138] obtaining the behavior parameter controlling the movement of the fog individual .
[0139] According to
[0140]
[0141] obtaining the step function of the environmental coefficient affecting the soft fog search strategy wherein, represents rounding, and controls the number of segments of .
[0142] According to
[0143]
[0144] obtaining the adhesion coefficient , together with control the condensation of the fog population.
[0145] In this embodiment, the hard fog puncture mechanism described in step 43 is specifically according to
[0146]
[0147] obtaining the position of the updated fog population wherein, is the fitness value, is the normalized value of , together with the random number control the exchange probability of particles.
[0148] In this embodiment, the SW strategy described in step 45 is according to
[0149]
[0150] Obtain the previous generation's first The location of each individual rime ice crystal ,in, It refers to random individuals within the search range; and These represent the current searched individual and the current best individual, respectively. and All represent random parameters, with a value range of [value range missing]. These control parameters govern the current search agent's exploration direction and steps. It is a search agent passed on by a population search agent. It refers to the dimensionality of the search problem, in image multi-threshold segmentation tasks. This corresponds to the number of thresholds required for segmentation.
[0151] In this embodiment, the greedy selection strategy described in step 46 is based on
[0152]
[0153] Obtained in the The middle generation Individual rime ice ,in, Let i be the i-th rime ice individual in the t-th generation; Let i be the i-th candidate solution. for Kapur entropy, for Kapur entropy.
[0154] In this embodiment, the maximum number of evaluations The preferred value is 100.
[0155] This embodiment further defines step four and describes the improved rime ice algorithm described in step four. This algorithm is based on the rime ice algorithm, integrates the NCC strategy and the SW strategy, and then searches and updates the local optimal threshold in the threshold space. The optimization objective is to maximize the total Kapur entropy. It iterative updates are performed until the number of iterations is greater than or equal to the maximum preset value, and the final optimal threshold is obtained.
[0156] Due to the strong randomness and wide coverage of individual rime ice plants, the soft rime ice search strategy ensures that the rime ice population quickly covers the entire solution space. The hard rime ice piercing mechanism, utilizing the global optimum, is a key step in the algorithm. This operation is used between rime ice plants to control particle exchange between the current rime ice plant and the current globally optimal rime ice plant.
[0157] In the foggy algorithm, the optimal individual guides the whole group to develop in a more promising search direction. But due to the frequent learning of the optimal individual, the algorithm is easy to fall into local optimum. Therefore, the embodiment combines NCC strategy and SW strategy, wherein the NCC strategy maintains the diversity of the algorithm optimization process to adapt to the diverse changes of lesion morphology. The SW strategy is a controller that adjusts the balance between global exploration and local development, so that the algorithm can fully learn the experience of the current optimal individual and historical individuals, and promote different position vectors of individuals to learn from each other. By introducing the contraction factor and the restart operator, the problems existing in the original algorithm are solved, the ability of the algorithm to escape from local optimum and find global optimal solution is enhanced, the development ability of the algorithm is strengthened, and the missed detection of small lesions is reduced.
[0158] Embodiment four, this embodiment is a further limitation of the greenhouse crop disease image segmentation method of embodiment two, in this embodiment, the improved horizontal crossover search stage in step 44 is realized by,
[0159]
[0160]
[0161] obtain the first dimensional position vector of the jth foggy individual and the offspring of the nth dimensional position vector of the jth foggy individual , wherein, and are random numbers in [-1, 1], is the nth dimensional position vector of the ith foggy individual, is the nth dimensional position vector of the jth foggy individual. j n
[0162] This embodiment is a further limitation of step 44, and the improved horizontal crossover search stage in step 44 is exemplified. This method is inspired by DE algorithm, which is different from the original horizontal crossover search using two different foggy individuals. The improved horizontal crossover search stage formula introduces a third new individual , which enhances the randomness of the improved foggy algorithm and enriches the diversity of the foggy population.
[0163] Embodiment five, this embodiment is a further limitation of the greenhouse crop disease image segmentation method of embodiment three, in this embodiment, the improved vertical crossover search stage in step 44 is realized by,
[0164]
[0165] the mthdimensional position vector of the ithfoggy individual wherein, is a random number uniformly distributed in [0,1], is a random number in [-1,1], is the mthdimensional position vector of the ithfoggy individual, i is the mthdimensional position vector of the ithfoggy individual, n is the mthdimensional position vector of the ithfoggy individual. is the mthdimensional position vector of the ithfoggy individual. i is the mthdimensional position vector of the ithfoggy individual. m is the mthdimensional position vector of the ithfoggy individual.
[0166] This embodiment is a further limitation of step 44, which illustrates the improved vertical crossover search phase strategy described in step 44. This method performs a vertical crossover operation on the first dimensional position vector of the ithfoggy individual and the first dimensional position vector of the ithfoggy individual, introducing in the original vertical crossover search strategy, so that the two dimensions of the individual learn from each other to produce a new individual. In turn, this promotes the different position vectors of the individual to learn from each other, thereby enhancing their ability to escape local optima. Embodiment six, this embodiment is a further limitation of the greenhouse crop disease image segmentation method described in embodiment three. In this embodiment, the SW strategy described in step 45 is performed by:
[0167]
[0168]
[0169] obtaining the contraction factor .
[0170] This embodiment is a further limitation of step 45, which illustrates the SW strategy described in step 45. In this strategy, the contraction factor increases from 0 to 1 as the number of algorithm evaluations increases, controlling the search process of the population: in the early stages of iteration, its value tends to 0, and the search population will explore more space; while in the later stages of iteration, its value tends to 1, and the foggy population will develop around the current optimal solution.
[0171] Embodiment seven, this embodiment is a further limitation of the greenhouse crop disease image segmentation method described in embodiment three. In this embodiment, the restart operator described in step 45 is performed by:
[0172]
[0173] obtaining the position vector of the next generation of the ithfoggy individual wherein, is the mthdimensional position vector of the ithfoggy individual, is the mthdimensional position vector of the ithfoggy individual. the position vector of the individual, is the position vector of the random individual, when the position of the individual in the population is updated, is assigned the value 0, when the position of the individual in the population is not updated, is incremented by 1; is a constant. In the embodiment, the constant is preferably set to 300.
[0174] In the embodiment, the constant is preferably set to 300. In the embodiment, the constant is preferably set to 300.
[0175] The embodiment is a further limitation of step 45, which illustrates the restart operator described in step 45, which evaluates a certain number of limits, when the current search individual is no longer updated to a better quality position, it means that the algorithm is largely trapped in a local optimum, so it is necessary to set the restart operator, which can increase the probability of the search individual escaping from the local optimum.
Claims
1. A method for image segmentation of greenhouse crop diseases, characterized in that, The method comprises the following steps: Step one, obtaining a disease image of a greenhouse crop disease plant, and pre-processing the disease image to obtain a pre-processed disease image; The pre-processing comprises image cropping, image scaling, image denoising, color enhancement and image equalization; Step two, performing grayscale processing on the pre-processed disease image to obtain a grayscale image; and processing the grayscale image by using a non-local mean filtering algorithm to obtain a non-local mean filtering image; A two-dimensional histogram is constructed based on the grayscale image and the non-local mean filtering image; Step three, taking a maximized two-dimensional Kapur entropy function as a target function, and segmenting the two-dimensional histogram by using a Kapur entropy threshold method to obtain an initial threshold set; Step four, taking the maximized two-dimensional Kapur entropy function as a target function, and searching the initial threshold set by using an improved fog and ice algorithm to obtain an optimal threshold set; The improved fog and ice algorithm in step four comprises the following steps: Step 41, initializing key parameters and a fog and ice population based on the initial threshold set; The key parameters include population size , dimension , maximum evaluations , number of iterations n and evaluations FEs is initialized to 0; Step 42, adding 1 to an evaluation number, and determining whether the evaluation number reaches a maximum evaluation number; if the evaluation number reaches the maximum evaluation number, the obtained threshold set is the optimal threshold set, and the operation is ended; if the evaluation number does not reach the maximum evaluation number, steps 43 to 47 are performed; Step 43, updating positions of the fog and ice population by using a soft fog and ice search strategy and a hard fog and ice piercing mechanism; Step 44, generating offspring by using an NCC strategy and adding the offspring to the fog and ice population; The NCC strategy comprises an improved horizontal cross search stage and an improved vertical cross search stage; Step 45, updating the positions of the fog and ice population by using an SW strategy; The SW policy incorporates a shrink factor and a restart operator; Step 46, updating the fog and ice population by using a greedy selection strategy to obtain the optimal threshold set; Step five, performing multi-threshold segmentation on the disease image in step one based on the optimal threshold set to obtain a disease image in which a lesion region is segmented, and completing segmentation of the greenhouse crop disease image.
2. The method according to claim 1, wherein, The two-dimensional Kapur entropy function in step three is: wherein, is the number of sub-regions divided on the main diagonal of the two-dimensional histogram, is the gray value of the gray-scale image, is the gray value of the non-local mean filtered image, is the Kapur entropy in the diagonal region. 3.The greenhouse crop disease image segmentation method according to claim 1, characterized in that, The improved horizontal cross search stage in step 44 is achieved by, Obtain the nth dimension position vector of the jth fog individual and the nth dimension position vector of the jth fog individual and the nth dimension position vector of the jth fog individual wherein, and is a random number in [-1, 1], is the nth dimension position vector of the jth fog individual i is the nth dimension position vector of the jth fog individual n is the nth dimension position vector of the jth fog individual is the nth dimension position vector of the jth fog individual j is the nth dimension position vector of the jth fog individual n is the nth dimension position vector of the jth fog individual 4. The method of claim 1, wherein the method is characterized by, The improved vertical cross search stage in step 44 is achieved by, Obtain the offspring of the m-th dimension position vector of the i-th individual rime ice. ,in, The random numbers are uniformly distributed in the range [0,1]. A random number in the range [-1, 1] For the first i The first individual rime ice n A position vector of dimension For the first i The first individual rime ice m A position vector of a dimension.
5. The method of claim 1, wherein the method is characterized by, the shrinkage factor of step 45 by: obtained shrinkage factor . 6.The greenhouse crop disease image segmentation method according to claim 1, characterized in that, The restart operator in step 45 is achieved by: obtaining a position vector of a next generation of the fog droplet, wherein, is a position vector of a contemporary of the fog droplet, is a position vector of a random fog droplet, when a position of a member of the population is updated, is assigned a value of 0, when a position of a member of the population is not updated, is incremented by 1; is a constant. 7.A greenhouse crop disease image segmentation system, characterized by, The method comprises the following modules: Module one is used for obtaining a disease image of a greenhouse crop disease plant, and pre-processing the disease image to obtain a pre-processed disease image; The module one further comprises: A pre-processing sub-module is used for image cropping, image scaling, image denoising, color enhancement and image equalization; Module two is used for performing grayscale processing on the pre-processed disease image to obtain a grayscale image; processing the grayscale image by using a non-local mean filtering algorithm to obtain a non-local mean filtering image; and constructing a two-dimensional histogram based on the grayscale image and the non-local mean filtering image; Module three is used for taking a maximized two-dimensional Kapur entropy function as a target function, and segmenting the two-dimensional histogram by using a Kapur entropy threshold method to obtain an initial threshold set; Module four is used for searching the initial threshold set by using an improved fog algorithm to maximize the two-dimensional Kapur entropy function as an objective function, to obtain an optimal threshold set; The module four further comprises an improved fog algorithm submodule, which comprises the following units: Unit one is used for initializing key parameters and a fog population based on the initial threshold set; The key parameters include population size , dimension , maximum evaluations , number of iterations n and evaluations , where evaluations FEs are initialized to 0; Unit two is used for adding 1 to an evaluation number, judging whether the evaluation number reaches the maximum evaluation number, obtaining the threshold set as the optimal threshold set if the maximum evaluation number is reached, and ending the operation; if the maximum evaluation number is not reached, steps 43 to 47 are performed; Unit three is used for updating the position of the fog population by using a soft fog search strategy and a hard fog puncture mechanism; Unit four is used for generating offspring by using an NCC strategy to join the fog population; The NCC strategy comprises an improved horizontal cross search stage and an improved vertical cross search stage; Unit five is used for updating the position of the fog population by using an SW strategy; The SW policy incorporates a shrink factor and a restart operator; Unit six is used for updating the fog population by using a greedy selection strategy to obtain the optimal threshold set; Module five is used for performing multi-threshold segmentation on the disease image in module one based on the optimal threshold set, to obtain a disease image in which a lesion region is segmented, and to complete the greenhouse crop disease image segmentation.
8. An electronic device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the greenhouse crop disease image segmentation method in any one of claims 1-6. The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the greenhouse crop disease image segmentation method in any one of claims 1-6. 9. A computer-readable storage medium, characterized in that,
Citation Information
Patent Citations
Medical image segmentation threshold determination method and device, medium and equipment
CN119068011A
Corn germination image segmentation method based on elite adaptive rime algorithm
CN120510170A