Microorganism detection system and method based on image recognition

By combining Mask R-CNN and the Watershed algorithm, and utilizing the overlap index and kernel radius optimization mechanism, the problem of microbial overlap and adhesion in traditional microbial detection is solved, achieving high-precision automated microbial detection.

CN121482039BActive Publication Date: 2026-04-24SICHUAN HEALTH REHABILITATION VOCATIONAL COLLEGE +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SICHUAN HEALTH REHABILITATION VOCATIONAL COLLEGE
Filing Date
2026-01-07
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Traditional microbial detection methods rely on manual operation and are complex, making it difficult to effectively handle microbial overlap and adhesion, resulting in low detection accuracy and difficulty in parameter adjustment.

Method used

By combining Mask R-CNN and the Watershed algorithm, and through preliminary segmentation and secondary segmentation, an overlap index and a kernel radius optimization mechanism are introduced to dynamically adjust the kernel radius of the Watershed algorithm to improve segmentation accuracy.

Benefits of technology

It enables precise separation of tightly adhered or stacked microorganisms, improves detection accuracy and consistency of automated methods, and simplifies the parameter debugging process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482039B_ABST
    Figure CN121482039B_ABST
Patent Text Reader

Abstract

The application discloses a kind of microorganism detection system and method based on image recognition, it is related to image recognition technical field;The steps of the method include: obtaining microorganism sample image, and pretreatment;Input the microorganism sample image after pretreatment to Mask R-CNN model that has been trained, obtain preliminary segmentation result;Its technical key points are: by adjusting the core parameter of the original Watershed algorithm, to obtain the improved Watershed algorithm, and using the improved Watershed algorithm to the microorganism individual is segmented again, on the basis of originally combining Mask R-CNN instance segmentation+Watershed algorithm secondary segmentation, further and targetedly improve the segmentation accuracy of microorganism individual, solve the problem that traditional microorganism detection recognition cannot further improve accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image recognition technology, specifically to a microbial detection system and method based on image recognition. Background Technology

[0002] Image recognition is a computer technology that enables machines to analyze and understand the content of digital images or videos. This technology uses algorithms and models to simulate the capabilities of the human visual system, automatically analyzing, interpreting, and extracting useful information from images. The core tasks of image recognition include object detection, classification, recognition, and segmentation. In object detection, the system determines the location of an object in an image and marks it with a bounding box. Classification determines which category an image or its objects belong to. Segmentation further refines the process to the pixel level, distinguishing different regions or objects in an image. Modern image recognition typically relies on deep learning methods, particularly convolutional neural networks (CNNs). These networks are trained on large amounts of labeled data to learn how to extract features from images to perform specific tasks.

[0003] In the process of identifying and detecting microorganisms, traditional methods rely on a lot of manual operations, such as manual annotation and parameter adjustment, which is time-consuming and prone to errors. For areas where some microorganisms overlap or accumulate, traditional methods introduce Mask R-CNN or Watershed algorithms for processing. However, when dealing with microbial overlap, they often rely on fixed parameter settings, which are difficult to handle complex adhesion situations. Even if relevant parameter adjustments can be made, existing methods may involve multiple independent empirical coefficients or complex rule sets, which increases the overall complexity of the detection method and the difficulty of debugging. Summary of the Invention

[0004] To achieve the above objectives, the present invention provides the following technical solution:

[0005] A microbial detection method based on image recognition includes the following steps:

[0006] Acquire images of microbial samples and perform preprocessing;

[0007] The preprocessed microbial sample image is input into the trained Mask R-CNN model to obtain the initial segmentation result; for suspected stacked regions that are not completely separated in the initial segmentation result, the Watershed algorithm is used to complete the segmentation adjustment and obtain the secondary segmentation result;

[0008] Based on the secondary segmentation results, an overlap index is generated in the suspected stacking area, and the overlap index is compared with a preset overlap threshold. Based on the comparison results, a first-level optimization mechanism or a second-level optimization mechanism is selectively triggered.

[0009] First-level optimization mechanism: Input the overlap index into the corresponding function model, and output the kernel radius after first-level optimization;

