Method and system for recognizing number of bacteria based on combination of image recognition and deep learning

By combining image recognition and deep learning technology, automatically identifying and counting bacteria in liquid culture media, the problems of inefficiency and low accuracy of traditional methods are solved, and more efficient and accurate microbial counting is achieved.

CN120071338APending Publication Date: 2025-05-30BEIJING ZHONGJIAN CONSTR RES INST CO LTD +4
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510023300.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

Traditional microbial counting methods rely on manual observation and counting in liquid culture media, resulting in inefficiency and low accuracy.

Method used

The bacterial number recognition method based on the combination of image recognition and deep learning is adopted. The stained culture fluid pictures are captured through microscopes and imaging equipment, and the image recognition algorithm is used for preliminary identification, and further verified and precise counting is carried out through the deep learning model.

Benefits of technology

It improves the accuracy and efficiency of bacterial number identification, reduces errors due to the limitations of a single technology, and achieves more accurate and efficient bacteria counting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120071338A_ABST
    Figure CN120071338A_ABST
Patent Text Reader

Abstract

The invention provides a bacterium number identification method and system based on combination of image identification and deep learning, and relates to the technical field of microbiological detection, the method comprises the following steps: capturing a dyed culture solution picture through a microscope and camera equipment; the preprocessed culture solution picture is recognized based on an image recognition algorithm, a first recognition result of the number of bacteria is obtained, and preprocessing comprises image segmentation, color correction, contrast adjustment and morphological processing; inputting the preprocessed culture solution picture and the corresponding staining information into a deep learning recognition model to obtain a second recognition result of the number of bacteria; if it is detected that the deviation between the first recognition result and the second recognition result is smaller than a preset deviation threshold value, the second recognition result is set as the number of bacteria in the culture solution picture. By implementing the method, the accuracy and efficiency of identification can be improved, errors caused by limitation of a single technology are reduced, and more accurate and efficient bacterium counting is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of microbial detection, and particularly to a method and system for identifying the number of bacteria by combining image recognition and deep learning. Background Art

[0002] Microbial detection technology is one of the key technologies in the fields of public health, food safety, and medical health. With the increasing social requirements for health and safety standards, the requirements for the accuracy and efficiency of microbial detection are also increasing. Traditional microbial detection methods, including food safety monitoring, clinical pathogen detection, etc., play a crucial role in ensuring public health and food safety.

[0003] In the prior art, for bacteria in solid culture media, machine learning or image recognition algorithms are generally used to identify colony characteristics, and then estimate the number of bacteria in the solid culture media; but for liquid culture media, it mainly relies on manual microscopic observation and counting. Usually, the sample is stained and then observed under the microscope, and the operator manually identifies and counts the microorganisms in the microscopic scene.

[0004] However, in liquid culture media, traditional microbial counting methods mainly rely on manual observation and statistics, which are not only time-consuming and laborious, but also easily affected by subjective factors, resulting in low accuracy. Summary of the Invention

[0005] This application provides a method and system for identifying the number of bacteria by combining image recognition and deep learning, which is used to solve the problems of low efficiency and low accuracy caused by manual operation in traditional microbial counting methods.

[0006] In a first aspect, this application provides a method for identifying the number of bacteria by combining image recognition and deep learning, which is applied to a microbial counting system. The method includes: Capturing a stained culture solution picture through a microscope and a camera device; Identifying the preprocessed culture solution picture based on an image recognition algorithm to obtain a first recognition result of the number of bacteria. The preprocessing includes image segmentation, color correction, contrast adjustment, and morphological processing; Inputting the preprocessed culture solution picture and corresponding staining information into a deep learning recognition model to obtain a second recognition result of the number of bacteria; If it is detected that the deviation between the first recognition result and the second recognition result is less than a preset deviation threshold, then set the second recognition result as the number of bacteria in the culture solution picture.

[0007] Through the above embodiments, the microbial counting system uses a microscope and a camera device to capture pictures of the stained culture solution, performs preliminary identification of the number of bacteria through an image recognition algorithm, and conducts further verification and accurate counting through a deep learning model. This improves the accuracy and efficiency of identification, reduces errors caused by single technology limitations, realizes more accurate and efficient bacterial counting, and is applicable to high-demand microbial detection scenarios.

[0008] In some embodiments, before the step of capturing pictures of the stained culture solution by the microscope and the camera device, the following steps are further included: Obtain the type of bacteria to be identified by number; Match a staining agent and staining conditions according to the type of bacteria.

[0009] Through the above embodiments, the microbial counting system enhances the quality of the culture solution pictures and the recognizability of bacteria by obtaining the type of bacteria before capturing pictures and accordingly matching suitable staining agents and staining conditions, enabling subsequent image processing and deep learning models to more accurately identify and count.

