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 problems of accuracy and generalization ability of crop disease image segmentation under complex lighting and leaf occlusion were solved, achieving efficient and robust disease region segmentation, which is suitable for smart agriculture.
Patent Information
- Application Number
- CN202511375302.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-09-25
AI Technical Summary
Existing crop disease image segmentation methods suffer from low segmentation accuracy, poor generalization ability, and difficulty in identifying small lesions in agricultural scenarios with complex lesion morphology, drastic changes in lighting, and leaf occlusion.
An improved haze algorithm combined with the two-dimensional Kapur entropy thresholding method and nonlocal mean filtering is adopted. Multi-threshold segmentation is performed by image preprocessing, grayscale conversion, construction of two-dimensional histogram, maximization of two-dimensional Kapur entropy function and search for optimal threshold set using the improved haze algorithm.
It improves the accuracy and speed of disease image segmentation, enhances robustness, significantly improves the identification effect of disease areas, reduces the human error rate, adapts to different lighting and backgrounds, and is suitable for disease monitoring and precision prevention in smart agriculture.
Smart Images

Figure CN120876525A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology for ground scenes, and also to the field of crop disease identification technology. Background Technology
[0002] In modern agriculture, especially in greenhouse crop cultivation, timely and accurate identification of crop diseases is crucial for timely prevention and control, ensuring crop quality and yield. Among existing technologies, image-based crop disease identification is relatively advanced, with image segmentation being a core technique. Segmented images significantly improve the automation level of greenhouse crop disease identification, reduce human error rates, and help improve pesticide application efficiency and lower agricultural production costs.
[0003] Image segmentation refers to the process of dividing an image into several regions with different characteristics and extracting the target region. It is a prerequisite for image processing and pattern recognition. Furthermore, image segmentation of greenhouse crop diseases is a necessary prerequisite for assessing the severity of plant diseases and identifying disease types. Common methods for greenhouse crop disease image segmentation include thresholding, region extraction, and deep learning-based segmentation methods, such as UNet and YOLO.
[0004] For region extraction methods and deep learning-based segmentation methods, due to factors such as the variable morphology and complex color of lesions, uneven lighting, and leaf shading in the actual field environment, the existing region extraction methods and deep learning-based segmentation methods have insufficient segmentation accuracy, are not sensitive enough to early small lesions, and have limited model generalization ability.
[0005] Thresholding segmentation has become the most basic and widely used image segmentation technique due to its advantages such as simple calculation, high computational efficiency, and stable performance. Thresholding segmentation methods can be divided into single-threshold segmentation and multi-threshold segmentation based on the number of thresholds. Single-threshold segmentation uses a single threshold to segment the image into only the target and background; multi-threshold segmentation uses multiple thresholds to segment the image into multiple regions according to actual needs. Furthermore, since the threshold directly affects the image segmentation result, it also directly affects the final effect of image processing and pattern recognition. However, the computational cost and time required for traditional thresholding optimization methods to find the optimal threshold are unacceptable.
[0006] In summary, existing image segmentation methods for crop disease identification often face problems such as low segmentation accuracy, poor generalization ability, and difficulty in identifying small lesions when dealing with agricultural scenarios involving complex lesion morphology, drastic changes in light, and leaf occlusion. Summary of the Invention
[0007] This invention alleviates the problems of low segmentation accuracy, poor generalization ability, and difficulty in identifying small lesions faced by existing crop disease image segmentation methods in agricultural scenarios such as complex lesion morphology, drastic light changes, and leaf occlusion. Furthermore, it improves the segmentation accuracy, processing speed, and robustness of disease images. This invention provides the following solution: Option 1: A method for image segmentation of greenhouse crop diseases, comprising the following steps: Step 1: Obtain disease images of diseased plants in greenhouse crops, and preprocess the disease images to obtain preprocessed disease images; The preprocessing includes image cropping, image scaling, image denoising, color enhancement, and image equalization; Step 2: Convert the preprocessed disease image to grayscale to obtain a grayscale image; process the grayscale image using a nonlocal mean filtering algorithm to obtain a nonlocal mean filtered image; construct a two-dimensional histogram based on the grayscale image and the nonlocal mean filtered image. Step 3: Using the maximization of the two-dimensional Kapur entropy function as the objective function, the two-dimensional histogram is segmented using the Kapur entropy thresholding method to obtain an initial threshold set; Step four: Using the maximization of the two-dimensional Kapur entropy function as the objective function, the improved rime algorithm is used to search the initial threshold set to obtain the optimal threshold set; Step 5: Perform multi-threshold segmentation on the disease image described in Step 1 based on the optimal threshold set to obtain a disease image with the diseased area segmented out, thus completing the greenhouse crop disease image segmentation.
[0008] Furthermore, in one embodiment of the present invention, the two-dimensional Kapur entropy function described in step three is:
[0009] in, This represents the number of sub-regions divided along the main diagonal of the two-dimensional histogram. The grayscale value of the grayscale image. The grayscale value of the non-local mean filtered image. It is the first Kapur entropy in a diagonal region.
[0010] Furthermore, in one embodiment of the present invention, the improved rime ice algorithm described in step four includes the following steps: Step 41: Based on the initial threshold set, initialize the key parameters and the rime ice population; 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; 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. Step 43: Update the location of the rime population using a soft rime search strategy and a hard rime puncture mechanism; Step 44: Use the NCC strategy to generate offspring and add them to the rime ice population; The NCC strategy includes an improved horizontal cross-search phase and an improved vertical cross-search phase; Step 45: Update the location of the rime ice population using the SW strategy; The SW strategy introduces a contraction factor. and restart operator; Step 46: Update the rime population using a greedy selection strategy to obtain the optimal threshold set.
[0011] Furthermore, in one embodiment of the present invention, the improved horizontal cross-search stage described in step 44 is achieved through...
[0012]
[0013] 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 nth dimension of the i-th individual rime ice.
[0014] Furthermore, in one embodiment of the present invention, the improved vertical cross-search stage described in step 44 is achieved through...
[0015] 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].
[0016] Furthermore, in one embodiment of the present invention, the shrinkage factor described in step 45... Through:
[0017] The obtained shrinkage factor .
[0018] Furthermore, in one embodiment of the present invention, the restart operator described in step 45 is achieved through:
[0019] 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.
[0020] Option 2: A greenhouse crop disease image segmentation system, comprising the following modules: 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. The first module further includes: The preprocessing submodule is used for image cropping, image scaling, image denoising, color enhancement, and image equalization. Module 2 is used to perform grayscale processing on the preprocessed disease image to obtain a grayscale image; process the grayscale image using a nonlocal mean filtering algorithm to obtain a nonlocal mean filtered image; and construct a two-dimensional histogram based on the grayscale image and the nonlocal mean filtered image. Module 3 is used to segment the two-dimensional histogram using the Kapur entropy function as the objective function and the Kapur entropy thresholding method to obtain an initial threshold set. Module 4 is used to search the initial threshold set using an improved rime algorithm, taking the maximization of the two-dimensional Kapur entropy function as the objective function, to obtain the optimal threshold set; Module 5 is used to perform multi-threshold segmentation on the disease image described in Module 1 based on the optimal threshold set, to obtain a disease image with the diseased area segmented out, and to complete the segmentation of greenhouse crop disease images.
[0021] Option 3: An electronic device according to the present invention includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor, when executing a program stored in memory, implements any of the above-described methods for segmenting images of greenhouse crop diseases.
[0022] Option 4: A computer-readable storage medium according to the present invention, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the above-described methods for segmenting images of greenhouse crop diseases.
[0023] The crop disease image segmentation method described in this invention is based on an improved frost algorithm proposed in this invention. It effectively alleviates the high false detection rate of existing crop disease image segmentation methods in scenarios with faded leaves, uneven lighting, and small lesions. Furthermore, it improves the segmentation accuracy, processing speed, and robustness, achieving superior segmentation results and providing a reliable solution for agricultural image processing. Specific beneficial effects include: 1. The segmentation method described in this invention is used to achieve multi-threshold segmentation of crop disease images. The gray-level histogram of lesions in greenhouse crops typically exhibits a multi-peak distribution with significantly varying peak proportions. For this scenario of "multi-peak + small target + complex lighting," the segmentation method of this invention fuses a two-dimensional gray-level non-local mean histogram with maximum Kapur entropy to construct a unique greenhouse crop disease segmentation framework. Then, combining the characteristics of greenhouse disease images, an improved frost algorithm is used to segment greenhouse crop diseases, thereby achieving efficient multi-threshold optimization.
[0024] This invention avoids the bias of traditional single-threshold methods towards the main peak and improves the accuracy and stability of multi-threshold search in image segmentation, significantly enhancing the identification effect of diseased areas and achieving high-quality segmentation of diseased areas in greenhouse crops. The edges of lesions are clearer and the integrity of the areas is better, showing excellent overall performance. It can meet the actual needs of accurate identification of diseases in greenhouse crops and can also assess the growth and health status of greenhouse crops based on the disease situation, allowing for timely treatment.
[0025] 2. The improved rime ice algorithm used in the method described in this invention is a multi-threshold segmentation method based on swarm intelligence optimization. Traditional multi-threshold segmentation methods suffer from unacceptable computational load and time in finding the optimal threshold, while swarm intelligence optimization can obtain approximate optimal solutions for multiple thresholds in a shorter time. Currently, multi-threshold segmentation based on swarm intelligence algorithms has shown excellent performance in the field of medical imaging, but it is still in its infancy in agricultural disease detection. This is because medical images and agricultural disease images differ significantly in terms of acquisition conditions and segmentation objects: medical images are acquired in a relatively stable environment, with relatively high image contrast and clarity; while agricultural disease images are affected by factors such as changes in natural light, leaf occlusion, and the complexity of lesion color and morphology. This makes the conversion of the method require overcoming significant technical difficulties, and the segmentation effect after conversion is not ideal. Therefore, its direct application to agricultural disease segmentation suffers from insufficient adaptability.
[0026] The improved rime ice algorithm described in this invention incorporates population initialization, a soft rime ice search strategy, a hard rime ice puncture mechanism, an NCC strategy, a SW strategy, and a greedy selection mechanism from the rime ice algorithm. Essentially, it integrates the NCC and SW strategies into the rime ice algorithm. While maintaining high convergence accuracy, it effectively alleviates the rime ice algorithm's tendency to get trapped in local optima. Through global guidance and local fine-tuning of the threshold search process, the edges of diseased areas in greenhouse crops become clearer, and the integrity of lesion areas is higher. Therefore, the improved rime ice algorithm described in this invention can specifically enhance exploration or development capabilities at different stages of the algorithm. The NCC strategy maintains population diversity, adapting to the diverse morphological and directional characteristics of lesions in greenhouse crops, avoiding the search from getting trapped in a single direction, thereby improving adaptability to complex lesion areas. The SW strategy, through the setting of shrinkage control factors and restart operators, strengthens the balance between global exploration and local development, helping to obtain stable threshold combinations even under conditions of small lesions, low contrast, and complex lighting. This technology offers superior performance in multi-threshold image segmentation tasks, eliminating the need for manual data annotation, boasting high computational efficiency, strong adaptability, and good stability. It is expected to become an effective tool for image segmentation of diseases in greenhouse crops.
[0027] 3. This invention is widely applicable to image segmentation tasks of greenhouse crop diseases under different lighting and background conditions. It essentially solves the problem of high false detection rates in traditional methods under scenarios with faded leaves, uneven lighting, and small lesions, achieving better segmentation results and providing a reliable solution for agricultural image processing. It can significantly improve the automation level of greenhouse crop disease identification, reduce the rate of human error, help improve pesticide use efficiency, and reduce agricultural production costs. It is suitable for key aspects of smart agriculture such as disease monitoring and precision control, and has significant practical value for smart agriculture and precise pest and disease control, demonstrating significant practical value and promising prospects for promotion.
[0028] The method described in this invention is applicable to the processing of strawberry disease images in the field of greenhouse crop disease image processing. Attached Figure Description
[0029] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 This is a flowchart of the crop disease image segmentation method described in Implementation Method 1.
[0030] Figure 2 This is a flowchart of the improved frost algorithm described in Implementation Method 2.
[0031] Figure 3 This is a comparison image of the example images as described in Implementation Method 1, wherein... Figure 3 Figure (a) in the image is the original image before segmentation. Figure 3 Figure (b) shows the image segmented using the improved frost algorithm described in this invention. Figure 3 Figure (c) shows the image segmented using the frost algorithm. Detailed Implementation
[0032] Various embodiments of the present invention will now be clearly and completely described with reference to the accompanying drawings. The embodiments described with reference to the drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.
[0033] Implementation Method 1: The greenhouse crop disease image segmentation method described in this implementation method includes the following steps: Step 1: Obtain disease images of diseased plants in greenhouse crops, and preprocess the disease images to obtain preprocessed disease images; The preprocessing includes image cropping, image scaling, image denoising, color enhancement, and image equalization; Step 2: Convert the preprocessed disease image to grayscale to obtain a grayscale image; process the grayscale image using a nonlocal mean filtering algorithm to obtain a nonlocal mean filtered image; construct a two-dimensional histogram based on the grayscale image and the nonlocal mean filtered image. Step 3: Using the maximization of the two-dimensional Kapur entropy function as the objective function, the two-dimensional histogram is segmented using the Kapur entropy thresholding method to obtain an initial threshold set; Step four: Using the maximization of the two-dimensional Kapur entropy function as the objective function, the improved rime algorithm is used to search the initial threshold set to obtain the optimal threshold set; Step 5: Perform multi-threshold segmentation on the disease image described in Step 1 based on the optimal threshold set to obtain a disease image with the diseased area segmented out, thus completing the greenhouse crop disease image segmentation.
[0034] In this embodiment, the acquisition of disease images of greenhouse crop plants in step one is preferably achieved by using industrial cameras or high-definition monitoring equipment deployed in the greenhouse for diseased crops to periodically collect disease images of greenhouse crop plants.
[0035] In this embodiment, the image cropping in step one specifically involves cropping out the areas with diseased leaves. The image scaling is preferably performed to uniformly scale the image, for example, to 500×310 pixels, to ensure consistent dimensions of the input image during the segmentation process. The image denoising specifically involves using median filtering to eliminate salt-and-pepper and blur noise in the image. The color enhancement and histogram equalization specifically involve improving image contrast and enhancing the difference between the diseased area and the background.
[0036] In this embodiment, step two, which involves processing the grayscale image using a non-local mean filtering algorithm to obtain a non-local mean filtered image, is specifically based on:
[0037] Obtain the nonlocal mean filtered image. ,in, The weights for weighted averages, For pixels The grayscale value.
[0038] Among them, the weights for weighted averages The steps to obtain it are as follows: Step 21, according to
[0039] Get pixels Local mean ;in For pixels grayscale values, of which Represented by pixels The side length of the neighborhood window centered on the center. This represents the set of pixels within the window, with the total number of neighboring pixels being... .
[0040] Step 22, according to
[0041] Get pixels Local mean ; Step 23, according to
[0042] The weights for obtaining the weighted average .
[0043] 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
[0044] 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.
[0045] In this embodiment, step three, which involves maximizing the two-dimensional Kapur entropy function as the objective function, is achieved through...
[0046] Obtain the optimal threshold ,in, It is a two-dimensional Kapur entropy function.
[0047] In this embodiment, it is preferable to complete the greenhouse crop disease image segmentation in step five, and then, based on...
[0048] 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).
[0049] The segmentation method described in this embodiment is a high-quality image segmentation method applicable to various greenhouse crops. By preprocessing the acquired images, the segmentation accuracy is enhanced. By jointly modeling the grayscale image with its corresponding non-local mean image, a two-dimensional grayscale histogram is constructed, which alleviates the problems of uneven color and lighting in the pathological images of greenhouse crop diseases. Furthermore, the two-dimensional histogram can comprehensively consider the pixel itself and its contextual neighborhood information, which helps to enhance the descriptive ability of edge and detail regions.
[0050] Based on the aforementioned two-dimensional gray-nonlocal mean histogram, a unique greenhouse crop disease segmentation framework was constructed by fusing it with maximum Kapur entropy. Then, combining the characteristics of greenhouse disease images, an improved frost algorithm was used to segment greenhouse crop diseases, thereby achieving efficient multi-threshold optimization. This avoids the bias of traditional single-threshold methods towards the main peak and improves the accuracy and stability of multi-threshold search in image segmentation, significantly enhancing the disease region identification effect. This results in high-quality segmentation of greenhouse crop disease regions, with clearer lesion edges and better regional integrity, demonstrating high efficiency and excellent segmentation performance.
[0051] This embodiment provides an example to demonstrate its effectiveness in segmenting leaf diseases of greenhouse crops. Strawberry disease images acquired from a greenhouse area were selected. 72 images of strawberry diseases collected from a greenhouse area were preprocessed and uniformly sized to 500×310. Then, 9 disease images were randomly selected for segmentation. The segmentation method of this embodiment and the frost algorithm were used for comparison and verification. The two methods were run independently 20 times, and the segmentation results were compared. Figure 3 As shown, it can be clearly observed that compared to Figure 3 Figure (a) in the middle, Figure 3 In Figure (c), the existing frost-covered tree segmentation algorithm has a high false detection rate in scenarios with faded leaves, uneven lighting, and small lesions, even detecting some non-disease areas as diseased areas. Figure 3 The segmentation effect of this embodiment shown in Figure (b) is superior in terms of lesion edge localization, regional integrity and noise suppression. It can extract the diseased area more accurately and has stronger robustness to background interference.
[0052] Implementation Method Two: This implementation method further defines the greenhouse crop disease image segmentation method described in Implementation Method One. In this implementation method, the two-dimensional Kapur entropy objective function in step three is:
[0053] in, This represents the number of sub-regions divided along the main diagonal of the two-dimensional histogram. The grayscale value of the grayscale image. The grayscale value of the non-local mean filtered image. It is the first Kapur entropy in a diagonal region.
[0054] In this embodiment, the... The acquisition process is as follows: Step 31, according to
[0055] Obtain the Probability value of each sub-region ,in The grayscale value in the two-dimensional histogram is The probability (i.e. pixel ratio) of the joint occurrence of (original grayscale image) and j (non-local mean image); , The first The threshold boundary of each sub-region in the grayscale image direction. , , respectively, are the threshold boundaries of the k-th sub-region in the direction of the non-local mean image.
[0056] Step 32, according to
[0057] Obtain the Kapur entropy in the diagonal regions .
[0058] This implementation further defines step three, explaining the two-dimensional Kapur entropy function described 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 sum of Kapur entropies of each sub-region of the image, the optimal threshold combination for information distribution can be obtained, thereby enhancing the discriminability between regions and improving the accuracy and stability of the segmentation results. This implementation constructs a two-dimensional gray-level histogram combining the original gray-level 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 thresholding method and the improved hoarfrost algorithm to search in the threshold space. This makes the diseased leaf region and the healthy region more separable in the information entropy space, improving the adaptability and versatility of the segmentation model. Thus, it can accurately distinguish between mild lesions and healthy tissue without manual annotation, and can be widely applied to the image segmentation task of greenhouse crops under different lighting and backgrounds, demonstrating strong adaptability.
[0059] Implementation Method 3: This implementation method further defines the greenhouse crop disease image segmentation method described in Implementation Method 1. In this implementation method, the improved frost algorithm in step four includes the following steps: Step 41: Based on the initial threshold set, initialize the key parameters and the rime ice population; 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; 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. Step 43: Update the location of the rime population using a soft rime search strategy and a hard rime puncture mechanism; Step 44: Use the NCC strategy to generate offspring and add them to the rime ice population; The NCC strategy includes an improved horizontal cross-search phase and an improved vertical cross-search phase; Step 45: Update the location of the rime ice population using the SW strategy; The SW strategy introduces a contraction factor. and restart operator; Step 46: Update the rime population using a greedy selection strategy to obtain the optimal threshold set.
[0060] In this embodiment, a random number generator is preferably used to initialize the rime ice population in step 41. The aforementioned for
[0061] in, ; For the first Individual rime ice plants, For the first Dimension.
[0062] In this embodiment, the soft frost search strategy described in step 43 is specifically based on...
[0063] Obtain the location of the updated rime ice population. ,in, It is the current optimal rime ice individual, representing the optimal solution; and Random numbers that control the movement of individual rime ice plants; The degree of adhesion between two particles; and These define the upper and lower boundaries of the problem space, respectively.
[0064] according to
[0065] Obtain behavioral parameters for controlling the movement of individual rime ice plants. .
[0066] according to
[0067] Obtain the step function of the environmental coefficients that influence the soft frost search strategy. ,in, This indicates rounding, and control The number of segments.
[0068] according to
[0069] Obtain the adhesion coefficient ,and Together, we control the condensation of the rime ice population.
[0070] In this embodiment, the hard rime puncture mechanism described in step 43 is specifically based on...
[0071] Obtain the location of the updated rime ice population. ,in, It is the fitness value. for The normalized value, and the random number Together they control the probability of particle exchange.
[0072] In this embodiment, the SW strategy described in step 45 is based on
[0073] 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.
[0074] In this embodiment, the greedy selection strategy described in step 46 is based on
[0075] 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.
[0076] In this embodiment, the maximum number of evaluations The preferred value is 100.
[0077] 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.
[0078] 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.
[0079] In the rime ice algorithm, the optimal individual guides the entire population towards a more promising search direction. However, due to frequent learning from the optimal individual, the algorithm can easily get trapped in local optima. Therefore, this implementation combines the NCC and SW strategies. The NCC strategy maintains the diversity of the algorithm's optimization process to adapt to the diverse changes in lesion morphology. The SW strategy is a controller that adjusts the balance between global exploration and local development, allowing the algorithm to fully learn from the experience of the current optimal individual and historical individuals, promoting mutual learning between the different position vectors of individuals. By introducing a shrinkage factor and a restart operator, the problems existing in the original algorithm are solved, enhancing the algorithm's ability to escape local optima and find the global optimum, thereby strengthening the algorithm's development capabilities and reducing the missed detection of small lesions.
[0080] Implementation Method Four: This implementation method further defines the greenhouse crop disease image segmentation method described in Implementation Method Two. In this implementation method, the improved horizontal cross-search stage in step 44 is achieved through…
[0081]
[0082] 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 nth dimension of the i-th individual rime ice.
[0083] This embodiment further defines step 44, providing an example of the improved horizontal cross-search stage described in step 44. Inspired by the DE algorithm, this method differs from the original horizontal cross-search which uses two different hoarfrost individuals; the improved horizontal cross-search stage formula introduces a third new individual. This enhances the randomness of the improved rime ice algorithm and enriches the diversity of rime ice populations.
[0084] Implementation Method 5: This implementation method further defines the greenhouse crop disease image segmentation method described in Implementation Method 3. In this implementation method, the improved vertical cross-search stage in step 44 is achieved through...
[0085] 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].
[0086] This embodiment further defines step 44, and provides an example of the improved vertical cross-search phase scheme described in step 44. This method further clarifies step 44. The first individual rime ice The position vector and the first Perform a vertical cross operation on each position vector, introducing the original vertical cross search strategy. This allows the two dimensions of an individual to interact and learn from each other, thus generating new individuals. Furthermore, it promotes mutual learning between the different position vectors of individuals, thereby enhancing their ability to avoid local optima.
[0087] Implementation Method Six: This implementation method further defines the greenhouse crop disease image segmentation method described in Implementation Method Three. In this implementation method, the SW strategy described in step 45 is implemented through:
[0088] The obtained shrinkage factor .
[0089] This embodiment further defines step 45 and provides an example of the SW strategy described in step 45, in which the contraction factor... The value 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 rime population will develop near the current optimal solution.
[0090] Implementation Method Seven: This implementation method further defines the greenhouse crop disease image segmentation method described in Implementation Method Three. In this implementation method, the restart operator in step 45 is implemented through:
[0091] 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.
[0092] In this embodiment, the... The preferred setting is 300.
[0093] This embodiment further defines step 45 and provides an example of the restart operator described in step 45. When a certain number of limitations are assessed, and the current search individual no longer updates to a position with better quality, it indicates that the algorithm is largely trapped in a local optimum. Therefore, setting a restart operator is very necessary, as it can increase the probability of the search individual escaping the local optimum.
Claims
1. A method for image segmentation of crop diseases in greenhouses, characterized in that, Includes the following steps: Step 1: Obtain disease images of diseased plants in greenhouse crops, and preprocess the disease images to obtain preprocessed disease images; The preprocessing includes image cropping, image scaling, image denoising, color enhancement, and image equalization; Step 2: Convert the preprocessed disease image to grayscale to obtain a grayscale image; process the grayscale image using a nonlocal mean filtering algorithm to obtain a nonlocal mean filtered image. A two-dimensional histogram is constructed based on the grayscale image and the non-local mean filtered image; Step 3: Using the maximization of the two-dimensional Kapur entropy function as the objective function, the two-dimensional histogram is segmented using the Kapur entropy thresholding method to obtain an initial threshold set; Step four: Using the maximization of the two-dimensional Kapur entropy function as the objective function, the improved rime algorithm is used to search the initial threshold set to obtain the optimal threshold set; Step 5: Perform multi-threshold segmentation on the disease image described in Step 1 based on the optimal threshold set to obtain a disease image with the diseased area segmented out, thus completing the greenhouse crop disease image segmentation.
2. The method for segmenting images of greenhouse crop diseases according to claim 1, characterized in that, The two-dimensional Kapur entropy function mentioned in step three is: in, This represents the number of sub-regions divided along the main diagonal of the two-dimensional histogram. The grayscale value of the grayscale image. The grayscale value of the non-local mean filtered image. It is the first Kapur entropy in a diagonal region.
3. The method for segmenting images of greenhouse crop diseases according to claim 1, characterized in that, The improved rime ice algorithm described in step four includes the following steps: Step 41: Based on the initial threshold set, initialize the key parameters and the rime ice population; 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; 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. Step 43: Update the location of the rime population using a soft rime search strategy and a hard rime puncture mechanism; Step 44: Use the NCC strategy to generate offspring and add them to the rime ice population; The NCC strategy includes an improved horizontal cross-search phase and an improved vertical cross-search phase; Step 45: Update the location of the rime ice population using the SW strategy; The SW strategy introduces a shrinkage factor. and restart operator; Step 46: Update the rime population using a greedy selection strategy to obtain the optimal threshold set.
4. The method for segmenting images of greenhouse crop diseases according to claim 3, characterized in that, The improved horizontal cross-search phase described in step 44 is achieved through... Obtain the The offspring of the nth dimension position vector of an individual rime ice plant The offspring of the nth dimension position vector of the jth hoarfrost individual ,in, and A random number in the range [-1, 1] Let be the position vector of the nth dimension of the i-th individual rime ice.
5. The method for segmenting images of greenhouse crop diseases according to claim 3, characterized in that, The improved vertical cross search stage described in step 44 is achieved through... 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].
6. The method for segmenting images of greenhouse crop diseases according to claim 3, characterized in that, The contraction factor described in step 45 Through: The obtained shrinkage factor .
7. The method for segmenting images of greenhouse crop diseases according to claim 3, characterized in that, The restart operator described in step 45 is achieved through: 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 is not updated Add 1; It is a constant.
8. A greenhouse crop disease image segmentation system, characterized in that, Includes the following modules: 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. The first module further includes: The preprocessing submodule is used for image cropping, image scaling, image denoising, color enhancement, and image equalization. Module 2 is used to perform grayscale processing on the preprocessed disease image to obtain a grayscale image; process the grayscale image using a nonlocal mean filtering algorithm to obtain a nonlocal mean filtered image; and construct a two-dimensional histogram based on the grayscale image and the nonlocal mean filtered image. Module 3 is used to segment the two-dimensional histogram using the Kapur entropy function as the objective function and the Kapur entropy thresholding method to obtain an initial threshold set. Module 4 is used to search the initial threshold set using an improved rime algorithm, taking the maximization of the two-dimensional Kapur entropy function as the objective function, to obtain the optimal threshold set; Module 5 is used to perform multi-threshold segmentation on the disease image described in Module 1 based on the optimal threshold set, to obtain a disease image with the diseased area segmented out, and to complete the segmentation of greenhouse crop disease images.
9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor, when executing a program stored in memory, implements the greenhouse crop disease image segmentation method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the greenhouse crop disease image segmentation method according to any one of claims 1-7.
Citation Information
Patent Citations
Medical image segmentation threshold determination method and device, medium and equipment
CN119068011A
Insulating pull rod lightweight design method based on multi-objective optimization algorithm
CN119538634A
Corn germination image segmentation method based on elite adaptive rime algorithm
CN120510170A