[0010] Secondary optimization mechanism: Input the overlap index and local microbial density into the corresponding function model, and output the kernel radius after secondary optimization;

[0011] Based on the optimized kernel radius, the original Watershed algorithm is improved to obtain the improved Watershed algorithm, which further segments the suspected overlapping regions and outputs the segmentation results.

[0012] Furthermore, the preprocessing of microbial sample images includes: image denoising and image enhancement;

[0013] Image denoising methods include at least: median filtering and mean filtering;

[0014] Image enhancement methods include at least histogram equalization, contrast enhancement, and edge sharpening.

[0015] Furthermore, the process of segmentation adjustment using the Watershed algorithm is as follows:

[0016] Seed point labeling: The seed of each microorganism is labeled by finding local minima based on distance transformation;

[0017] Perform Watershed Transform: Perform Watershed Transform based on the calibrated seed points;

[0018] Secondary segmentation: The Mask R-CNN model is used to obtain the bounding box and mask of each microbial individual as the secondary segmentation result.

[0019] Furthermore, the process of generating overlap indices within suspected stacking areas is as follows:

[0020] Condition 1: When two microorganisms exist in the suspected stacked area, calculate the overlap D_overlap based on the mask of the two microorganisms:

[0021] ;

[0022] In the formula, A i and A j Let A represent the pixel areas of microorganism i and microorganism j, respectively; ij Let be the pixel area of ​​the intersection region of the masks corresponding to microorganisms i and j;

[0023] The overlap degree D_overlap is used as the overlap index Di;

[0024] Condition 2: When there are more than two microorganisms in the suspected stacked area, the overlap D_overlap is calculated for each pair of adjacent microorganisms, and the average value is taken as the overlap index Di.

[0025] Furthermore, the process of comparing the overlap index with the preset overlap threshold is as follows:

[0026] When the overlap index Di < overlap threshold T_threshold, the first-level optimization mechanism is triggered.

[0027] When the overlap index Di is greater than or equal to the overlap threshold T_threshold, the secondary optimization mechanism is triggered.

[0028] Furthermore, the corresponding function model operating in the first-level optimization mechanism is the first kernel radius correction function model, and the correction function is as follows:

[0029] ;

[0030] In the formula, r': the kernel radius after first-level optimization;

[0031] r: Initially set kernel radius;

[0032] k1: First empirical coefficient, with a value range of [0, 1].

[0033] Furthermore, the corresponding function model operating in the second-level optimization mechanism is the second kernel radius correction function model, and the correction function is as follows:

[0034] ;

[0035] In the formula, r″: the kernel radius after second-order optimization;

[0036] k2: Second empirical coefficient, with a value range of [1, 2];

[0037] w1, w2: weighting coefficients, and w1+w2=1;

[0038] pl = N / S, where pl: local microbial density, N: number of microorganisms in the suspected stacking area, and S: total area of ​​the suspected stacking area.

[0039] A microbial detection system based on image recognition, the system comprising:

[0040] Image acquisition and preprocessing module: acquires images of microbial samples and performs preprocessing; characterized in that:

[0041] Preliminary adjustment and segmentation module: Input the preprocessed microbial sample image into the trained Mask R-CNN model to obtain preliminary segmentation results; for suspected stacked regions that are not completely separated in the preliminary segmentation results, the Watershed algorithm is used to complete the segmentation adjustment and obtain secondary segmentation results;

[0042] Overlap Calculation and Judgment Module: Based on the secondary segmentation results, it generates an overlap index in the suspected stacking area and compares the overlap index with a preset overlap threshold. Based on the comparison results, it selectively triggers a first-level optimization mechanism or a second-level optimization mechanism.

[0043] Optimization mechanism operation module: First-level optimization mechanism: Input the overlap index to the corresponding function model, and output the kernel radius after first-level optimization; Second-level optimization mechanism: Input the overlap index and local microbial density to the corresponding function model, and output the kernel radius after second-level optimization;

[0044] Segmentation result output module: Based on the optimized kernel radius, the original Watershed algorithm is improved to obtain the improved Watershed algorithm, which further segments the suspected overlapping areas and outputs the segmentation results.

[0045] An electronic device includes a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that the processor executes the computer program to implement a microbial detection method based on image recognition.