[0010] In some embodiments, before the step of identifying the preprocessed culture solution picture based on the image recognition algorithm to obtain a first recognition result of the number of bacteria, the following steps are further included: Use a segmentation algorithm to separate the culture solution area in the culture solution picture from the background to achieve image segmentation; Use color equalization technology to perform color correction on the culture solution picture after image segmentation; Perform morphological processing on the culture solution picture after color correction to optimize and extract the morphological features of bacteria in the culture solution picture.

[0011] Through the above embodiments, the microbial counting system optimizes the quality of the culture solution pictures through preprocessing steps such as image segmentation, color correction, and morphological processing, making the bacterial features more prominent and easy to identify. It can reduce the interference of background noise and irrelevant information, and improve the recognition accuracy and efficiency of the image recognition algorithm for the number of bacteria.

[0012] In some embodiments, before the step of inputting the preprocessed culture solution picture into the deep learning recognition model to obtain a second recognition result of the number of bacteria, the following steps are further included: Obtain training samples and corresponding training labels, where the training labels include the image information of the training samples and the staining information corresponding to the training samples; Under different training label classifications, perform bacterial annotation on the preprocessed training samples to obtain annotation data, and the training labels are classified according to the staining information corresponding to the training samples; Construct a target recognition data set based on the well-annotated training samples; Based on this target recognition data set, model training is carried out to obtain deep learning recognition models corresponding to different training identifiers, which are used to recognize the key features of the culture medium pictures and predict the number of bacteria.

[0013] Through the above embodiments, in the microbial counting system, through precise training sample annotation, the deep learning model can learn more complex image features and patterns, so as to more accurately predict the number of bacteria in practical applications, improving the generalization ability and recognition efficiency of the model.

[0014] In some embodiments, the step of inputting the preprocessed culture medium picture and the corresponding staining information into the deep learning recognition model to obtain the second recognition result of the number of bacteria specifically includes: Matching the corresponding training identifier according to the staining information corresponding to the culture medium picture; Determining the target deep learning recognition model from the deep learning recognition models corresponding to different training identifiers according to the training identifier; Inputting the culture medium picture into the target deep learning recognition model and outputting the second recognition result of the number of bacteria.

[0015] Through the above embodiments, the microbial counting system selects an appropriate deep learning model according to the staining information, and outputs the second recognition result of the number of bacteria through this model. Matching the staining information with the training identifier ensures the optimal performance of the model when processing specific types of stained pictures. This method further improves the accuracy and adaptability of recognition by precisely matching the model with the staining information.

[0016] In some embodiments, after the step of inputting the preprocessed culture medium picture and the corresponding staining information into the deep learning recognition model to obtain the second recognition result of the number of bacteria, it further includes: If it is detected that the deviation between the first recognition result and the second recognition result is greater than or equal to the preset deviation threshold, re-capture the stained culture medium picture for secondary measurement.

[0017] Through the above embodiments, the microbial counting system has a mechanism to judge whether to re-capture pictures by comparing the deviation between the two recognition results. If the deviation between the first and second recognition results is large, the system will re-capture the stained culture medium picture for secondary measurement. This feedback mechanism can effectively correct possible errors and deviations, ensure the accuracy of the final result, and thus improve the reliability and stability of the entire system.

[0018] In some embodiments, after the step of re-capturing the stained culture medium picture for secondary measurement, it further includes: Obtaining the new first recognition result and the second recognition result obtained from the secondary measurement; Determine the accuracy rate of the image recognition algorithm and the accuracy rate of the deep learning recognition model respectively based on the difference between the two first recognition results and the difference between the two second recognition results; Determine the target to be adjusted based on the accuracy rate of the image recognition algorithm and the accuracy rate of the deep learning recognition model.

[0019] Through the above embodiments, by comparing the two recognition results, the microbial counting system can not only confirm the effectiveness of the current algorithm and model, but also determine the future optimization direction based on the actual recognition differences.

[0020] In a second aspect, the present application provides a microbial counting system, which includes: one or more processors and a memory; The memory is coupled to the one or more processors. The memory is used to store computer program code, and the computer program code includes computer instructions. The one or more processors call the computer instructions so that the microbial counting system can implement the method for identifying the number of bacteria based on the combination of image recognition and deep learning provided in the above embodiments, which will not be elaborated here.

[0021] In a third aspect, the present application provides a computer-readable storage medium, including instructions. When the instructions run on the microbial counting system, the microbial counting system can implement the method for identifying the number of bacteria based on the combination of image recognition and deep learning provided in the above embodiments, which will not be elaborated here.

[0022] In a fourth aspect, the present application provides a computer program product. When the computer program product runs on the microbial counting system, the microbial counting system can implement the method for identifying the number of bacteria based on the combination of image recognition and deep learning provided in the above embodiments, which will not be elaborated here.

