An automatic colony recognition and counting method based on machine learning segmentation
By using a multi-scale Unet model based on machine learning for colony segmentation and counting, combined with feature selection and morphological optimization, the efficiency and accuracy problems of existing colony counting methods are solved, achieving fast, automated and interpretable colony identification and counting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-08
- Publication Date
- 2026-04-07
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.
We employ a machine learning-based segmentation approach, using a lightweight, multi-scale Unet model with attention for colony region segmentation. We combine roundness filtering, morphological denoising, and distance transformation for colony identification and counting. The approach includes a combined structure of encoder, bottleneck layer, and decoder, and uses lightweight convolution and self-attention modules for feature extraction and fusion.
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 the counting results are interpretable and traceable.
Smart Images

Figure CN121482784B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of colony counting, and particularly relates to an automatic colony identification and counting method based on machine learning segmentation. BACKGROUND
[0002] Colony counting is a key link in the field of microorganism detection, and is widely used in food microorganism safety detection (such as total number of colonies of dairy products, meat products and baked foods), scientific research experiments (automatic counting of microorganism culture experiments), environmental monitoring (microorganism colony analysis of water quality and soil samples), and medical and health fields (culture medium colony detection and medical instrument microorganism contamination screening).
[0003] At present, colony counting technologies mainly include manual counting and traditional software assisted and existing AI models. (1) Defects of manual counting and traditional software: manual counting relies on experimental personnel to observe culture medium with naked eyes, and counts by using a counter or a pen, which is a traditional operation method in a laboratory. However, the efficiency is low, and it takes a long time to process batch samples. Moreover, manual counting is easily affected by personnel fatigue and visual errors. Traditional software such as ImageJ / Fiji software realizes counting through threshold segmentation and morphological processing (inflation and corrosion). However, the threshold and filter radius need to be manually adjusted, and the operation is tedious and does not support batch automatic processing. (2) Defects of existing AI models: taking a colony counting scheme based on U2-Net+ResNet50 as an example, the colony area is first segmented by U2-Net, and then the features are extracted one by one by ResNet50, and the number of colonies is output. The resource consumption is high, and the algorithm relies on GPU computing power, which is difficult to deploy on embedded devices. Moreover, the efficiency and applicability are insufficient, the classification recognition is poor, and the interpretability is poor.
[0004] In summary, the existing colony counting methods have many defects in efficiency, accuracy, deployment convenience and interpretability, and it is difficult to meet the needs of various application fields for fast, accurate and automatic colony counting. Therefore, there is an urgent need for an efficient, accurate and interpretable automatic colony identification and counting method. SUMMARY
[0005] In view of the deficiencies of the prior art, the application provides an automatic colony identification and counting method based on machine learning segmentation, which aims to solve the problems mentioned in the background.
[0006] The application provides an automatic colony identification and counting method based on machine learning segmentation, which comprises the following steps:
[0007] The culture medium image is input into the trained multi-scale and attention-based lightweight Unet model to segment the colony area, and a single-channel probability map is output.
[0008] The single-channel probability map is obtained by connected region extraction, roundness screening, morphological noise reduction optimization and distance transformation counting.
[0009] Further, the method for obtaining the trained multi-scale and attention-based lightweight Unet model comprises the following steps:
[0010] The feature-random colony picture and its corresponding mask are generated by a Python script, the mask is used to mark the colony picture, and the colony picture and its corresponding mask are input into the multi-scale and attention-based lightweight Unet model to train the lightweight Unet model to learn the colony region segmentation.
[0011] The features include quantity, size, color, shape and background.
[0012] Further, the multi-scale and attention-based lightweight Unet model is composed of an encoder, a bottleneck layer and a decoder in series, and comprises the following steps:
[0013] The encoder is composed of three groups of lightweight convolution modules, a maximum pooling module and a convolution block attention module in series, and is subjected to three times of down-sampling, so as to output multi-scale colony features, so as to strengthen colony target features and suppress background redundancy; specifically, the lightweight convolution block is composed of a depth separable convolution, a batch normalization and a ReLU activation, and the channel number is gradually increased from 16 to 64, so as to realize deep semantic feature extraction.
[0014] The multi-scale colony features are input into the bottleneck layer and the decoder through a jump connection.
[0015] The bottleneck layer is composed of a lightweight convolution module, a self-attention module and a lightweight convolution module in series, so as to compress feature dimensions, capture global target correlations and adjust feature expressions, so as to output colony key features.
[0016] The decoder is composed of three groups of transpose convolution modules, multi-scale feature fusion weight modules and lightweight convolution blocks in series, and is subjected to three times of up-sampling, so as to dynamically weight and align the multi-scale colony features output by the encoder, and after feature fusion and refinement, a single-channel probability map is output through a sigmoid activation.
[0017] Further, the channel attention is embedded in the encoder, and the channel attention weight w c is calculated, and the formula is as follows:
[0018] ;
[0019] In the formula, σ(·) is a sigmoid activation function, ReLU(·) is a ReLU activation function, GlobalAvgPool(·) is a global average pooling, and Fc 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.
[0020] Furthermore, the multi-scale colony features output by the dynamically weighted and aligned encoder are as follows:
[0021] 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:
[0022] ;
[0023] 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.
[0024] Further, roundness filtering is performed as follows:
[0025] The formula for calculating roundness is as follows:
[0026] Roundness = (4 × π × area of outline) / (circumference of outline²), where π is the value of pi;
[0027] When the roundness threshold is low, i.e., roundness ≤ 0.5, non-colony areas are screened out;
[0028] When the roundness threshold is high, i.e., roundness ≥ 0.8, the colony area is marked, and the colony area may be sticky.
[0029] Furthermore, morphological noise reduction optimization is performed, specifically as follows:
[0030] The expansion operation employs adaptive morphological structural elements to fill the pores within the colony area, thus avoiding missed counts.
[0031] The erosion operation employs adaptive morphological structural elements to eliminate small-area noise and reduce miscalculations;
[0032] Among them, the adaptive morphological structural element dynamically adjusts its size based on the average area of noise in the colony region;
[0033] The size S of the adaptive morphological structuring element elem The formula is expressed as:
[0034] ;
[0035] 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.
[0036] Furthermore, the distance transformation counting is specifically as follows:
[0037] Calculate the Euclidean distance between the foreground pixels of the colony region, where the Euclidean distance incorporates grayscale features;
[0038] 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.
[0039] Furthermore, the Euclidean distance of the foreground pixels in the colony region is calculated, where the Euclidean distance incorporates grayscale features, specifically:
[0040] 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:
[0041] ;
[0042] 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.
[0043] Furthermore, the grayscale weight w(x) of the foreground pixel a y aThe formula is expressed as:
[0044] ;
[0045] 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.
[0046] The present invention has the following beneficial effects:
[0047] (1) Solve the problem of lacking a large number of labeled training materials.
[0048] (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.
[0049] (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.
[0050] (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).
[0051] (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
[0052] Exemplary embodiments of the present invention can be more fully understood by referring to the following figures:
[0053] Figure 1 These are the generated colony-like images and their corresponding masks provided in the embodiments of the present invention, wherein:
[0054] Figure 1 In this context, A represents a colony-like image generated using a Python script, exhibiting randomized features.
[0055] Figure 1 In the image, B is the black-and-white mask corresponding to the bacterial colony image.
[0056] 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.
[0057] 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:
[0058] Figure 3 In the image, A represents the original colony-like structure.
[0059] Figure 3 B in the text is the prediction mask;
[0060] Figure 3 C in the figure represents the real mask.
[0061] 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.
[0062] Figure 5 This is a graph showing the colony identification, counting, statistical, and comparison results provided in an embodiment of the present invention.
[0063] Figure 6 These are the counting and location results of sparse colonies in Example 1 of the present invention, wherein:
[0064] Figure 6 In the image, A represents the culture medium.
[0065] Figure 6 B in the figure represents the colony identification and counting result.
[0066] Figure 7 The results of counting and locating dense colonies in Example 1 of this invention are as follows:
[0067] Figure 7 In the image, A represents the culture medium.
[0068] Figure 7 B in the figure represents the colony identification and counting result.
[0069] 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:
[0070] Figure 8 In the image, A represents the culture medium.
[0071] Figure 8 B in the figure represents the colony identification and counting result. Detailed Implementation
[0072] 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.
[0073] 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.
[0074] This invention provides an automatic colony identification and counting method based on machine learning segmentation, comprising the following steps:
[0075] 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.
[0076] The single-channel probability map completes colony identification and counting after connected component extraction, roundness filtering, morphological noise reduction optimization, and distance transformation counting.
[0077] 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.
[0078] In some embodiments, a method for obtaining a trained, multi-scale, attention-enabled lightweight Unet model is as follows:
[0079] 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.
[0080] The features include quantity, size, color, shape, and background;
[0081] 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.
[0082] The statistical process of training a lightweight, multi-scale, attention-based Unet model to learn colony region segmentation is as follows: Figure 2As 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.
[0083] 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.
[0084] 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:
[0085] 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).
[0086] The multi-scale colony features are input into the bottleneck layer and then into the decoder via skip connections.
[0087] 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;
[0088] 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.
[0089] 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:
[0090] ;
[0091] 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.
[0092] In some embodiments, the multi-scale colony features output by the dynamically weighted and aligned encoder are specifically:
[0093] 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:
[0094] ;
[0095] 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.
[0096] In some embodiments, connected component extraction specifically involves:
[0097] 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.
[0098] 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.
[0099] In some embodiments, roundness filtering specifically includes:
[0100] The formula for calculating roundness is as follows:
[0101] Roundness = (4 × π × area of outline) / (circumference of outline²), where π is the value of pi;
[0102] When the roundness threshold is low, i.e., roundness ≤ 0.5, non-colony areas are screened out;
[0103] When the roundness threshold is high, i.e., roundness ≥ 0.8, the colony area is marked, and the colony area may be sticky.
[0104] In some embodiments, morphological noise reduction optimization specifically includes:
[0105] The expansion operation employs adaptive morphological structural elements to fill the pores within the colony area, thus avoiding missed counts.
[0106] The erosion operation employs adaptive morphological structural elements to eliminate small-area noise and reduce miscalculations;
[0107] 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.
[0108] The size S of the adaptive morphological structuring element elem The formula is expressed as:
[0109] ;
[0110] 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.
[0111] 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.
[0112] In some embodiments, distance transformation counting specifically includes:
[0113] Calculate the Euclidean distance between the foreground pixels of the colony region, where the Euclidean distance incorporates grayscale features;
[0114] 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.
[0115] 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.
[0116] In some embodiments, the Euclidean distance of the foreground pixels of the colony region is calculated, wherein the Euclidean distance incorporates grayscale features, specifically:
[0117] 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:
[0118] ;
[0119] 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.
[0120] In some embodiments, the grayscale weight w(x) of the foreground pixel a y a The formula is expressed as:
[0121] ;
[0122] 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.
[0123] 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.
[0124] Example 1:
[0125] An automatic colony identification and counting method based on machine learning segmentation is used to count and locate sparse and dense colonies.
[0126] 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.
[0127] 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.
[0128] Colony counting and localization, and results indicating possible overlap of low-roundness colonies, as shown in the figure. 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.
[0129] 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 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. The single-channel probability map completes colony identification and counting after connected component extraction, roundness filtering, morphological noise reduction optimization, and distance transformation counting. Specifically, the distance transformation count is 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, 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.
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: 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; This is the feature map of the c-th channel; , These are learnable fully connected layer parameters. Used to compress channel dimensions. Used to restore channel dimensions; This is the weighted feature map of the c-th channel; This is a dot product operation.
4. The method as described in claim 3, 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.
5. 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.
6. 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; avg(A) noise (A) represents the noise region. 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.
7. The method as described in claim 1, 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 w(x) represents the foreground pixel; a y a ) represents the grayscale weight of the foreground pixel; The square of the spatial distance from the foreground pixel to the background pixel. and For background pixels.
8. The method as described in claim 7, 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
Focus segmentation lightweight method applied to mammary gland medical detection image
CN120279036A
Medical image segmentation method based on multi-scale feature fusion
US20250095828A1