[0046] A computer-readable storage medium having a computer program stored thereon, which, when executed, implements an image recognition-based microbial detection method.

[0047] This invention provides a microbial detection system and method based on image recognition, which has the following beneficial effects:

[0048] (1) This scheme combines Mask R-CNN instance segmentation and Watershed algorithm for secondary segmentation to achieve accurate separation of tightly adhered or stacked microorganisms. Specifically, by introducing Mask R-CNN for initial segmentation and using the Watershed algorithm for fine segmentation of suspected overlapping areas, the segmentation accuracy of individual microorganisms is initially improved, solving the problem that traditional methods often rely on fixed parameter settings when dealing with microorganism overlap, making it difficult to cope with complex adhesion situations.

[0049] (2) The scheme adopts targeted first-level optimization and second-level optimization mechanisms, both of which are applied to the unified parameter "segmentation kernel radius" in the original Watershed algorithm, improving the consistency, interpretability and logical closed loop of the entire automated detection method. This enables the method to dynamically adjust a quantifiable and easily controllable core parameter by introducing local microbial density based on the overlap index, thereby achieving more stable and reliable microbial individual separation, which is convenient for accurate identification and detection.

[0050] (3) This scheme adjusts the core parameters of the original Watershed algorithm to obtain the improved Watershed algorithm. The improved Watershed algorithm is then used to segment individual microorganisms again. Based on the original combination of Mask R-CNN instance segmentation + Watershed algorithm secondary segmentation, the segmentation accuracy of individual microorganisms is further improved in a targeted manner, solving the problem that the accuracy of traditional microorganism detection and identification cannot be further improved. Attached Figure Description

[0051] Figure 1 This is a flowchart illustrating the overall steps of an image recognition-based microbial detection method according to the present invention. Detailed Implementation

[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0053] Example 1:

[0054] Please see Figure 1 This embodiment provides a microbial detection method based on image recognition. This method is suitable for the rapid screening and identification of common pathogenic bacteria, viruses and other microorganisms by disease control centers. It achieves high-precision and automated detection by collecting sample images and combining them with a convolutional neural network (CNN) model for feature extraction and classification.

[0055] The specific procedure for running this detection method is as follows:

[0056] S1. Image Acquisition and Preprocessing:

[0057] S1.1 Image Acquisition:

[0058] Use microscopic imaging equipment or electron microscopes to obtain images of microbial samples;

[0059] The image types in the microbial sample images include at least: optical microscope images (such as Gram staining and acid-fast staining), fluorescence images, and transmission electron microscope images (for virus morphology observation).

[0060] These images will serve as the basis for subsequent identification;

[0061] To ensure the highest possible image quality and minimize noise interference, subsequent steps are performed.

[0062] S1.2 Image Denoising and Enhancement:

[0063] Applying medium-value filtering to remove noise from microbial sample images;

[0064] Since imaging equipment may have noise interference, preliminary image cleaning is required. Common methods include median filtering and mean filtering, which aim to remove unnecessary noise in the image and improve image quality.

[0065] Use histogram equalization or other contrast enhancement techniques to improve image sharpness;

[0066] In order to display the detailed features of microorganisms more clearly, it is also necessary to perform operations such as contrast enhancement and edge sharpening on the image; the histogram equalization used above improves the overall visibility of the image, making the outline of the microorganisms clearer and easier for subsequent identification.

[0067] S2. Preliminary adjustments and segmentation:

[0068] S2.1 Instance segmentation using the Mask R-CNN model:

[0069] The preprocessed microbial sample images are input into the trained Mask R-CNN model to obtain the bounding box and mask of each microbial individual as the initial segmentation result. The model training is a conventional and existing technical solution, which is not discussed in detail here because it is not related to or has a low degree of correlation with the core solution of this implementation.

[0070] This step can effectively separate most non-overlapping or slightly overlapping microbial individuals;

[0071] S2.2 For suspected stacked regions that Mask R-CNN failed to completely separate, the Watershed algorithm was used to complete the segmentation adjustment:

[0072] Seed point labeling: First, the "seed point" for each microorganism needs to be determined. This can be done by finding local minima based on distance transform, or by enhancing contrast using other preprocessing techniques (such as morphological operations). Watershed transformation: A Watershed transformation is performed based on the selected seed points to separate closely connected microorganisms. Secondary segmentation: The bounding box and mask for each microorganism are obtained using the Mask R-CNN model as the secondary segmentation result.

[0073] The above is the first time that the unmodified Watershed algorithm (i.e., advanced segmentation technique) has been used to perform secondary segmentation on suspected overlapping regions, so that closely connected microbial individuals are separated as much as possible. The main purpose is to facilitate subsequent calculation of overlap.

[0074] By combining Mask R-CNN instance segmentation with Watershed algorithm for secondary segmentation, the system achieves accurate separation of tightly adhered or stacked microorganisms. Specifically, Mask R-CNN is introduced for initial segmentation, and Watershed algorithm is used for fine segmentation of suspected overlapping areas. This initially improves the segmentation accuracy of individual microorganisms and solves the problem that traditional methods often rely on fixed parameter settings when dealing with microorganism overlap, making it difficult to handle complex adhesion situations.

[0075] S3. Overlap Calculation and Judgment:

[0076] S3.1 Calculate the overlap index Di within the suspected stacking area:

[0077] When two microorganisms exist in a suspected stacked area, the overlap D_overlap is calculated for adjacent microorganisms based on their masks:

[0078] ;

[0079] In the formula, A i and A j Let A represent the pixel areas of microorganisms i and j, respectively; ij This represents the pixel area of ​​the intersection region between the two masks; in this case, the overlap D_overlap is used as the overlap index Di.

[0080] It should be noted that the above formula measures the degree of "relative coverage" between two microorganisms; if one completely covers the other, the overlap is close to 1; if there is no overlap, it is 0.

[0081] When there are more than two microorganisms in the suspected stacked area, the overlap D_overlap is calculated for each pair of adjacent microorganisms, and then the average value is taken as the overlap index Di.

[0082] S3.2 Determine how to optimize:

[0083] Set the overlap threshold T_threshold;

[0084] Among them, a reasonable overlap threshold T_threshold is determined based on historical experimental data to define the severity of overlap. Determining a reasonable overlap threshold T_threshold is a key step in optimizing the accuracy of microbial segmentation. This process mainly relies on historical experimental data and uses statistical analysis to find a threshold that can effectively distinguish between mild and severe overlap while maximizing segmentation accuracy.

[0085] The specific steps are as follows:

[0086] Collect historical data: First, collect a dataset containing known overlap from past microscopic image samples; this data should include images of different types of microorganisms under various conditions and their corresponding segmentation results (true positives, false positives, etc.); Calculate overlap: For each pair of adjacent microorganisms in each sample, calculate their overlap Di; Performance evaluation: Based on different overlap thresholds T_threshold (e.g., gradually increasing from 0.1 to 1.0), evaluate the model's performance metrics at that threshold, such as accuracy, recall, and F1 score; cross-validation can be used to ensure the robustness of the evaluation results; Determine the optimal threshold: Select the overlap threshold T_threshold that maximizes the overall performance metrics (e.g., F1 score) as the final threshold; typically, the optimal point can be visually observed by plotting performance curves at different overlap thresholds T_threshold; Validation and adjustment: Apply the selected overlap threshold T_threshold to a new independent test set for validation, and make appropriate fine-tuning based on the actual results to ensure the effectiveness of the threshold in practical applications.

[0087] When the overlap index Di < overlap threshold T_threshold, the overlap is considered to be relatively light, triggering the first-level optimization mechanism;

[0088] If the overlap index Di is greater than or equal to the overlap threshold T_threshold, the overlap is considered severe, triggering the secondary optimization mechanism.

[0089] The secondary optimization mechanism is more advanced than the primary optimization mechanism, thus ensuring the accuracy and effectiveness of subsequent identification results.

[0090] S4. Application of first- or second-level optimization mechanisms based on overlap:

[0091] The operation process of the first-level optimization mechanism is as follows:

[0092] Based on the overlap index Di, a first kernel radius correction function model is constructed, and the correction function is as follows:

[0093] ;