[0023] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. The microbial counting system uses a microscope and a camera device to capture pictures of the stained culture solution, initially identifies the number of bacteria through an image recognition algorithm, and further verifies and accurately counts through a deep learning model. It improves the accuracy and efficiency of recognition, reduces errors caused by single technology limitations, realizes more accurate and efficient bacteria counting, and is applicable to high-demand microbial detection scenarios.

[0024] 2. Before capturing bacterial images, the microbial counting system intelligently identifies the types of bacteria and matches the most suitable staining agents and staining conditions. This not only improves the quality of the culture solution pictures but also enhances the recognizability of bacteria. Through preprocessing steps such as image segmentation, color correction, and morphological processing, the system optimizes the image quality, making the bacterial features more prominent, effectively reducing the interference of background noise and irrelevant information, and providing a basis for more accurate image recognition in the subsequent steps.

[0025] 3. The microbial counting system compares the image recognition results of the first and second times. If a large deviation is found, it triggers a mechanism to recapture the pictures for a second measurement. This feedback mechanism can not only effectively correct possible errors and deviations, ensuring the accuracy of the final result, but also provide guarantees for the reliability and stability of the system, and contribute to the determination of the optimization direction of future algorithms and models. Brief Description of the Drawings

[0026] Figure 1 is a schematic flowchart of a method for identifying the number of bacteria based on the combination of image recognition and deep learning in an embodiment of the present application; Figure 2 is another schematic flowchart of a method for identifying the number of bacteria based on the combination of image recognition and deep learning in an embodiment of the present application; Figure 3 is a schematic structural diagram of an entity device of the microbial counting system in an embodiment of the present application. Detailed Embodiments

[0027] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular forms "a", "an", "the", "above", "said", "this" are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations including one or more of the listed items.

[0028] Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as implying or indicating relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present application, unless otherwise stated, the meaning of "a plurality" is two or more.

[0029] For ease of understanding, the method provided in this embodiment is described in terms of a process below. Specifically, as Figure 1As shown, it is a schematic flowchart of a method for identifying the number of bacteria based on the combination of image recognition and deep learning in an embodiment of the present application.

[0030] S101. Capture pictures of the stained culture solution through a microscope and a camera device.

[0031] Before the microbial counting system captures pictures of the bacterial culture solution, relevant technicians need to first stain the bacteria in the culture solution so that the bacteria are easier to observe and distinguish under the microscope. The specific staining method can select a suitable staining agent according to different bacterial species and characteristics. Common bacterial staining methods include Gram staining, spore staining, capsule staining, aniline black, etc. For example, Gram staining can divide bacteria into two major categories: Gram-positive bacteria and Gram-negative bacteria, making them show different colors for easy identification under the microscope.

[0032] After staining, the microbial counting system uses a microscope and a supporting high-resolution camera device to take pictures of the stained culture solution to obtain clear digital pictures. Further, in order to obtain high-quality images, the optical system of the microscope needs to be appropriately calibrated and focused to ensure a clear field of view and a stable focal plane. At the same time, parameters of the camera device such as exposure and white balance also need to be optimized. During the shooting process, try to avoid shaking of the culture solution to prevent image blurring, etc., which is not limited here.

[0033] S102. Identify the preprocessed pictures of the culture solution based on an image recognition algorithm to obtain a first recognition result of the number of bacteria.

[0034] After obtaining the pictures of the culture solution, the microbial counting system first performs a series of preprocessing operations on the pictures, such as image segmentation, color correction, contrast adjustment, and morphological processing, to optimize the image quality and highlight the bacterial characteristics. Among them, image segmentation is to separate the foreground (bacteria) and background in the picture to reduce background interference. Optional segmentation algorithms include threshold segmentation, edge detection, region growing, etc. Color correction and contrast adjustment can remove the color deviation of the picture and enhance the contrast of the image, making the bacterial contour clearer. Morphological processing such as erosion, dilation, opening and closing operations can eliminate noise in the bacterial morphology and repair the contour for subsequent feature extraction and analysis.

[0035] The microbial counting system uses an image recognition algorithm to initially identify the number of bacteria in the preprocessed and optimized culture medium pictures. Specifically, the microbial counting system extracts the morphological features of bacteria in the pictures, such as area, perimeter, roundness, etc., through the image recognition algorithm, establishes a feature model, and matches it with a preset bacterial feature database to identify and count the bacteria in the pictures, obtaining a first recognition result. Optional image feature extraction and recognition algorithms include, but are not limited to, HOG, SIFT, and SVM. Among them, the feature database stores a large number of labeled bacterial images.

