Automatic bacterial colony identifying and counting method based on machine learning segmentation
By employing a lightweight Unet model with multi-scale attention and machine learning segmentation techniques, the efficiency, accuracy, and interpretability issues of colony counting methods are addressed, enabling fast and accurate colony identification and counting, and supporting deployment on embedded devices.
Patent Information
- Application Number
- CN202610020839.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-08
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2046-01-08
AI Technical Summary
Existing colony counting methods are inadequate in terms of efficiency, accuracy, ease of deployment, and interpretability, making it difficult to meet the needs for speed, accuracy, and automation.
A machine learning-based segmentation method is adopted, using a lightweight Unet model with multi-scale and attention to segment colony regions. Colony identification and counting are then performed by combining single-channel probability maps, connected component extraction, roundness filtering, morphological denoising, and distance transformation.
It achieves efficient and accurate colony identification and counting, with short inference time per culture medium image, supports batch processing, reduces resource consumption, is suitable for embedded devices, and has strong interpretability of counting results.
Smart Images

Figure CN121482784A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of colony counting technology, and particularly relates to an automatic colony identification and counting method based on machine learning segmentation. Background Technology
[0002] Colony counting is a key step in the field of microbial testing, and it is widely used in various scenarios such as food microbial safety testing (e.g., total colony counting in dairy products, meat products, and baked goods), scientific research experiments (automated counting in microbial culture experiments), environmental monitoring (microbial colony analysis of water and soil samples), and the medical and health field (colony detection in culture media and screening for microbial contamination in medical devices).
[0003] At present, colony counting technology is mainly divided into manual counting and traditional software-assisted and existing AI models. (1) Defects of manual counting and traditional software: Manual counting relies on the experimenter to observe the culture medium with the naked eye and use a counter or pen to mark the count. It is the traditional operation method in the laboratory, but it is inefficient, takes a long time for batch samples, and manual counting is easily affected by human fatigue and visual errors. Traditional software such as ImageJ / Fiji software achieves counting through threshold segmentation and morphological processing (dilation, erosion). It requires manual adjustment of parameters such as threshold and filter radius, which is cumbersome and does not support batch automated processing. (2) Defects of existing AI models: Taking the colony counting scheme based on U2-Net+ResNet50 as an example, the colony region is first segmented by U2-Net, and finally the features are extracted one by one by ResNet50 to output the colony number. Its resource consumption is high, it relies on GPU computing power, it is difficult to deploy on embedded devices, and its efficiency and applicability are insufficient. The classification and recognition are poor and the interpretability is poor.
[0004] In summary, existing colony counting methods have many shortcomings in terms of efficiency, accuracy, ease of deployment, and interpretability, making it difficult to meet the needs of various application fields for fast, accurate, and automated colony counting. Therefore, there is an urgent need for an efficient, accurate, and interpretable automatic colony identification and counting method. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides an automatic colony identification and counting method based on machine learning segmentation, which aims to solve the problems mentioned in the background art.
[0006] This invention provides an automatic colony identification and counting method based on machine learning segmentation, comprising the following steps: Culture medium images are input into a trained, multi-scale, attention-enabled lightweight Unet model to segment colony regions and output a single-channel probability map. The single-channel probability map completes colony identification and counting after connected component extraction, roundness filtering, morphological noise reduction optimization, and distance transformation counting.
[0007] Furthermore, the method for obtaining a lightweight, multi-scale Unet model with attention after training is as follows: The Python script generates colony-like images with random features and their corresponding masks. The masks are used to label the colony-like images. The colony-like images and their corresponding masks are input into a multi-scale and attention-enabled lightweight Unet model to train the lightweight Unet model to learn colony region segmentation. The features include quantity, size, color, shape, and background.
[0008] Furthermore, the multi-scale and attention-enabled lightweight Unet model consists of an encoder, a bottleneck layer, and a decoder connected in series, including: The encoder uses three sets of lightweight convolutional modules, a max pooling module, and a convolutional block attention module in series to perform three downsampling operations and output multi-scale colony features to enhance the target features of the colony and suppress background redundancy. Specifically, the lightweight convolutional block consists of depthwise separable convolution, batch normalization, and ReLU activation, which gradually increases the number of channels from 16 to 64 to achieve deep semantic feature extraction. The multi-scale colony features are input into the bottleneck layer and then into the decoder via skip connections. Bottleneck layer: By connecting a lightweight convolution module, a self-attention module, and another lightweight convolution module, the feature dimension is compressed, global target associations are captured, and feature representations are adjusted to output key colony features; Decoder: It performs upsampling three times by sequentially connecting three sets of transposed convolutional modules, multi-scale feature fusion weighting modules and lightweight convolutional blocks, dynamically weighting and aligning the multi-scale colony features output by the encoder. After feature fusion and refinement, it outputs a single-channel probability map by sigmoid activation.
[0009] Furthermore, channel attention is embedded in the encoder to perform channel attention weights w in the convolutional block attention module. c The calculation, expressed by the formula, is as follows: ; In the formula: σ(·) is the Sigmoid activation function; ReLU(·) is the ReLU activation function; GlobalAvgPool(·) is the global average pooling; F c Let F be the feature map of the c-th channel; W1 and W2 are learnable fully connected layer parameters, where W1 is used to compress the channel dimension and W2 is used to restore the channel dimension; F c ′ This is the weighted feature map of the c-th channel; Budget for dot product.
[0010] Furthermore, the multi-scale colony features output by the dynamically weighted and aligned encoder are as follows: In the multi-scale feature fusion weighting module, the multi-scale colony features output from the three downsampling stages are fused separately. Through adaptive weight allocation, high-resolution micro-colony features are highlighted, and the fused feature F is output. fusion The formula is expressed as: ; In the formula: F k For the feature at the k-th scale, there are a total of K scales; H k and W k These represent the height and width of the feature at the k-th scale, respectively; α κ S represents the fusion weights at the k-th scale; k and S i The marginal saliency scores for the k-th and ith scales are respectively; ▽F k (x,y) represents the gradient of the feature at the k-th scale at pixel (x,y), where x is the height direction and y is the width direction; exp(·) is the exponential operation; This is for absolute value operations.
[0011] Further, roundness filtering is performed as follows: The formula for calculating roundness is as follows: Roundness = (4 × π × area of outline) / (circumference of outline²), where π is the value of pi; When the roundness threshold is low, i.e., roundness ≤ 0.5, non-colony areas are screened out; When the roundness threshold is high, i.e., roundness ≥ 0.8, the colony area is marked, and the colony area may be sticky.
[0012] Furthermore, morphological noise reduction optimization is performed, specifically as follows: The expansion operation employs adaptive morphological structural elements to fill the pores within the colony area, thus avoiding missed counts. The erosion operation employs adaptive morphological structural elements to eliminate small-area noise and reduce miscalculations; Among them, the adaptive morphological structural element dynamically adjusts its size based on the average area of noise in the colony region; The size S of the adaptive morphological structuring element elem The formula is expressed as: ; In the formula: This is for rounding up; avgA noise Noise region A noise Average area, used to measure the magnitude of noise; A noise,j N represents the area of the j-th noise region. noiseThe number of noise regions; × represents a multiplication operation.
[0013] Furthermore, the distance transformation counting is specifically as follows: Calculate the Euclidean distance between the foreground pixels of the colony region, where the Euclidean distance incorporates grayscale features; Set an Euclidean distance threshold, and filter the maximum distance within each colony region based on the Euclidean distance of the foreground pixels, i.e., the peak point. Each peak point corresponds to a colony center, and the colony identification and counting are completed by counting the number of peak points.
[0014] Furthermore, the Euclidean distance of the foreground pixels in the colony region is calculated, where the Euclidean distance incorporates grayscale features, specifically: By weighting the Euclidean distance using grayscale values, the distance response in the central region is enhanced, while background edge interference is suppressed. The weighted Euclidean distance D is... w (x) a y a The formula is expressed as: ; In the formula: (x a y a (x0, y0) represents the foreground pixel; (x0, y0) represents the nearest background pixel; w represents the grayscale weight; (x a -x0) 2 +(y a -y0) 2 It is the square of the spatial distance from the foreground pixel to the background pixel, used to measure the distance between the foreground and the background.
[0015] Furthermore, the grayscale weight w(x) of the foreground pixel a y a The formula is expressed as: ; In the formula: I(x) a y a ) represents the grayscale value of the foreground pixel; μ core is the preset typical gray value of the colony center; k is an adjustment coefficient used to control the sensitivity of the weight to gray value differences.
[0016] The present invention has the following beneficial effects: (1) Solve the problem of lacking a large number of labeled training materials.
[0017] (2) Improved efficiency: the inference time for a single culture medium image is ≤0.5 seconds, which is more than 6 times faster than U2-Net+ResNet50. It can process batches very quickly, supports fully automatic processing, and can also manually adjust parameters.
[0018] (3) Optimize accuracy. Distance transformation is used for the identification of adhesive colonies without upper limit and the counting error is small. Furthermore, the roundness screening and morphological noise reduction reduce the miscount rate of impurities.
[0019] (4) Reduced resource consumption: The lightweight Unet model has only 8 million parameters, which is 84% less than U2-Net. It does not require large-scale labeled data, supports CPU inference (such as ordinary laptops), and can be deployed on embedded devices (such as portable colony detectors).
[0020] (5) Enhance interpretability by using counting logic based on distance transformation and biological characteristics to make each colony correspond to a clear peak (the colony center can be marked on the image) and make the counting basis traceable. Attached Figure Description
[0021] Exemplary embodiments of the present invention can be more fully understood by referring to the following figures: Figure 1 These are the generated colony-like images and their corresponding masks provided in the embodiments of the present invention, wherein: Figure 1 In this context, A represents a colony-like image generated using a Python script, exhibiting randomized features. Figure 1 In the image, B is the black-and-white mask corresponding to the bacterial colony image.
[0022] Figure 2 This is a statistical diagram of the process of learning colony region segmentation using a lightweight Unet model with multi-scale training and attention provided in an embodiment of the present invention.
[0023] Figure 3 This is a training result diagram of a multi-scale, attention-enabled lightweight Unet model provided in an embodiment of the present invention, wherein: Figure 3 In the image, A represents the original colony-like structure. Figure 3 B in the text is the prediction mask; Figure 3 C in the figure represents the real mask.
[0024] Figure 4 This is an overlay image of the true mask and the predicted mask provided in the embodiments of the present invention, wherein: red indicates a correct prediction, green indicates an incorrect prediction, and white indicates that it was not predicted.
[0025] Figure 5 This is a graph showing the colony identification, counting, statistical, and comparison results provided in an embodiment of the present invention.
[0026] Figure 6 These are the counting and location results of sparse colonies in Example 1 of the present invention, wherein: Figure 6In the image, A represents the culture medium. Figure 6 B in the figure represents the colony identification and counting result.
[0027] Figure 7 The results of counting and locating dense colonies in Example 1 of this invention are as follows: Figure 7 In the image, A represents the culture medium. Figure 7 B in the figure represents the colony identification and counting result.
[0028] Figure 8 This refers to the colony counting and localization results of Embodiment 1 of the present invention, as well as the indication results for potentially overlapping low-roundness colonies, wherein: Figure 8 In the image, A represents the culture medium. Figure 8 B in the figure represents the colony identification and counting result. Detailed Implementation
[0029] To make the technical problems to be solved, the technical solutions, and the beneficial effects of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present invention and are not intended to limit the present invention.
[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention.
[0031] This invention provides an automatic colony identification and counting method based on machine learning segmentation, comprising the following steps: Culture medium images are input into a trained, multi-scale, attention-enabled lightweight Unet model to segment colony regions and output a single-channel probability map. The single-channel probability map completes colony identification and counting after connected component extraction, roundness filtering, morphological noise reduction optimization, and distance transformation counting.
[0032] It is understandable that the format of the culture medium image can be JPG, PNG, etc., by selecting or selecting the entire culture medium image area with the mouse.
[0033] In some embodiments, a method for obtaining a trained, multi-scale, attention-enabled lightweight Unet model is as follows: The Python script generates colony-like images with random features and their corresponding masks. The masks are used to label the colony-like images. The colony-like images and their corresponding masks are input into a multi-scale and attention-enabled lightweight Unet model to train the lightweight Unet model to learn colony region segmentation. The features include quantity, size, color, shape, and background; It is understandable that the generated colony-like images and their corresponding masks are as follows: Figure 1 As shown, a training set of 1000 colony-like images and their corresponding masks is formed by randomly generating colony-like images with random numbers, sizes, colors, shapes, and background colors using Python scripts and applying Gaussian blur. If real colony images are available, the pre-trained multi-scale and attention-enabled lightweight Unet model can be fine-tuned. The statistical process of training a lightweight, multi-scale, attention-based Unet model to learn colony region segmentation is as follows: Figure 2 As shown, the training loss of the multi-scale and attention-enabled lightweight Unet model gradually decreases with the increase of the number of training rounds, and the final Dice coefficient is greater than 0.99, which means it has the advantages of short inference time and good segmentation effect. Training results of a lightweight Unet model with multi-scale and attention features, as shown below. Figure 3 As shown, the real mask and the predicted mask are superimposed as follows: Figure 4 As shown, the results indicate that the predicted mask based on the original images of different densities is highly consistent with the real mask result. By superimposing the real mask and the predicted mask, it can be seen that the correct prediction rate is high, with almost no incorrect predictions or unpredicted results.
[0034] In some embodiments, the multi-scale and attention-enabled lightweight Unet model consists of an encoder, a bottleneck layer, and a decoder connected in series, including: The encoder uses three sets of lightweight convolutional modules, a max pooling module, and a convolutional block attention module connected in series to perform three downsampling operations, outputting multi-scale colony features to enhance the target features of the colonies and suppress background redundancy. The lightweight convolutional block consists of depthwise separable convolution (reducing the number of parameters), batch normalization (accelerating training), and ReLU activation (non-linear mapping), gradually increasing the number of channels from 16 to 64 to achieve deep semantic feature extraction (such as colony edges and textures). The multi-scale colony features are input into the bottleneck layer and then into the decoder via skip connections. Bottleneck layer: By connecting a lightweight convolution module, a self-attention module, and another lightweight convolution module, the feature dimension is compressed, global target associations are captured, and feature representations are adjusted to output key colony features; Decoder: The multi-scale colony features output by the encoder are dynamically weighted and aligned by three sets of transposed convolutional modules, multi-scale feature fusion weighting modules and lightweight convolutional blocks in series. After feature fusion and refinement, a single-channel probability map is output by sigmoid activation. The pixel value of the single-channel probability map is 0-1, and the closer it is to 1, the more likely it is to be a colony.
[0035] In some embodiments, channel attention is embedded in the encoder to perform channel attention weights w in the convolutional block attention module. c The calculation, expressed by the formula, is as follows: ; In the formula: σ(·) is the Sigmoid activation function; ReLU(·) is the ReLU activation function; GlobalAvgPool(·) is the global average pooling; F c Let F be the feature map of the c-th channel; W1 and W2 are learnable fully connected layer parameters, where W1 is used to compress the channel dimension and W2 is used to restore the channel dimension; F c ′ This is the weighted feature map of the c-th channel; Budget for dot product.
[0036] In some embodiments, the multi-scale colony features output by the dynamically weighted and aligned encoder are specifically: In the multi-scale feature fusion weighting module, the multi-scale colony features output from the three downsampling stages are fused separately. Through adaptive weight allocation, high-resolution micro-colony features are highlighted, and the fused feature F is output. fusion The formula is expressed as: ; In the formula: F k For the feature at the k-th scale, there are a total of K scales; H k and W k These represent the height and width of the feature at the k-th scale, respectively; α κ S represents the fusion weight at the k-th scale, i.e., the fusion weight after Softmax normalization. Small colony feature maps with clear edges will receive higher weights; k and S i The marginal saliency scores for the k-th and ith scales are respectively; ▽F k (x,y) represents the gradient of the feature at the k-th scale at pixel (x,y), where x is the height direction and y is the width direction; exp(·) is the exponential operation; This is for absolute value operations.
[0037] In some embodiments, connected component extraction specifically involves: The single-channel probability map is converted into a binary mask. For the input binary image (foreground pixels are non-zero values and background pixels are zero), the pixels are traversed from left to right and from top to bottom. When an unlabeled foreground pixel is encountered, a connected region labeling process is initiated: using 4-connectivity or 8-connectivity rules, all foreground pixels connected to the pixel are traversed and labeled as the same connected region; this process is repeated until all foreground pixels are labeled, and finally the number of connected regions, the label of each colony region, and statistical information are obtained.
[0038] In some embodiments, roundness filtering specifically includes: The formula for calculating roundness is as follows: Roundness = (4 × π × area of outline) / (circumference of outline²), where π is the value of pi; When the roundness threshold is low, i.e., roundness ≤ 0.5, non-colony areas are screened out; When the roundness threshold is high, i.e., roundness ≥ 0.8, the colony area is marked, and the colony area may be sticky.
[0039] In some embodiments, morphological noise reduction optimization specifically includes: The expansion operation employs adaptive morphological structural elements to fill the pores within the colony area, thus avoiding missed counts. The erosion operation employs adaptive morphological structural elements to eliminate small-area noise and reduce miscalculations; Among them, the adaptive morphological structural element dynamically adjusts its size according to the average area of noise in the colony region to avoid noise residue or destruction of colony morphology. The size S of the adaptive morphological structuring element elem The formula is expressed as: ; In the formula: This is for rounding up; avgA noise Noise region A noise Average area, used to measure the magnitude of noise; A noise,j N represents the area of the j-th noise region. noise This represents the number of noise regions; × indicates a multiplication operation. It is understandable that the size S of the adaptive morphological structuring element... elem Given a square structuring element size, if the average noise area is 20 pixels², the calculated size of the adaptive morphological structuring element is 3x3, ensuring that the structuring element size matches the noise for efficient noise reduction.
[0040] In some embodiments, distance transformation counting specifically includes: Calculate the Euclidean distance between the foreground pixels of the colony region, where the Euclidean distance incorporates grayscale features; Set an Euclidean distance threshold, and filter the maximum distance within each colony region based on the Euclidean distance of the foreground pixels, i.e., the peak point. Each peak point corresponds to a colony center. Counting the number of peak points completes the colony identification and counting. It is understandable that Euclidean distance incorporates grayscale features because the grayscale in the central region of a colony is usually more uniform (e.g., higher or lower), while the grayscale in the peripheral region varies more drastically.
[0041] In some embodiments, the Euclidean distance of the foreground pixels of the colony region is calculated, wherein the Euclidean distance incorporates grayscale features, specifically: By weighting the Euclidean distance using grayscale values, the distance response in the central region is enhanced, while background edge interference is suppressed. The weighted Euclidean distance D is... w (x) a y a The formula is expressed as: ; In the formula: (x a y a (x0, y0) represents the foreground pixel; (x0, y0) represents the nearest background pixel; w represents the grayscale weight; (x a -x0) 2 +(y a -y0) 2 It is the square of the spatial distance from the foreground pixel to the background pixel, used to measure the distance between the foreground and the background.
[0042] In some embodiments, the grayscale weight w(x) of the foreground pixel a y a The formula is expressed as: ; In the formula: I(x) a y a ) represents the grayscale value of the foreground pixel; μ core is the preset typical gray value of the colony center; k is an adjustment coefficient used to control the sensitivity of the weight to gray value differences.
[0043] Colony identification, counting, statistics, and comparison results are as follows: Figure 5 As shown in the figure, the results indicate that the accuracy of the fitted curve for predicting colony counts by the model is higher than that for colony counts based on connectivity.
[0044] Example 1: An automatic colony identification and counting method based on machine learning segmentation is used to count and locate sparse and dense colonies.
[0045] The counting and localization results of sparse colonies are as follows: Figure 6 As shown in the figure, the results indicate that this method can identify sparse colonies in real-world scenarios and perform localization and accurate counting.
[0046] The results of counting and localization of dense colonies are as follows: Figure 7 As shown in the figure, the results demonstrate that this method can identify, locate, and accurately count dense bacterial colonies in real-world scenarios.
[0047] Colony counting and localization, and results indicating possible overlap of low-roundness colonies, as shown below. Figure 8 As shown in the figure, the results show that this method can accurately count the adhering colonies in real-world scenarios and indicate the possible adhering colonies by their roundness.
[0048] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. An automatic colony identification and counting method based on machine learning segmentation, characterized in that: Includes the following steps: Culture medium images are input into a trained, multi-scale, attention-enabled lightweight Unet model to segment colony regions and output a single-channel probability map. The single-channel probability map completes colony identification and counting after connected component extraction, roundness filtering, morphological noise reduction optimization, and distance transformation counting.
2. The method as described in claim 1, characterized in that: The method for obtaining a lightweight, multi-scale, attention-enabled Unet model after training is as follows: The Python script generates colony-like images with random features and their corresponding masks. The masks are used to label the colony-like images. The colony-like images and their corresponding masks are input into a multi-scale and attention-enabled lightweight Unet model to train the lightweight Unet model to learn colony region segmentation. The features include quantity, size, color, shape, and background.
3. The method as described in claim 2, characterized in that: The lightweight, multi-scale Unet model with attention consists of an encoder, a bottleneck layer, and a decoder connected in series, including: The encoder: It performs downsampling three times by sequentially connecting three sets of lightweight convolutional modules, max pooling modules, and convolutional block attention modules to output multi-scale colony features; the lightweight convolutional block consists of depthwise separable convolution, batch normalization, and ReLU activation; The multi-scale colony features are input into the bottleneck layer and then into the decoder via skip connections. Bottleneck layer: By connecting a lightweight convolution module, a self-attention module, and another lightweight convolution module, the feature dimension is compressed, global target associations are captured, and feature representations are adjusted to output key colony features; Decoder: It performs upsampling three times by sequentially connecting three sets of transposed convolutional modules, multi-scale feature fusion weighting modules and lightweight convolutional blocks, dynamically weighting and aligning the multi-scale colony features output by the encoder. After feature fusion and refinement, it outputs a single-channel probability map by sigmoid activation.
4. The method as described in claim 3, characterized in that: Embed channel attention in the encoder and apply channel attention weights w to the convolutional block attention module. c The calculation, expressed by the formula, is as follows: ; In the formula: σ(·) is the Sigmoid activation function; ReLU(·) is the ReLU activation function; GlobalAvgPool(·) is the global average pooling; F c Let F be the feature map of the c-th channel; W1 and W2 are learnable fully connected layer parameters, where W1 is used to compress the channel dimension and W2 is used to restore the channel dimension; F c ′ This is the weighted feature map of the c-th channel; Budget for dot product.
5. The method as described in claim 4, characterized in that: The multi-scale colony features output by the dynamically weighted and aligned encoder are as follows: In the multi-scale feature fusion weighting module, the multi-scale colony features output from the three downsampling stages are fused separately. Through adaptive weight allocation, high-resolution micro-colony features are highlighted, and the fused feature F is output. fusion The formula is expressed as: ; In the formula: F k For the feature at the k-th scale, there are a total of K scales; H k and W k These represent the height and width of the feature at the k-th scale, respectively; α κ S represents the fusion weights at the k-th scale; k and S i The marginal saliency scores for the k-th and ith scales are respectively; ▽F k (x,y) represents the gradient of the feature at the k-th scale at pixel (x,y), where x is the height direction and y is the width direction; exp(·) is the exponential operation; This is for absolute value operations.
6. The method as described in claim 1, characterized in that: Roundness filtering specifically involves calculating roundness, expressed by the formula: Roundness = (4 × π × area of outline) / (circumference of outline²), where π is the value of pi; When the roundness threshold is low, i.e., roundness ≤ 0.5, non-colony areas are screened out; When the roundness threshold is high, i.e., roundness ≥ 0.8, the colony area is marked.
7. The method as described in claim 1, characterized in that: Morphological noise reduction optimization, specifically: The expansion operation employs adaptive morphological structural elements to fill the pores within the colony area. The erosion operation employs adaptive morphological structuring elements to eliminate small-area noise; Among them, the adaptive morphological structural element dynamically adjusts its size based on the average area of noise in the colony region; The size S of the adaptive morphological structuring element elem The formula is expressed as: ; In the formula: This is for rounding up; avgA noise Noise region A noise Average area, used to measure the magnitude of noise; A noise,j N represents the area of the j-th noise region. noise The number of noise regions is represented by '×', which represents a multiplication operation.
8. The method as described in claim 1, characterized in that: Distance transformation counting, specifically: Calculate the Euclidean distance between the foreground pixels of the colony region, where the Euclidean distance incorporates grayscale features; Set an Euclidean distance threshold, filter the maximum distance within each colony region based on the Euclidean distance of the foreground pixels, i.e., the peak point, and count the number of peak points to complete the colony identification and counting.
9. The method as described in claim 8, characterized in that: Calculate the Euclidean distance between the foreground pixels of the colony region, where the Euclidean distance incorporates grayscale features, specifically: The Euclidean distance is weighted by grayscale values, and the weighted Euclidean distance D is obtained. w (x) a y a The formula is expressed as: ; In the formula: (x a y a (x0, y0) represents the foreground pixel; (x0, y0) represents the nearest background pixel; w represents the grayscale weight; (x a -x0) 2 +(y a -y0) 2 It is the square of the spatial distance from the foreground pixel to the background pixel.
10. The method as described in claim 9, characterized in that: grayscale weight w(x) of foreground pixels a y a The formula is expressed as: ; In the formula: I(x) a y a ) represents the grayscale value of the foreground pixel; μ core is the preset typical gray value of the colony center; k is the adjustment coefficient.
Citation Information
Patent Citations
Brain glioma image segmentation method based on deep learning
CN120182282A
Focus segmentation lightweight method applied to mammary gland medical detection image
CN120279036A
Dermoscope image segmentation method based on attention mechanism and UNet
CN120339300A
Overlapped cervical cytoplasm region segmentation method based on deep learning and conditional diffusion model
CN120931686A
Medical image segmentation method based on multi-scale feature fusion
US20250095828A1