[0094] In the formula, r': the kernel radius after first-level optimization; r: the initial kernel radius; k1: the first empirical coefficient, which controls the sensitivity, and its value range is [0, 1] (for example, set to 1.0).

[0095] Function logic explanation: When the overlap index is low, it indicates that the adhesion is light. At this time, it is only necessary to slightly increase the kernel radius to improve the sensitivity of Wathershed to small connected regions and avoid false cutting. Conversely, when the overlap index is close to T_threshold, it indicates that the adhesion is close to medium. The kernel radius should be appropriately increased to enhance the segmentation ability.

[0096] The operation process of the secondary optimization mechanism is as follows:

[0097] Based on the overlap index Di and by introducing the local microbial density pl, a second kernel radius correction function model is constructed, and the correction function is as follows:

[0098] ;

[0099] In the formula, r」: the kernel radius after secondary optimization; r: the initial kernel radius; k2: the second empirical coefficient, which controls the overall adjustment range, and the value range is [1, 2]; w1, w2: weight coefficients, and w1+w2=1;

[0100] pl = N / S, where N: the number of microorganisms in the suspected stacking area; S: the total area (number of pixels) of the suspected stacking area; when the overlap index Di exceeds the overlap threshold T_threshold, it indicates severe adhesion. At this time, the core radius should be significantly increased so that Watershed can better capture deep structural differences; at the same time, combined with the local density factor, if the microorganisms in the area are dense, the core radius should be further increased to avoid the inability to effectively separate multiple stacked individuals due to insufficient parameters;

[0101] Among them, the weight allocation mechanism is w1 and w2;

[0102] Control the relative importance of the two influencing factors; for example:

[0103] If the samples overlap significantly but the density is not high, increase w1.

[0104] If the sample density is high but the overlap is not severe, increase w2.

[0105] Ultimately, ensure that the sum of the two equals 1 to guarantee overall balance.

[0106] The core objective of the above design is to optimize the segmentation effect of individual microorganisms by dynamically adjusting the kernel radius r of the Watershed algorithm. The above formula uses the overlap index Di between microorganisms and the local microbial density pl as key influencing factors, and adjusts their relative importance in the final decision through weights, and combines empirical coefficients to control the overall adjustment range, thereby achieving adaptive optimization. When the overlap between microorganisms is severe, their adhesion is serious, and the kernel radius needs to be increased to enhance the segmentation ability. High-density regions further amplify this need, ensuring that each individual microorganism can be accurately segmented even in complex stacking situations. This mechanism enables the system to automatically adjust parameters according to the specific situation of microorganisms in the image, thereby improving segmentation accuracy and robustness.

[0107] Both the first-level and second-level optimizations apply to the unified parameter "segmentation kernel radius" in the original Watershed algorithm; this improves the consistency, interpretability, and logical closure of the entire automated detection method; and enables the method to dynamically adjust a quantifiable and easily controllable core parameter based on information such as overlap and density, thereby achieving more stable and reliable microbial individual separation, which facilitates accurate identification and detection.

[0108] Specifically, the main difference between the first-level optimization mechanism and the second-level optimization mechanism is:

[0109] The severity of microbial adhesion varies. Level 1 optimization targets mild or non-severe overlap, where only a slight adjustment to the kernel radius of the Watershed algorithm is needed to effectively separate individual microorganisms. Level 2 optimization, on the other hand, targets severe adhesion or stacking, requiring more significant parameter adjustments and additional consideration of local microbial density to ensure accurate segmentation. Existing methods typically rely on a single parameter (such as a fixed kernel radius) or a simple threshold judgment, which is insufficient to handle complex adhesion scenarios.

[0110] This scheme creatively introduces local microbial density *pl* as an auxiliary decision-making factor in its secondary optimization mechanism. Combined with the overlap index *Di*, it dynamically adjusts the kernel radius to adapt to complex structures at different densities. This dual approach not only enhances the system's sensitivity to high-density regions but also effectively avoids missegmentation caused by relying solely on overlap. Therefore, this scheme significantly improves segmentation accuracy and robustness when dealing with severely adhered or stacked microorganisms, solving the problem of inaccurate segmentation caused by the lack of multi-dimensional information in traditional methods, demonstrating greater flexibility and adaptability. This improvement enables the system to maintain high recognition efficiency even in complex experimental environments.