[0036] S103. Input the preprocessed culture medium picture and the corresponding staining information into the deep learning recognition model to obtain a second recognition result of the number of bacteria.

[0037] After obtaining the preliminary image recognition result, the microbial counting system further uses the deep learning model to accurately identify the number of bacteria. Specifically, the microbial counting system is based on a large number of collected bacterial culture medium pictures as samples and performs manual annotation to obtain the corresponding bacterial type and quantity information. These labeled sample data and the corresponding staining type information are divided into a training set and a validation set for training and evaluating the deep learning recognition model.

[0038] Optional deep learning networks include CNN, ResNet, YOLO series, etc. The system can select an appropriate network structure and parameters according to the actual situation. In the training stage, the network model updates the model parameters by backpropagation by minimizing the error between the predicted value and the label, gradually improving the recognition ability of bacterial features. The trained model can automatically match the corresponding model weights and parameters according to the staining type of the input picture. When the preprocessed culture medium picture and the corresponding staining information are input into the trained deep learning model, the model can quickly give the recognition result of the number of bacteria in the picture, that is, the second recognition result.

[0039] S104. Whether the deviation between the first recognition result and the second recognition result is less than the preset deviation threshold.

[0040] After obtaining the preliminary image recognition result (the first recognition result) and the deep learning recognition result (the second recognition result), the microbial counting system compares and verifies the two results to ensure the accuracy and consistency of the recognition. Specifically, the microbial counting system pre-sets a deviation threshold for judging whether the two recognition results are close. If the difference between the first recognition result and the second recognition result is less than this threshold, it can be determined that the two recognitions are basically consistent and the result is credible. Among them, the deviation between the two recognition results is usually compared by relative error or absolute error. For example, the relative error can be calculated as (the first recognition result - the second recognition result) / the second recognition result. When it is less than a certain percentage (such as 5%), it is determined that the deviation is within the acceptable range.

[0041] It should be noted that the size of the pre-set deviation threshold needs to be determined according to the actual application scenario and accuracy requirements, and is not limited here.

[0042] S105. Set the second recognition result as the number of bacteria in the culture medium picture.

[0043] If the deviation between the image recognition result and the deep learning result is within the acceptable range (less than the pre-set deviation threshold) through comparison by the microbial counting system, the microbial counting system will use the second recognition result given by the deep learning model as the final measured value of the number of bacteria.

[0044] It should be noted that compared with traditional image recognition algorithms, deep learning models usually have higher recognition accuracy and generalization ability. The deep learning model can automatically learn the morphological characteristics of bacteria from a large number of complex training samples and has stronger adaptability to various noises and interferences in the image. Therefore, when the two results are basically the same, using the deep learning recognition result as the final output can give a more accurate and reliable bacterial counting result.

[0045] S106. Re-capture the stained culture medium picture for secondary measurement.

[0046] When the microbial counting system detects that the deviation between the first recognition result and the second recognition result exceeds the pre-set threshold, it will trigger the secondary measurement process, re-collect, stain and photograph the culture medium sample to obtain a new picture input, and perform image recognition and deep learning recognition again to obtain updated results.

[0047] In the secondary measurement, the microbial counting system will again call the image recognition and deep learning models to process and analyze the new pictures. At the same time, the system will also compare the results of the two measurements, calculate the accuracy rates of the image recognition and deep learning models in the two measurements, and further evaluate their reliability and stability. Specifically, if the result of the secondary measurement is not much different from the initial measurement and falls within the expected deviation range, then the average value or weighted average of the two results can be taken as the final recognition result. However, if there is still a large deviation in the result of the secondary measurement, then a prompt will be given to check and optimize each link in the recognition process, such as suggesting to adjust the sampling method, etc., which is not limited here.

[0048] S107. Obtain the new first recognition result and second recognition result obtained from the secondary measurement.

[0049] After step S106, the microbial counting system can obtain the new first recognition result given by the image recognition algorithm and the new second recognition result given by the deep learning model.

[0050] S108. Determine the accuracy rate of the image recognition algorithm and the accuracy rate of the deep learning recognition model respectively based on the difference between the two first recognition results and the difference between the two second recognition results.

[0051] With the two sets of data from the initial recognition and the secondary measurement, the microbial counting system can evaluate and compare the performance of the image recognition algorithm and the deep learning model. Specifically, the system calculates the difference between the first recognition results in the two recognitions respectively, and the difference between the second recognition results in the two recognitions. These differences can reflect the stability and consistency of the image recognition algorithm and the deep learning model in repeated tests.

[0052] Taking the image recognition algorithm as an example, assume that the number of bacteria obtained in the initial recognition is 1000, and the number of bacteria obtained in the secondary measurement is 980. Then the difference between the two results is 20. If this difference is within the acceptable range (such as ±50), it is determined that the image recognition algorithm has shown a high accuracy rate and stability in these two recognitions. Conversely, if the difference is large, it indicates that the algorithm may have certain fluctuations or uncertainties.