[0111] Existing multi-dimensional optimization methods may involve multiple independent empirical coefficients or complex rule sets, which increases the complexity of the system and the difficulty of debugging. In contrast, this scheme focuses all optimization on a single core parameter, namely the kernel radius r of the Watershed algorithm, and comprehensively considers multiple factors through a simplified model function. This design not only simplifies the model structure, but also enhances the interpretability and maintainability of the system.

[0112] In summary, although existing solutions may have also incorporated multi-dimensional information, this solution provides greater accuracy and flexibility in handling heavily adhered or stacked microorganisms through a more refined and adaptive parameter adjustment strategy, overcoming the limitations of traditional methods. This improvement not only enhances the segmentation effect but also provides a solid foundation for subsequent automated detection and data analysis.

[0113] S5. Final segmentation result output:

[0114] S5.1, Perform Watershed splitting:

[0115] Based on the calculated optimized kernel radius r' or r'', the original Watershed algorithm is improved to obtain the improved Watershed algorithm; suspected overlapping areas are further segmented to separate closely connected microbial individuals;

[0116] S5.2 Output the segmentation results:

[0117] Output the final high-precision microbial individual mask and pixel area;

[0118] This information will be used for subsequent classification and recognition tasks.

[0119] In this scheme, the original Watershed algorithm (i.e., advanced segmentation technology) is used for the first time to segment suspected overlapping regions, separating some (e.g., 60%) closely connected microbial individuals to facilitate subsequent calculation of the overlap index; the improved original Watershed algorithm is used for the second time to separate some (e.g., 90%) closely connected microbial individuals more finely, facilitating subsequent identification and detection. The two algorithms play different roles.

[0120] By adjusting the core parameters of the original Watershed algorithm, an improved Watershed algorithm was derived. This improved Watershed algorithm was then used to further segment individual microorganisms. Based on the original combination of Mask R-CNN instance segmentation and Watershed algorithm secondary segmentation, the segmentation accuracy of individual microorganisms was further and specifically improved, solving the problem that traditional methods could not further improve the accuracy of microorganism detection and identification.

[0121] In summary, the specific implementation case is as follows:

[0122] Suppose a disease control center has a microscope image of E. coli, in which some bacteria form a stacked structure;

[0123] The steps are demonstrated below:

[0124] Image acquisition and preprocessing: Images of E. coli were captured using a microscope, and necessary noise reduction and contrast enhancement were performed; Preliminary segmentation: The input image was fed into the Mask R-CNN model, and the original Watershed algorithm was used to complete the segmentation to obtain bounding boxes and masks for multiple microbial individuals; Overlap calculation and determination: Assuming two sets of suspected overlapping regions were detected: Region A: Microorganisms A1 and A2, overlap index Di=0.48, local microbial density pl=0.3;

[0125] Region B: Microorganisms B1 and B2, overlap index Di=0.72, local microbial density pl=0.8;

[0126] Since the overlap threshold T_threshold is 0.5, region A is considered to have a light degree of overlap, triggering the first-level optimization mechanism; region B is considered to have a severe degree of overlap, triggering the second-level optimization mechanism.

[0127] Applications of first- or second-level optimization mechanisms based on overlap:

[0128] For region A, adjust the kernel radius to r':

[0129] r'=3.0+1.0×(0.5-0.48)=3.02;

[0130] For region B, adjust the kernel radius to r″:

[0131] r"=3.0+1.5×[0.6×(0.72-0.5)+0.4×0.8]=3.678≈3.68 (rounded to two decimal places);

[0132] Final segmentation results output: Based on the calculated optimized kernel radii r' and r'', the corresponding suspected overlapping regions are segmented using improved Watershed technology; the final microbial individual mask is output, achieving accurate separation.

[0133] Summary and advantages:

[0134] By integrating microbial overlap judgment and optimization mechanisms into an image recognition-based microbial detection method, the following improvements are achieved: 1. Higher degree of automation: The entire process, from image acquisition to final segmentation result output, can be automated; 2. Improved segmentation accuracy: Different optimization strategies are adopted for different degrees of adhesion or stacking, significantly improving the segmentation accuracy of individual microorganisms; 3. High flexibility: Parameters such as thresholds and empirical coefficients can be adjusted according to actual needs to adapt to different types of microbial samples; 4. Easy deployment and maintenance: Parameter settings are simplified, debugging difficulty is reduced, and engineering implementation is facilitated. This solution is particularly suitable for scenarios requiring high-precision microbial image recognition, such as disease control centers and medical laboratories, and helps to quickly and accurately identify pathogens, supporting disease prevention and control efforts.

[0135] Example 2:

[0136] Based on Example 1, this embodiment also provides a microbial detection system based on image recognition. The system includes: an image acquisition and preprocessing module: acquiring images of microbial samples and performing preprocessing;

[0137] Preliminary adjustment and segmentation module: Input the preprocessed microbial sample image into the trained Mask R-CNN model to obtain preliminary segmentation results; for suspected stacked regions that are not completely separated in the preliminary segmentation results, the Watershed algorithm is used to complete the segmentation adjustment and obtain secondary segmentation results;

[0138] Overlap Calculation and Judgment Module: Based on the secondary segmentation results, it generates an overlap index in the suspected stacking area and compares the overlap index with a preset overlap threshold. Based on the comparison results, it selectively triggers a first-level optimization mechanism or a second-level optimization mechanism.

[0139] Optimization mechanism operation module: First-level optimization mechanism: Input the overlap index to the corresponding function model, and output the kernel radius after first-level optimization; Second-level optimization mechanism: Input the overlap index and local microbial density to the corresponding function model, and output the kernel radius after second-level optimization;

[0140] Segmentation result output module: Based on the optimized kernel radius, the original Watershed algorithm is improved to obtain the improved Watershed algorithm, which further segments the suspected overlapping areas and outputs the segmentation results.

[0141] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters, weights, and thresholds in the formulas are set by those skilled in the art according to the actual situation.

[0142] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired or wireless network. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.

[0143] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A microbial detection method based on image recognition, comprising the following steps: Acquire images of microbial samples and perform preprocessing; characterized in that: The preprocessed microbial sample image is input into the trained Mask R-CNN model to obtain the initial segmentation result; for suspected stacked regions that are not completely separated in the initial segmentation result, the Watershed algorithm is used to complete the segmentation adjustment and obtain the secondary segmentation result; Based on the secondary segmentation results, an overlap index is generated in the suspected stacking area, and the overlap index is compared with a preset overlap threshold. According to the comparison results, a first-level optimization mechanism or a second-level optimization mechanism is selectively triggered. Specifically, when the overlap index Di < the overlap threshold T_threshold, the first-level optimization mechanism is triggered; when the overlap index Di ≥ the overlap threshold T_threshold, the second-level optimization mechanism is triggered. The process of generating overlap indices within suspected stacking areas is as follows: Condition 1: When two microorganisms exist in the suspected stacked area, calculate the overlap D_overlap based on the mask of the two microorganisms: ; In the formula, A i and A j Let A represent the pixel areas of microorganism i and microorganism j, respectively; ij Let be the pixel area of ​​the intersection region of the masks corresponding to microorganisms i and j; The overlap degree D_overlap is used as the overlap index Di; Condition 2: When there are more than two microorganisms in the suspected stacked area, the overlap D_overlap is calculated for each pair of adjacent microorganisms, and the average value is taken as the overlap index Di. First-level optimization mechanism: Input the overlap index to the corresponding function model, and output the kernel radius after first-level optimization; the corresponding function model running in the first-level optimization mechanism is the first kernel radius correction function model, and the correction function is as follows: ; In the formula, r': the kernel radius after first-level optimization; r: Initially set kernel radius; k1: First empirical coefficient, with a value range of [0, 1]; T_threshold: Overlap threshold; Secondary optimization mechanism: Input the overlap index and local microbial density into the corresponding function model, and output the kernel radius after secondary optimization; the corresponding function model running in the secondary optimization mechanism is the second kernel radius correction function model, and the correction function is as follows: ; In the formula, r″: the kernel radius after second-order optimization; k2: Second empirical coefficient, with a value range of [1, 2]; w1, w2: weighting coefficients, and w1+w2=1; pl = N / S, where pl: local microbial density, N: number of microorganisms in the suspected stacking area; S: Total area of ​​the suspected stacking area; Based on the optimized kernel radius, the original Watershed algorithm is improved to obtain the improved Watershed algorithm, which further segments the suspected overlapping regions and outputs the segmentation results.

2. The microbial detection method based on image recognition according to claim 1, characterized in that: The preprocessing of microbial sample images includes: image denoising and image enhancement; Image denoising methods include at least: median filtering and mean filtering; Image enhancement methods include at least histogram equalization, contrast enhancement, and edge sharpening.

3. The microbial detection method based on image recognition according to claim 1, characterized in that: The process of performing segmentation and adjustment using the Watershed algorithm is as follows: Seed point labeling: The seed of each microorganism is labeled by finding local minima based on distance transformation; Perform Watershed Transform: Perform Watershed Transform based on the calibrated seed points; Secondary segmentation: The Mask R-CNN model is used to obtain the bounding box and mask of each microbial individual as the secondary segmentation result.

4. A microbial detection system based on image recognition, the system comprising: Image acquisition and preprocessing module: acquires images of microbial samples and performs preprocessing; characterized in that: Preliminary adjustment and segmentation module: Input the preprocessed microbial sample image into the trained Mask R-CNN model to obtain preliminary segmentation results; for suspected stacked regions that are not completely separated in the preliminary segmentation results, the Watershed algorithm is used to complete the segmentation adjustment and obtain secondary segmentation results; Overlap Calculation and Judgment Module: Based on the secondary segmentation results, it generates an overlap index in the suspected stacking area and compares the overlap index with a preset overlap threshold. Based on the comparison results, it selectively triggers either a first-level optimization mechanism or a second-level optimization mechanism. Specifically, when the overlap index Di < the overlap threshold T_threshold, the first-level optimization mechanism is triggered; when the overlap index Di ≥ the overlap threshold T_threshold, the second-level optimization mechanism is triggered. The process of generating overlap indices within suspected stacking areas is as follows: Condition 1: When two microorganisms exist in the suspected stacked area, calculate the overlap D_overlap based on the mask of the two microorganisms: ; In the formula, A i and A j Let A represent the pixel areas of microorganism i and microorganism j, respectively; ij Let be the pixel area of ​​the intersection region of the masks corresponding to microorganisms i and j; The overlap degree D_overlap is used as the overlap index Di; Condition 2: When there are more than two microorganisms in the suspected stacked area, the overlap D_overlap is calculated for each pair of adjacent microorganisms, and the average value is taken as the overlap index Di. Optimization mechanism operation module: Level 1 optimization mechanism: Input the overlap index to the corresponding function model, and output the kernel radius after level 1 optimization; the corresponding function model running in the level 1 optimization mechanism is the first kernel radius correction function model, and the correction function is as follows: ; In the formula, r': the kernel radius after first-level optimization; r: Initially set kernel radius; k1: First empirical coefficient, with a value range of [0, 1]; T_threshold: Overlap threshold; Secondary optimization mechanism: Input the overlap index and local microbial density to the corresponding function model, and output the kernel radius after secondary optimization; The corresponding function model running in the secondary optimization mechanism is the second kernel radius correction function model, and the correction function is as follows: ; In the formula, r″: the kernel radius after second-order optimization; k2: Second empirical coefficient, with a value range of [1, 2]; w1, w2: weighting coefficients, and w1+w2=1; pl = N / S, where pl: local microbial density, N: number of microorganisms in the suspected stacking area, and S: total area of ​​the suspected stacking area; Segmentation result output module: Based on the optimized kernel radius, the original Watershed algorithm is improved to obtain the improved Watershed algorithm, which further segments the suspected overlapping areas and outputs the segmentation results.

5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the microbial detection method based on image recognition as described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the image recognition-based microbial detection method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Image splicing method based on improved image fusion

    CN107146201A

  • Image synthesis method and device

    CN112017120A