[0053] Similarly, the microbial counting system compares the two recognition results of the deep learning model and evaluates the accuracy rate of the model accordingly, which will not be elaborated here.

[0054] S109. Determine the target to be adjusted based on the accuracy rate of the image recognition algorithm and the accuracy rate of the deep learning recognition model.

[0055] After obtaining the accuracy evaluation results, the microbial counting system further analyzes this data to determine the next optimization direction and improvement goals. For example, in one embodiment summary, if the evaluation finds that the accuracy of the image recognition algorithm is significantly lower than that of the deep learning model, and the results of the two measurements vary greatly, the system may give a prompt message indicating that the focus of optimization should be placed on the image recognition algorithm, to prompt relevant technicians to pay attention to key links such as image preprocessing, feature extraction, and segmentation algorithms, and improve the accuracy and robustness of image recognition by introducing new technical methods or adjusting existing processes.

[0056] On the contrary, if the accuracy of the deep learning model is relatively low, or shows large fluctuations in different test cases, the system may give a prompt message to prioritize improving the deep learning model. For example, it prompts relevant technicians to make adjustments to the model structure, expand the training data, optimize the loss function, etc.

[0057] In the above embodiment, the microbial counting system uses a microscope and a camera device to capture pictures of the stained culture solution, performs preliminary identification of the number of bacteria through an image recognition algorithm, and conducts further verification and precise counting through a deep learning model. It improves the accuracy and efficiency of recognition, reduces errors caused by the limitations of a single technology, realizes more precise and efficient bacterial counting, and is applicable to high-demand microbial detection scenarios.

[0058] Next, a more specific process description of the method provided in this embodiment will be given. Specifically, as Figure 2 shown, it is another process schematic diagram of a method for identifying the number of bacteria based on the combination of image recognition and deep learning in an embodiment of the present application.

[0059] S201. Obtain the type of bacteria to be identified by number.

[0060] Before identifying the number of bacteria, the microbial counting system first obtains the specific type information of the bacteria to be identified provided by the user, including characteristics such as morphology, size, and staining properties. Specifically, the microbial counting system can obtain the bacteria type in various ways. For example, after preliminary identification by a professional through bacterial morphology, growth characteristics, biochemical reactions, etc., the identification results are input into the system; or the system is connected to a bacterial gene sequencing instrument to confirm the bacterial species through gene sequence comparison with a database; or the user directly specifies the target bacterial species according to the detection requirements, etc., which is not limited here.

[0061] S202. Match the stain and staining conditions according to the bacteria type.

[0062] After determining the type of bacteria, the microbial counting system matches the most suitable staining protocol according to the built-in bacterial staining database, including the types of stains and staining condition parameters. Taking Gram-positive bacteria (such as Staphylococcus aureus) as an example, the system matches from the database to use a 0.9% aniline black solution for staining, with a staining temperature of 35°C and a staining time of 30 minutes. Another example is that for Gram-negative bacteria (such as Escherichia coli), it can be matched to use a 0.6% aniline black solution for staining, controlling the staining temperature at 30°C and the staining time at 20 minutes to obtain the stained bacterial sample, and the bacterial sample is black.

[0063] After the matching is completed, the system feeds back the staining protocol information to the user to guide the staining process of the bacterial sample and prepare for subsequent high-quality image acquisition.

[0064] In the above embodiment, the microbial counting system enhances the quality of the culture medium image and the recognizability of bacteria by obtaining the type of bacteria before capturing the picture and accordingly matching the appropriate stain and staining conditions, enabling subsequent image processing and deep learning models to more accurately identify and count.

[0065] S203. Use a segmentation algorithm to separate the culture medium area from the background in the culture medium image to achieve image segmentation.

[0066] After the staining process, the microbial counting system acquires the culture medium image through a microscopic imaging system. To exclude the interference of the image background, the system first uses a segmentation algorithm to separate the area of the culture medium of interest from the irrelevant background.

[0067] Optional image segmentation algorithms include threshold segmentation, edge detection, region growing, etc. The system can adaptively select the segmentation strategy according to factors such as the lighting conditions, liquid characteristics, and background complexity of the culture medium image. For example, if the culture medium is a transparent liquid and the background is relatively uniform, the system can use simple grayscale threshold segmentation; if the culture medium has granular precipitation and the background is relatively complex, the system can choose a segmentation method that combines edge detection and region growing, etc.

[0068] During the segmentation process, the system classifies the image pixels according to features such as brightness, color, and texture to distinguish the culture medium area and the background area. Taking a bacterial smear under a microscope as an example, the segmented result may be a circular smear area, and the surrounding blank part is marked as the background. The system will extract the segmented area of interest and exclude the influence of the irrelevant background to focus on the key bacterial information for subsequent processing.

[0069] S204. Use color equalization technology to perform color correction on the culture medium image after image segmentation.

[0070] Due to factors such as light source conditions, imaging system characteristics, and staining quality, the originally captured culture medium images may have problems such as color cast, dullness, and low contrast, which are not conducive to the accurate identification of bacteria. Therefore, after the image segmentation is completed by the microbial counting system, color correction will also be performed on the culture medium area to optimize the image quality.

[0071] Optional color correction techniques include white balance, histogram equalization, color space conversion, etc. The system evaluates the overall color tone shift degree of the picture, characteristics such as the brightness distribution difference in local areas, and selects an appropriate correction algorithm. For example, if the image is blue-biased or yellow-biased, the system can use the white balance algorithm based on the gray world assumption for correction, etc.

[0072] During the correction process, the system converts the image to a specific color space (such as the HSV space), and performs pixel value mapping transformation on the hue, saturation, and brightness components respectively to make the color distribution more balanced and natural. Taking the picture of Gram-stained bacteria as an example, the corrected effect may be that the contrast between purple Gram-positive bacteria and pink Gram-negative bacteria is more distinct, and the background color consistency is higher. This creates good conditions for subsequent morphological processing and feature extraction.

[0073] S205. Perform morphological processing on the culture medium image after color correction to optimize and extract the morphological features of bacteria in the culture medium image.

[0074] After image segmentation and color correction, the region of interest and color performance of the culture medium image are optimized, but there may still be some high-frequency noises and morphological distortions in the image, which will interfere with the integrity of the bacteria contour. Therefore, the microbial counting system will also perform morphological processing on the image to smooth the bacteria edge, repair the broken area, and highlight morphological features such as the geometric shape and topological structure of the bacteria.

[0075] Among them, optional morphological processing includes erosion, dilation, opening operation, closing operation, etc. The system will analyze the noise distribution characteristics of the image, the roughness of the bacteria edge, etc., and select appropriate morphological operators and structuring elements. For example, if there is salt-and-pepper noise in the image and the bacteria boundary has serrated perturbations, the system can first use the opening operation to eliminate small noises, and then use the closing operation to smooth the bacteria contour; if the bacteria body shows breaks and deletions, the system can perform bridging repair through the dilation operation.

[0076] In the above embodiments, the microbial counting system optimizes the quality of the culture medium image through preprocessing steps such as image segmentation, color correction, and morphological processing, making the bacteria features more prominent and easy to identify. It can reduce the interference of background noise and irrelevant information, and improve the recognition accuracy and efficiency of the image recognition algorithm for the number of bacteria.

[0077] S206. Identify the preprocessed culture medium picture based on the image recognition algorithm to obtain the first recognition result of the number of bacteria.

[0078] This step is the same as step S102 and will not be elaborated here.

[0079] S207. Obtain the training samples and corresponding training labels.

[0080] Specifically, the microbial counting system collects a large number of pictures of bacterial culture media as training samples, which will be used for the training of subsequent deep learning models. Among them, each training sample corresponds to a training label, which contains two parts of information: one is the image information of the training sample, that is, the picture of the culture medium; the other is the staining information corresponding to the training sample, indicating the specific staining method and staining agent used for this culture medium picture.

[0081] S208. Under different training label classifications, perform bacterial annotation on the preprocessed training samples to obtain annotated data.

[0082] After obtaining a large number of training samples and corresponding training labels, the microbial counting system further processes and annotates these sample data to prepare for training the deep learning recognition model. Specifically, the system divides the training samples into different categories according to the staining information contained in the training labels, and each category corresponds to a specific staining method and condition. Then, for each category of training samples, the microbial counting system performs manual bacterial annotation. Generally, professional microbial inspection personnel observe each picture sample under a microscope, identify the bacteria in it, and mark the position of each bacteria in the picture with a specific marking tool (such as a rectangle, polygon, etc.). At the same time, the total number of bacteria in each sample is counted and recorded as the annotation result of this sample.

[0083] S209. Construct target recognition data based on the annotated training samples for model training to obtain deep learning recognition models corresponding to different training labels respectively.

[0084] After the microbial counting system has completed the annotation of all training samples, it can construct a target recognition dataset based on these annotated data, which contains a large number of culture solution image samples, as well as the annotation information of the position and quantity of bacteria corresponding to each sample. Then, the microbial counting system trains a deep learning recognition model based on the target recognition dataset. Specifically, in the embodiment of the present application, the YOLOv8 model is selected to construct the framework of the deep learning recognition model. By selecting different staining identifiers, a dedicated YOLOv8 model is trained respectively, and each model is optimized specifically in terms of data, network structure, and loss function in order to obtain the best recognition effect. For example, for samples stained with Gram stain, the receptive field and number of channels of the network can be appropriately increased to better capture the morphological characteristics of red and blue bacteria; while for samples stained with capsule stain, more texture and edge features can be introduced to highlight the learning of the bacterial contour. This strategy of training by identifier can maximize the advantages of YOLOv8 and achieve excellent bacterial detection effects in different staining environments.

[0085] After training is completed, a series of YOLOv8 models (deep learning recognition models) for different staining identifiers can be obtained. These models share the same backbone in structure, but are specifically adjusted in terms of parameters and weights according to the specific staining scheme. When in use, only according to the staining information of the culture solution image to be measured, the corresponding YOLOv8 model can be selected to quickly and accurately obtain the position and quantity information of all bacteria in the image.

[0086] It should be noted that the YOLOv8 model includes a Backbone (main network), a Neck (neck network), and a Head layer (detection head). Among them, the main network is the basic part of YOLOv8 and is responsible for feature extraction. It usually adopts the architecture of a deep convolutional neural network (CNN) and can extract multi-level features of the input image. The design of the main network directly affects the performance and detection accuracy of the model. The main function of the neck network is to aggregate different-level features from the main network and perform feature fusion in order to better capture the multi-scale information of the target. Usually, the neck network adopts a feature pyramid (FPN) or other types of feature fusion strategies to enhance the detection ability of the model. The detection head is the last layer of YOLOv8 and is responsible for generating the final detection results, including the position (bounding box), category, and confidence of the target. By applying regression and classification loss functions, the detection head enables the model to perform target detection at different thresholds.

[0087] In the above embodiment, through the precise annotation of training samples by the microbial counting system, the deep learning model can learn more complex image features and patterns, so as to more accurately predict the number of bacteria in actual applications, improving the generalization ability and recognition efficiency of the model.

[0088] S210. Match the corresponding training label according to the staining information corresponding to the culture medium picture.

[0089] Specifically, the microorganism counting system extracts the key staining information of the culture medium picture, such as parameters like the type, concentration, and pH value of the stain, and then compares these parameters with the staining information in the training label. By calculating the similarity between the staining parameters of the culture medium picture and each training label, the system can determine the most matching label, thereby determining the staining type of the picture.

[0090] It should be noted that the training label has been generated when constructing the data set, and it details the staining schemes used for each type of training sample.

[0091] S211. Determine the target deep learning recognition model from the deep learning recognition models corresponding to different training labels respectively according to the training label.

[0092] Through the label matching in the previous step, the microorganism counting system has determined the staining type corresponding to the current culture medium picture. Next, the system needs to select a target deep learning recognition model that is most suitable for processing this picture from multiple deep learning recognition models (such as the YOLOv8 model).

[0093] It should be noted that the microorganism counting system stores a mapping table from training labels to deep learning models. When the label of the culture medium picture is determined, the corresponding target deep learning recognition model can be quickly found by looking up the table.

[0094] S212. Input the culture medium picture into the target deep learning recognition model and output the second recognition result of the number of bacteria.

[0095] After determining the target deep learning recognition model, the microorganism counting system inputs the current culture medium picture into this model. After a series of feature extraction, analysis, and calculation, the recognition result of the number of bacteria in this picture is finally output.

[0096] In the above embodiment, the microorganism counting system selects an appropriate deep learning model according to the staining information and outputs the second recognition result of the number of bacteria through this model. Matching the staining information with the training label ensures the optimal performance of the model when processing specific types of stained pictures. This method further improves the accuracy and adaptability of recognition by precisely matching the model with the staining information.

[0097] The microorganism counting system of the embodiment of the present invention is applied to an electronic device. Figure 3 The schematic diagram of the architecture of the electronic device suitable for implementing the embodiment of the present invention is shown.

[0098] It should be noted thatFigure 3 The illustrated electronic device is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present invention.

[0099] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions (computer programs), or by controlling relevant hardware through instructions (computer programs). The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. The electronic device of this embodiment includes a storage medium and a processor. Among them, multiple instructions are stored in the storage medium, and the instructions can be loaded by the processor to execute any step of the method provided by the embodiments of the present invention.

[0100] Specifically, the storage medium and the processor are directly or indirectly electrically connected to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more signal lines. The storage medium stores computer execution instructions for implementing the data access control method, including at least one software function module that can be stored in the storage medium in the form of software or firmware. The processor executes various functional applications and data processing by running the software programs and modules stored in the storage medium. The storage medium can be, but is not limited to, a random access storage medium (Random Access Memory, abbreviated as RAM), a read-only storage medium (Read Only Memory, abbreviated as ROM), a programmable read-only storage medium (Programmable Read-Only Memory, abbreviated as PROM), an erasable programmable read-only storage medium (Erasable Programmable Read-Only Memory, abbreviated as EPROM), an electrically erasable programmable read-only storage medium (Electric Erasable Programmable Read-Only Memory, abbreviated as EEPROM), etc. Among them, the storage medium is used to store programs, and the processor executes the programs after receiving the execution instructions.

[0101] Further, the software programs and modules in the above storage medium may further include an operating system, which may include various software components and / or drivers for managing system tasks (such as memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide a running environment for other software components. The processor may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, abbreviated as CPU), a network processor (Network Processor, abbreviated as NP), etc., which may implement or execute the various methods, steps, and logic flow block diagrams disclosed in this embodiment. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0102] Since the instructions stored in this storage medium can execute the steps in any of the methods provided in the embodiments of the present invention, the beneficial effects of any of the methods provided in the embodiments of the present invention can be achieved. For details, please refer to the previous embodiments and will not be repeated here.

[0103] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims

1. A bacteria number recognition method based on the combination of image recognition and deep learning, applied to a microbial counting system, characterized in that: The method comprises: Capture images of the stained culture fluid using a microscope and camera equipment; Recognize the culture solution image after preprocessing based on an image recognition algorithm to obtain a first recognition result of the number of bacteria, wherein the preprocessing includes image segmentation, color correction, contrast adjustment, and morphological processing; Inputting the preprocessed culture solution image and corresponding staining information into a deep learning recognition model to obtain a second recognition result of the number of bacteria; If it is detected that the deviation between the first recognition result and the second recognition result is less than a preset deviation threshold, the second recognition result is set as the number of bacteria in the culture solution image.

2. The method according to claim 1, characterized in that Before the step of capturing the image of the stained culture solution by a microscope and a camera, the method further comprises: Obtain the type of bacteria to be identified; Match the stain and staining conditions according to the bacterial type.

3. The method according to claim 1, characterized in that Before the step of identifying the pre-processed culture solution image based on the image recognition algorithm to obtain a first recognition result of the number of bacteria, the method further includes: Using a segmentation algorithm to separate the culture solution area from the background in the culture solution image to achieve image segmentation; Use color equalization technology to perform color correction on the culture solution image after image segmentation; Morphological processing is performed on the color-corrected culture solution image to optimize and extract bacterial morphological features in the culture solution image.

4. The method according to claim 1, characterized in that: Before the step of inputting the pre-processed culture solution image into the deep learning recognition model to obtain a second recognition result of the number of bacteria, the step further includes: Acquire a training sample and a corresponding training identifier, wherein the training identifier includes image information of the training sample and staining information corresponding to the training sample; Under different training mark classifications, the pre-processed training samples are labeled with bacteria to obtain labeled data, and the training marks are classified according to the staining information corresponding to the training samples; Construct a target recognition dataset based on labeled training samples; Model training is performed based on the target recognition data set to obtain deep learning recognition models corresponding to different training identifiers, which are used to identify key features of culture solution images and predict the number of bacteria.

5. The method according to claim 1, characterized in that: The step of inputting the pre-processed culture solution image and the corresponding staining information into the deep learning recognition model to obtain a second recognition result of the number of bacteria specifically includes: Matching the corresponding training mark according to the staining information corresponding to the culture solution image; Determining a target deep learning recognition model from deep learning recognition models corresponding to different training identifiers according to the training identifier; The culture solution image is input into the target deep learning recognition model, and a second recognition result of the number of bacteria is output.

6. The method according to claim 1, characterized in that After the step of inputting the pre-processed culture solution image and the corresponding staining information into the deep learning recognition model to obtain a second recognition result of the number of bacteria, the method further includes: If it is detected that the deviation between the first recognition result and the second recognition result is greater than or equal to a preset deviation threshold, the stained culture fluid image is recaptured for secondary measurement.

7. The method according to claim 6, characterized in that After the step of recapturing the stained culture fluid image for secondary determination, the method further comprises: Obtaining a new first recognition result and a second recognition result obtained by the secondary determination; Determine the accuracy of the image recognition algorithm and the accuracy of the deep learning recognition model respectively according to the difference between the two first recognition results and the difference between the two second recognition results; The target to be adjusted is determined according to the accuracy of the image recognition algorithm and the accuracy of the deep learning recognition model.

8. A microbial counting system, characterized in that: The microbial counting system includes: one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the microorganism counting system to perform the method according to any one of claims 1 to 7.

9. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on a microorganism counting system, the microorganism counting system is caused to perform the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that When the computer program product is run on a microorganism counting system, the microorganism counting system is caused to perform the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Microorganism detection system and method based on image recognition

    CN121482039A