Method for detecting microorganisms in glass bottle for culturing plant seedlings

By combining the distribution characteristics of fungi or bacteria inside the glass bottles, images of different positions of the seedling glass bottles are collected and processed using a deep learning model. This solves the problem of time-consuming and incomplete microbial detection in seedling glass bottles in the existing technology, and achieves highly accurate, comprehensive and efficient detection.

CN120673135APending Publication Date: 2025-09-19LINTONG INTELLIGENT TECHNOLOGY (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510731400.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-03
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

Existing microbial detection in seedling glass bottles is time-consuming and incomplete, especially when the microorganisms in the glass bottles are unevenly distributed. Existing technology makes it difficult to achieve high-accuracy and high-efficiency detection.

Method used

By combining the distribution characteristics of fungi or bacteria inside glass bottles, images are collected at different locations on the glass bottles and processed using a deep learning model. The method includes fungus detection on the bottle cap and bottom, as well as fungus and bacteria detection on the bottle body. Grid division and multi-label classification techniques are used to improve detection accuracy, and image cropping is used to precisely locate high-risk areas for bacterial distribution.

Benefits of technology

It achieves highly accurate, comprehensive and efficient detection of microorganisms inside glass bottles, avoids complex background interference, improves detection accuracy and efficiency, and at the same time, non-destructive testing will not increase the risk of microbial contamination and spread.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120673135A_ABST
    Figure CN120673135A_ABST
Patent Text Reader

Abstract

The invention discloses a method for detecting microorganisms in a glass bottle for culturing plant seedlings, and belongs to the field of plant tissue culture. Aiming at the problems of long time consumption and incompleteness of microorganism detection in the existing seedling culture glass bottle, the invention provides a method for detecting microorganisms in a glass bottle for culturing plant seedlings, which comprises the following steps of: acquiring images at different positions of the glass bottle; the collected images are preprocessed to obtain images only containing the corresponding positions of the glass bottles, and then the different images are sent to the corresponding deep learning models to be detected. According to the method, different images are processed differently by combining the distribution characteristics of fungi or bacteria in the glass bottle and the structural characteristics of the fungi or bacteria, so that the possibility of misjudgment is reduced most possibly on the premise of reducing complex background interference; and finally, high accuracy, high comprehensiveness and high efficiency of judging bacteria and fungi in the glass bottle are realized, so that the method has a relatively great application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of plant tissue culture, and more particularly relates to a method for detecting microorganisms inside a glass bottle for culturing plant seedlings. Background Art

[0002] Placing plant seedlings in glass bottles and cultivating them with culture medium before planting is a common practice in plant tissue culture or seedling cultivation technology. By placing the glass bottles in a constant temperature box or culture room, the growth rate of the plant seedlings can be controlled by adjusting the temperature; by adjusting the light intensity and lighting time, the photosynthesis and growth rhythm of the plant seedlings can be affected; the growth conditions can be precisely controlled to optimize the growth of the plant seedlings; at the same time, through plant tissue culture technology, rapid reproduction can be promoted and the reproduction coefficient can be increased; the reproduction cycle can be greatly shortened, which is especially important for rare or difficult-to-propagate tree species. In short, using glass bottles to cultivate plant seedlings can not only optimize the growth of plant seedlings, but also enable rapid reproduction and facilitate observation and management. It has been widely used.

[0003] To ensure the health of young plants and improve their survival rate after transplantation, it is crucial to detect microorganisms within glass bottles. Regular testing can promptly detect fungal and bacterial contamination in the culture medium or cultivation environment, allowing appropriate measures to be taken to reduce the risk of plant disease during cultivation and cultivate stronger plants. However, existing microbial testing typically relies on manual or microscopic testing of each glass bottle, which is inefficient and has poor accuracy. Alternatively, microorganisms can be stained to observe their morphology, structure, and staining characteristics, but this is cumbersome and time-consuming.

[0004] Corresponding improvements have also been made to address the above-mentioned issues, such as Chinese patent publication number CN110066724A, published on July 30, 2019. This patent discloses a real-time monitoring device and detection method for microbial culture. The monitoring device includes a culture box, a storage device, an imaging device, an operating device, a completed sample storage device, and a control system arranged in the culture box. The detection method is to continuously move the culture dish in the storage device to the imaging device through the operating device. After the imaging device obtains the image information of the culture dish, it statistically compares and forms a detection result; after imaging, it moves back to the storage device. The shortcoming of this patent is that the distribution of microorganisms in the glass bottle may be uneven, resulting in the imaging device being unable to fully capture the microbial situation, resulting in inaccurate detection results.

[0005] Another example is Chinese patent publication number CN113390853A, published on September 14, 2021. The patent discloses a method for identifying bacteria and fungi using Raman spectroscopy, comprising the following steps: 1) constructing a Raman spectral database of bacteria and fungi, obtaining several characteristic peaks of bacteria and fungi and the Raman shifts corresponding to each characteristic peak. The Raman spectral database includes Raman spectral data of bacteria containing cytochrome C; 2) collecting Raman spectra of the sample to be tested; 3) using one or a combination of methods A and B to identify bacteria and fungi in the sample to be tested. The shortcoming of this patent is that when performing Raman spectroscopy detection, it is necessary to open the bottle cap or destroy the seal to obtain the sample, which increases the difficulty of operation and the risk of contamination. Summary of the Invention

[0006] 1. Problems to be solved

[0007] To address the time-consuming and incomplete nature of existing microbial testing within seedling glass bottles, the present invention provides a method for microbial testing within seedling glass bottles. By combining the distribution characteristics of fungi or bacteria within the glass bottles with the structural characteristics of the fungi or bacteria themselves, the present invention processes different images differently, minimizing the likelihood of misidentification while reducing complex background interference. Ultimately, the method achieves high accuracy, comprehensiveness, and efficiency in detecting bacteria and fungi within glass bottles, promising promising applications.

[0008] 2. Technical solution

[0009] To solve the above problems, the present invention adopts the following technical solutions.

[0010] A method for detecting microorganisms inside a glass bottle for culturing plant seedlings comprises the following steps:

[0011] S1: Capturing images: Capturing images of the top, bottom, and body of the glass bottle to obtain a first top image, a first bottom image, and a first body image; the glass bottle is transparent, and contains a plant seedling and a culture medium for cultivating the plant seedling;

[0012] S2: Image preprocessing: The first top image, the first bottom image, and the first bottle body image are processed respectively to obtain a second top image, a second bottom image, and a second bottle body image containing only the portion corresponding to the position of the glass bottle;

[0013] S3: Inputting the second top image and the second bottom image into the first deep learning model to determine whether fungi exist; inputting the second bottle body image into the second deep learning model to determine whether fungi exist and whether bacteria exist;

[0014] The second deep learning model includes a first detection module for detecting fungi and a second detection module for detecting bacteria; the first detection module is used to divide the second bottle body image into a plurality of grids, then label each grid with at least two labels, and finally classify the labeled grids to determine whether fungi are present;

[0015] The second detection module is used to crop the second bottle body image based on the liquid surface in the second bottle body image to obtain a third bottle body image below the liquid surface, and determine whether bacteria exist in the third bottle body image;

[0016] S4: Output results.

[0017] Furthermore, the specific execution steps of the first detection module are as follows:

[0018] S311: Determine the pixel width of the second bottle body image. If it is within the set range, perform subsequent operations; if it is not within the set range, report an error.

[0019] S312: Divide the second bottle body image into a plurality of grids;

[0020] S313: Adjusting multiple grids to the same size;

[0021] S314: Using the first detection model, sequentially classify the labels of the plurality of grids to obtain a label result for each grid, wherein the label result includes at least two label categories; the label categories include fungi, culture medium, and plants;

[0022] S315: Determine whether fungi exist based on the label results.

[0023] Furthermore, in step S314, the first detection model adopts a ConvNeXt model or a ResNet50 model, and the training method of the ConvNeXt model or the ResNet50 model includes the following:

[0024] Get the dataset: The dataset includes positive samples and negative samples; the positive samples are images of glass bottles with fungi; the negative samples are images of glass bottles without fungi;

[0025] Preprocess the dataset: Divide the dataset into several grids, and use labelme to label each grid with multiple labels; the labels of positive samples are fungi, culture medium, and plants; the labels of negative samples are culture medium and plants;

[0026] Put the preprocessed dataset into the ConvNeXt model or ResNet50 model for training.

[0027] Furthermore, the specific execution steps of the second detection module are as follows:

[0028] S321: Determine the pixel width of the second bottle body image. If it is within the set range, perform subsequent operations; if it is not within the set range, report an error.

[0029] S322: cropping the second bottle body image based on the liquid surface to obtain a third bottle body image below the liquid surface;

[0030] S323: Use the second detection model to detect whether bacteria are present in the third bottle body image.

[0031] Furthermore, the second detection model is a YOLOv5s detection model, which includes a backbone network, a neck network and a detection head; the backbone network adopts CSPDarknet, and an SPPF module is added to the end of CSPDarknet; the neck network adopts PANet, and the detection head adopts three sub-detection heads of different sizes.

[0032] Furthermore, the second CSPBlock layer in the CSPDarknet adopts a channel separation strategy, and channel expansion is performed in the next CSP layer of the second CSPBlock layer.

[0033] Furthermore, the training process of the YOLOv5s detection model includes the following:

[0034] Get the dataset: The dataset includes positive samples and negative samples; the positive samples are images of glass bottles with bacteria; the negative samples are images of glass bottles without bacteria;

[0035] Preprocessing of the data set: grayscale histogram equalization and noise reduction preprocessing of the data set;

[0036] Put the preprocessed dataset into the YOLOv5s detection model for training.

[0037] Furthermore, before step S323 , a pre-segmentation step is further included: segmenting the third bottle body image into a fourth bottle body image having light spots; and then detecting whether bacteria exist in the fourth bottle body image using the second detection model.

[0038] Furthermore, in step S3, the first deep learning model is a target detection model, and the target detection model is one of a ConvNeXt model, a ResNet50 model, and a YOLOv5s model.

[0039] Furthermore, when inspecting several glass bottles, multiple industrial cameras are used to simultaneously capture images of different glass bottles.

[0040] 3. Beneficial effects

[0041] (1) The present invention combines the distribution characteristics of fungi or bacteria inside the glass bottle, takes images of different positions of the glass bottle, and then detects the images of different positions by different means, thereby ensuring the comprehensiveness and accuracy of the microbial detection inside the glass bottle; secondly, for the images collected from the glass bottle body, taking into account the structural characteristics of the fungi or bacteria themselves, the core of fungus detection is to detect fungi by means of grid division and multi-label classification, while avoiding the influence of some irrelevant factors on the overall detection results and maximizing the detection accuracy, and multiple grids can be processed in parallel to speed up the processing speed; when performing bacteria detection, the core is to perform bacteria detection by cropping the image below the liquid surface, accurately locating the high-risk area of ​​bacteria distribution, while reducing complex background interference, reducing the possibility of misjudgment, and improving detection accuracy and efficiency; ultimately achieving high accuracy, high comprehensiveness and high efficiency in judging bacteria and fungi inside the glass bottle;

[0042] (2) When the present invention detects fungi on the second bottle body image, it first determines the pixel width of the second bottle body image to ensure that the glass bottle is in a normal state during the detection, thereby ensuring the detection effect; secondly, the second bottle body image is divided into grids, and each grid is analyzed independently to avoid missed detection or over-detection due to the difference in fungal density in the overall image; and each grid is adjusted to the same size before detection, and the image inside the grid is relatively amplified to improve the detection accuracy; finally, each grid is labeled and classified. Multi-label classification allows a single sample to be associated with multiple labels at the same time, and all detected objects can be reported at one time, avoiding the limitations of traditional single-label classification that requires multiple detections or takes the highest confidence label, thereby further improving the detection accuracy;

[0043] (3) When the present invention performs fungus detection on the second bottle body image, the YOLOv5s detection model separates effective signals through the deep feature abstraction capability of CSPDarknet and has a low signal-to-noise ratio characteristic; the multi-scale pooling layer of the SPPF module fuses the features of different receptive fields to improve the adaptability to the morphological diversity of bacterial hyphae; the bidirectional feature pyramid is used by PANet to realize multi-scale feature fusion, which can not only capture the local microstructure of bacterial hyphae, but also associate the global distribution pattern of the culture dish; three sub-detection heads of different sizes are used to correspond to large, medium and small targets respectively, which effectively solves the scale difference problem of bacterial hyphae caused by different growth stages, and achieves both accuracy and efficiency in bacterial detection;

[0044] (4) The YOLOv5s detection model of the present invention adopts a channel separation strategy in the second CSPBlock layer in CSPDarknet, and performs channel expansion in the CSP layer next to the second CSPBlock layer. This position is in the shallow feature extraction stage, which not only avoids the high memory consumption of the early large-resolution feature map, but also effectively enhances the expression ability of basic features such as edges / textures, while not affecting the abstraction process of deep semantic features;

[0045] (5) The present invention also includes a pre-segmentation step when performing bacteria detection on the second bottle body image. Combined with the shape characteristics of bacteria in the image, the area with the shape characteristics of bacteria is further screened out in the second bottle body image, and then bacteria detection is performed on this area. This can significantly reduce the amount of calculation and directly filter the area without light spots, avoiding the detection model from misjudging the background as bacteria. At the same time, the pre-segmentation can amplify the proportion of these tiny targets in the local area, avoiding them being ignored in the entire image, and can effectively capture trace pollution, thereby improving detection accuracy.

[0046] (6) When conducting batch inspection of glass bottles, the present invention adopts a multi-camera approach to collect images. Firstly, the multi-camera can shoot different glass bottles, so that different glass bottles can be photographed at the same time, and then batch processing can be performed, which greatly improves the collection efficiency; at the same time, the multi-camera can independently adjust the exposure time, gain, spectral filtering and other parameters according to the characteristics of the glass bottles, such as transmittance, color, and liquid level, to ensure the optimal image quality of each bottle; and the damage of a single camera does not affect other cameras, thereby improving the robustness of the entire inspection. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION

[0048] The present invention is further described below with reference to specific embodiments and accompanying drawings.

[0049] A method for detecting microorganisms inside a glass bottle for culturing plant seedlings comprises the following steps:

[0050] S1: Capturing images: Capturing images of the top, bottom, and body of the glass bottle to obtain a first top image, a first bottom image, and a first body image; the glass bottle is transparent, and contains a plant seedling and a culture medium for cultivating the plant seedling;

[0051] In step S1, capturing an image of the top of the glass bottle means photographing the cap of the glass bottle. The industrial camera is set above the cap of the glass bottle and shoots downward to obtain an image of the cap, which is also the first top image; photographing the bottom of the glass bottle means photographing the bottom of the glass bottle. The industrial camera is set below the bottom of the glass bottle and shoots upward to obtain an image of the bottom of the bottle, which is also the first bottom image; photographing the body of the glass bottle means rotating the glass bottle before photographing, giving the glass bottle a certain acceleration, and then photographing the body of the rotating glass bottle with the industrial camera to obtain the first body image. The purpose of rotating the glass bottle here is to ensure that its contents and characteristics (culture medium and possible detection targets) will not be destroyed by the acceleration caused by the sudden start, and at the same time ensure that the initial angular acceleration is ≤50rad / s 2 and increase to 100 rad / s within 1 second 2 , to avoid excessive acceleration that may damage the culture medium structure inside the glass bottle, causing interference and affecting the cultivation of plant seedlings.

[0052] S2: Image preprocessing: The first top image, the first bottom image, and the first bottle body image are processed respectively to obtain a second top image, a second bottom image, and a second bottle body image containing only the portion corresponding to the position of the glass bottle;

[0053] In step S2, the preprocessing is to segment and crop the captured image to obtain a second top image containing only the cap of the glass bottle, a second top image containing only the bottom of the glass bottle, and a second body image containing only the body of the glass bottle. This method enables focusing on the target detection area and avoids interference from other areas in the detection process, thereby reducing both the amount of calculation and error interference, thereby improving detection accuracy and efficiency.

[0054] S3: Inputting the second top image and the second bottom image into the first deep learning model to determine whether fungi exist; inputting the second bottle body image into the second deep learning model to determine whether fungi exist and whether bacteria exist;

[0055] The second deep learning model includes a first detection module for detecting fungi and a second detection module for detecting bacteria; the first detection module is used to divide the second bottle body image into a plurality of grids, then label each grid with at least two labels, and finally classify the labeled grids to determine whether fungi are present;

[0056] The second detection module is used to crop the second bottle body image based on the liquid surface in the second bottle body image to obtain a third bottle body image below the liquid surface, and determine whether bacteria exist in the third bottle body image;

[0057] First, it should be noted that in step S3: Through continuous research and observation, the inventors of this application have found that: fungi themselves have features visible to the naked eye, such as hairs, and the bottle cap is the only channel for the glass bottle to contact the external environment. Fungal spores can be spread through the air and invade when the bottle cap is opened, closed or not sealed tightly; culture medium residues, plant seedling shedding or condensed water are easily deposited at the bottom of the bottle, forming a local high humidity and aerobic environment, which is suitable for the growth of fungal microorganisms, which are mostly aerobic bacteria; bacteria have variable morphologies and are relatively small, and most bacteria are anaerobic bacteria. Therefore, in the bottle cap and bottle body space, there is a lack of nutrients such as culture medium and an aerobic environment, and it is difficult for most bacteria to colonize there; bacteria are more inclined to The bacteria are evenly distributed in the nutrient-rich and oxygen-isolated culture medium; therefore, the possibility of bacteria being distributed on the bottom of the bottle is much smaller than that on the bottle body; as for the bottle body, the bottle body contains plant seedlings and culture medium and is the main place for microbial growth. The possibility of bacteria and fungi being distributed in this place is relatively high; therefore, in step S3, only fungi are tested on the bottle cap and the bottom of the bottle, and both fungi and bacteria are tested on the bottle body. Resource allocation is optimized, and fungi testing on the bottle cap and the bottom of the bottle can quickly locate external contamination sources and avoid the high cost of comprehensive testing; comprehensive testing of the bottle body ensures the safety and health of the core culture area, balances accuracy and resource consumption, and realizes efficient and comprehensive testing of microbial contamination in glass bottles.

[0058] Secondly, the testing methods for bottles are different according to the characteristics of bacteria and fungi:

[0059] For fungal detection: the distribution of fungi in the bottle is often uneven, so grid division is performed first. Each grid can be analyzed independently to avoid missed detection (such as low-density areas being ignored) or over-detection (such as high-density areas being misjudged) due to differences in fungal density in the overall image. As long as fungi are detected in one grid, the presence of fungi can be determined, thereby improving detection efficiency. At the same time, considering that fungi are small in size and account for a relatively low proportion in the entire image, the fungal targets in each grid are relatively magnified after grid division, and subsequent detection can more clearly capture their morphological, texture and other detailed features, which is especially suitable for detecting early infections or trace contamination, thereby improving detection accuracy. After grid division, the grids are multi-labeled, and the presence of fungi is determined based on the label results. The multi-label setting takes into account the culture medium and plant seedlings, thereby maximally eliminating interference from other substances and ensuring the accuracy of the test results.

[0060] For bacteria: Bacteria typically rely on nutrients in the culture medium to reproduce. The culture medium below the liquid surface is the area with the highest risk of contamination. By cropping the image below the liquid surface, the area with the highest bacterial density can be directly analyzed, avoiding wasting computing resources in the low-risk area above the liquid surface. At the same time, the area above the liquid surface may contain interference from irrelevant elements such as bubbles, bottle walls, and plant seedlings. After cropping, this interference can be directly eliminated, achieving precise positioning of high-risk areas of bacterial distribution and minimizing complex background interference, reducing the possibility of misjudgment.

[0061] Finally, in this step, the first deep learning model and the second deep learning model can both use existing target detection models or other neural network models, as long as they can achieve the functions described in this application. In this embodiment, the structure and implementation methods of the first deep learning model and the second deep learning model are not repeated.

[0062] S4: Output the results. According to the image results, determine whether there are fungi on the cap and bottom of the glass bottle, and whether there are fungi and bacteria on the body of the glass bottle, so as to achieve a comprehensive detection of microorganisms inside the glass bottle.

[0063] In this embodiment, the distribution characteristics of fungi or bacteria inside the glass bottle are combined to capture images of different locations of the glass bottle, and then different methods are used to detect the images at different locations, thereby ensuring the comprehensiveness and accuracy of the microbial detection inside the glass bottle. Secondly, for the images collected from the glass bottle body, considering the structural characteristics of the fungi or bacteria themselves, the core of fungus detection is to detect fungi through two methods: grid division and multi-label classification. While avoiding the influence of some irrelevant factors on the overall detection results, it maximizes the detection accuracy. In addition, multiple grids can be processed in parallel to accelerate the processing speed. When performing bacterial detection, the core is to perform bacterial detection by cropping the image below the liquid surface, accurately locating the high-risk areas of bacterial distribution, while reducing complex background interference, reducing the possibility of misjudgment, and improving detection accuracy and efficiency. Ultimately, high accuracy, high comprehensiveness, and high efficiency are achieved in the determination of bacteria and fungi inside the glass bottle. It is also worth noting that the method of performing microbial detection inside the glass bottle for cultivating plant seedlings according to this embodiment can achieve non-destructive testing without increasing the risk of microbial contamination and spreading or affecting the quality of the existing plant seedlings in the bottle.

[0064] In a specific embodiment, the specific execution steps of the first detection module are as follows:

[0065] S311: Determine the pixel width of the second bottle body image. If it is within the set range, perform subsequent operations; if it is not within the set range, report an error.

[0066] S312: Divide the second bottle body image into a plurality of grids;

[0067] S313: Adjusting multiple grids to the same size;

[0068] S314: Using the first detection model, sequentially classify the labels of the plurality of grids to obtain a label result for each grid, wherein the label result includes at least two label categories; the label categories include fungi, culture medium, and plants;

[0069] S315: Determine whether fungi exist based on the label results.

[0070] Specifically, this embodiment describes the execution process of the first detection model: First, the width pixel of the second bottle image is determined to be within a set range to ensure that the bottle size meets the preset standard. This pixel width determination can filter out bottles that do not meet the required size, avoiding detection errors or product quality issues caused by container defects, thereby adapting to automated inspection systems. The image is then gridded and multi-label classified, and the label results are used to determine the presence of fungi. This multi-label setting reports all detected objects at once, avoiding the limitations of traditional single-label classification, which requires multiple inspections or selects the highest confidence label, further improving detection accuracy. To balance efficiency and accuracy, this embodiment preferably grids the second bottle image into a 64*64 grid, which is then resized to 224*224.

[0071] In a specific embodiment, the first detection model in step S314 adopts a ConvNeXt model or a ResNet50 model, and the training method of the ConvNeXt model or the ResNet50 model includes the following:

[0072] Get the dataset: The dataset includes positive samples and negative samples; the positive samples are images of glass bottles with fungi; the negative samples are images of glass bottles without fungi;

[0073] Preprocess the dataset: Divide the dataset into several grids, and use labelme to label each grid with multiple labels; the labels of positive samples are fungi, culture medium, and plants; the labels of negative samples are culture medium and plants;

[0074] Put the preprocessed dataset into the ConvNeXt model or ResNet50 model for training.

[0075] In this example, 600 images are used, including 400 positive samples and 200 negative samples, and the distribution of fungi in the positive samples is balanced. Labelme is then used to label the gridded images, using a multi-label labeling method, and the images are divided into three categories: plants, culture media, and fungi. During the training process, a data augmentation method is also used to enhance the data set to improve the comprehensiveness of the training data. During training, the training parameters of the model are adjusted to the following: batch_size 16, epoch 100, lr 0.001, weight_decay 0.0005 cosine, and optimizer adamw.

[0076] At the same time, after training the model, the evaluation indicators of the model are as follows: assuming that the number of pictures in a batch is m, the number of pictures containing fungi is n, the number of pictures predicted to be fungi and labeled as fungi is n_pred_true, and the number of pictures predicted to be fungi but labeled as qualified is n_pred_false; accuracy: n_pred / n; false alarm rate: n_pred_false / m; the preset accuracy is 99% and the false alarm rate is 5%.

[0077] In a specific embodiment, the specific execution steps of the second detection module are as follows:

[0078] S321: Determine the pixel width of the second bottle body image. If it is within the set range, perform subsequent operations; if it is not within the set range, report an error.

[0079] S322: cropping the second bottle body image based on the liquid surface to obtain a third bottle body image below the liquid surface;

[0080] S323: Use the second detection model to detect whether bacteria are present in the third bottle body image.

[0081] Specifically, this embodiment illustrates the execution flow of the second detection module. The purpose of S321 is the same as that of S311, which introduces a pre-judgment mechanism. If deviation from the set range is detected, it indicates a problem with the image, eliminating the need for further detection and terminating the process directly, thus avoiding unnecessary resource consumption. Subsequently, the core area of ​​bacterial distribution is cropped out. Analysis of this core area reduces computing power consumption and improves detection accuracy. Note that because culture medium is present in the bottle, the liquid level in the second bottle image here refers to the liquid level where the culture medium is located in the second bottle image.

[0082] In a specific embodiment, the second detection model is a YOLOv5s detection model, which includes a backbone network, a neck network and a detection head; the backbone network adopts CSPDarknet, and an SPPF module is added to the end of CSPDarknet; the neck network adopts PANet, and the detection head adopts three sub-detection heads of different sizes.

[0083] Specifically, in this embodiment, it is particularly emphasized that the YOLOv5s detection model is introduced to detect bacteria. The process of the third bottle body image entering the YOLOv5s detection model is as follows: the third bottle body image enters the backbone network CSPDarkne for step-by-step feature extraction. As the depth of the backbone network CSPDarkne increases, the size of the feature map gradually decreases (downsampling), the number of channels gradually increases, and finally a multi-scale feature map is generated; the multi-scale feature map passes through the SPPF module for multi-scale maximum pooling, and the results of different pooling kernel sizes are connected in series to fuse multi-scale information; then enters the neck network PANet, multi-scale feature fusion is performed through the bidirectional feature pyramid, and finally enters the detection head for target detection of different sizes, and finally outputs the detection result.

[0084] The YOLOv5s detection model is designed with this structure to better suit the characteristics of bacteria as the detection target: bacterial hyphae appear as tiny diffuse light spots (50-200 pixels in diameter) in the near-infrared band (700-1100nm), which is also seen by industrial cameras. Their morphological characteristics are significantly similar to microcracks in industrial X-ray images and cellular lesions in medical microscopic images. The light spot intensity of bacterial hyphae is only 1.2-1.8 times that of the background, relying on the deep feature abstraction capabilities of CSPDarknet to separate effective signals. The hyphae can also take on morphological forms such as straight lines (new hyphae) and branches (mature hyphae). The multi-scale pooling of the SPPF module can cover morphological variations from 5×5 to 13×13 pixels. In addition, three sub-detection heads of different sizes correspond to large, medium, and small targets, effectively addressing the scale differences of bacterial hyphae caused by different growth stages. The smallest sub-detection head is specifically designed for locating targets smaller than 50 pixels. In summary, the YOLOv5s detection model can perform accurate and efficient detection based on the characteristics of bacteria, thereby achieving both accuracy and efficiency in bacterial detection. The entire detection method is time-saving, highly accurate, and efficient, and has the prospect of large-scale use.

[0085] In one specific embodiment, the second CSPBlock layer in the CSPDarknet employs a channel separation strategy, and channel expansion is performed in the CSP layer following the second CSPBlock layer. The CSP layer following the second CSPBlock layer is described here based on the direction of data flow, meaning that after data enters the second CSPBlock layer, it enters the immediately following CSP layer. This design takes into account the shallow feature extraction stage, avoiding the high memory consumption of early large-resolution feature maps while effectively enhancing the expressive power of basic features such as edges and textures, without affecting the abstraction of deep semantic features.

[0086] In a specific embodiment, the training process of the YOLOv5s detection model includes the following:

[0087] Get the dataset: The dataset includes positive samples and negative samples; the positive samples are images of glass bottles with bacteria; the negative samples are images of glass bottles without bacteria;

[0088] Preprocessing of the data set: grayscale histogram equalization and noise reduction preprocessing of the data set;

[0089] Put the preprocessed dataset into the YOLOv5s detection model for training.

[0090] Specifically, this embodiment also includes secondary processing of the preprocessed data set, and the specific secondary processing process is as follows: adaptive anchor frame calculation and data enhancement operation, the adaptive anchor frame calculation is to generate several groups of initial anchor frames by clustering through the K-means++ algorithm, and change the anchor ratio according to the aspect ratio characteristics of the mycelium; the data enhancement operation is to integrate Mosaic data enhancement technology and adaptive grayscale histogram equalization technology; 9 groups of initial anchor frames are generated by clustering through the K-means++ algorithm, and the anchor ratio is optimized according to the aspect ratio characteristics of the mycelium (slender type) to improve the bounding box regression efficiency; the robustness to uneven illumination and low contrast of near-infrared images is enhanced by integrating Mosaic data enhancement (four-image stitching) and adaptive grayscale histogram equalization (CLAHE).

[0091] The secondary processed dataset was divided into training, validation, and test sets according to a preset ratio. All negative samples in the secondary processed dataset underwent enhancement processing, which included optical interference feature learning and false positive suppression priors. The optical interference feature learning simulated interference such as edge glare and water stains, considering that uncontaminated culture dishes are not absolutely "pure." The false positive suppression prior forced the model to learn morphological differences by synthesizing hyphae-like textures (such as culture medium crystals) in negative samples. The enhanced dataset ultimately reduced the false positive rate from a baseline of 8.2% to 4.5% during training, and improved the accuracy of identifying highly similar artifacts (such as bubbles) by 37%.

[0092] Set parameters for the YOLOv5s detection model: the training parameters include batch_size, epoch, lr, weight_decay, learning rate and optimizer; specifically, the training parameters are set as follows: batch_size 16, epoch 500, lr 0.0005, weight_decay 0.0005cosine, optimizer: SGD; and set evaluation indicators: assuming that the number of images in a batch is m, the number of images containing bacteria is n, the number of images predicted to be bacteria and labeled as bacteria is n_pred_true, and the number of images predicted to be bacteria but labeled as qualified is n_pred_false; accuracy: n_pred / n; false alarm rate: n_pred_false / m; the preset accuracy is 95% and the false alarm rate is 5%;

[0093] The training set is then input into the YOLOv5s detection model for iterative training to obtain the final YOLOv5s detection model. It is worth noting that a dynamic learning rate and early stopping mechanism are used for training during iterative training. Among them, the dynamic learning rate adopts Cosine annealing. During the 500-epoch training, the learning rate is later reduced to 10% of the initial value (0.00005) to avoid gradient oscillation and ensure long-term training stability. Local optimal escape: The periodic restart mechanism (combined with early stopping) helps to jump out of the saddle point. The convergence speed is improved by 30% (the epochs to reach 0.8mAP are from 220 to 150), and the final mAP absolute value is increased by 1.2 percentage points. The stopping mechanism: The standard deviation of the mAP fluctuation of the validation set is less than 0.5%, which prevents the memorization of noise features and avoids the risk of overfitting. The full 500-epoch training takes 78 hours (T4 GPU). Early stopping can save about 40% of computing resources, optimizing hardware resources. The difference in mAP between the test set and the training set is reduced from 9.7% to 3.2%, and the generalization error to changes in lighting conditions is reduced by 28%.

[0094] In a specific embodiment, a pre-segmentation step is further included before step S323: the third bottle body image is segmented into a fourth bottle body image with light spots; and the fourth bottle body image is then detected for bacteria using the second detection model.

[0095] In this embodiment, the concept of pre-segmentation is introduced. The detection area is further narrowed and segmented based on light spots. Light spots are signs of bacterial reproduction, metabolic activity or reflected light. Only areas containing light spots are retained through pre-segmentation, and the subsequent detection model does not need to process the entire image. The amount of calculation can be reduced by 50%-90%, significantly shortening the detection time. At the same time, the area below the liquid surface may also contain interference such as culture medium texture, bubbles, and impurities. Pre-segmentation directly filters areas without light spots to avoid the detection model misjudging the background as bacteria, thereby reducing the false detection rate. It is worth noting that since early bacterial infections may only appear as sporadic light spots, pre-segmentation can amplify the proportion of these tiny targets in local areas to avoid them being ignored in the entire image. The segmentation model can identify light spots of different shapes and sizes (such as points and clusters) through pixel-level classification, covering more pollution scenes, thereby achieving high-precision small target detection capabilities.

[0096] In a specific embodiment, the first deep learning model in step S3 is a target detection model, and the target detection model is one of a ConvNeXt model, a ResNet50 model, and a YOLOv5s model.

[0097] In a specific embodiment, when inspecting several glass bottles, multiple industrial cameras are used to simultaneously capture images of different glass bottles.

[0098] In this embodiment, multiple industrial cameras perform multi-camera image acquisition. Firstly, multiple cameras can shoot different glass bottles, so that different glass bottles can be photographed at the same time, and then batch processing can greatly improve the acquisition efficiency. At the same time, the multi-camera can independently adjust the exposure time, gain, spectral filtering and other parameters according to the characteristics of the glass bottles, such as transmittance, color, and liquid level, to ensure the optimal image quality of each bottle. Moreover, the damage of a single camera does not affect other cameras, thereby improving the robustness of the entire detection. More importantly, multiple cameras can be designed for multi-spectral imaging, and the multi-spectral information is complementary, breaking through the limitations of single-wavelength detection. For example, a near-infrared camera is used to penetrate the wall of the glass bottle to detect the internal liquid level, suspended matter or microbial contamination (such as bacterial colonies); an ultraviolet camera is used to capture fluorescence reactions to detect fungal metabolites, etc. In addition, multiple cameras collect data synchronously to avoid the time difference of multiple imaging required for traditional single-spectrum detection, ensuring strict alignment of multi-dimensional data.

[0099] The examples described in the present invention are merely descriptions of the preferred embodiments of the present invention and are not intended to limit the concept and scope of the present invention. Without departing from the design concept of the present invention, various modifications and improvements made to the technical solutions of the present invention by engineers and technicians in this field should fall within the scope of protection of the present invention.

Claims

1. A method for detecting microorganisms inside a glass bottle used to culture plant seedlings, characterized in that: The following steps are involved: S1: Capturing images: Capturing images of the top, bottom, and body of the glass bottle to obtain a first top image, a first bottom image, and a first body image; the glass bottle is transparent, and contains a plant seedling and a culture medium for cultivating the plant seedling; S2: Image preprocessing: The first top image, the first bottom image, and the first bottle body image are processed respectively to obtain a second top image, a second bottom image, and a second bottle body image containing only the portion corresponding to the position of the glass bottle; S3: Inputting the second top image and the second bottom image into the first deep learning model to determine whether fungi are present; Input the second bottle body image into the second deep learning model to determine whether fungi and bacteria are present; The second deep learning model includes a first detection module for detecting fungi and a second detection module for detecting bacteria; the first detection module is used to divide the second bottle body image into a plurality of grids, then label each grid with at least two labels, and finally determine whether fungi exist in each labeled grid one by one; The second detection module is used to crop the second bottle body image based on the liquid surface in the second bottle body image to obtain a third bottle body image below the liquid surface, and determine whether bacteria exist in the third bottle body image; S4: Output results.

2. The method for detecting microorganisms inside a glass bottle for cultivating plant seedlings according to claim 1, characterized in that: The specific execution steps of the first detection module are as follows: S311: Determine the pixel width of the second bottle body image. If it is within the set range, perform subsequent operations; if it is not within the set range, report an error. S312: Divide the second bottle body image into a plurality of grids; S313: Adjusting multiple grids to the same size; S314: Using the first detection model, sequentially classify the labels of the plurality of grids to obtain a label result for each grid, wherein the label result includes at least two label categories; the label categories include fungi, culture medium, and plants; S315: Determine whether fungi exist based on the label results.

3. The method for detecting microorganisms inside a glass bottle for cultivating plant seedlings according to claim 2, characterized in that: In step S314, the first detection model adopts a ConvNeXt model or a ResNet50 model, and the training method of the ConvNeXt model or the ResNet50 model includes the following: Get the dataset: The dataset includes positive samples and negative samples; the positive samples are images of glass bottles with fungi; the negative samples are images of glass bottles without fungi; Preprocess the dataset: Divide the dataset into several grids, and use labelme to label each grid with multiple labels; the labels of positive samples are fungi, culture medium, and plants; the labels of negative samples are culture medium and plants; Put the preprocessed dataset into the ConvNeXt model or ResNet50 model for training.

4. The method for detecting microorganisms inside a glass bottle for cultivating plant seedlings according to claim 1, characterized in that: The specific execution steps of the second detection module are as follows: S321: Determine the pixel width of the second bottle body image. If it is within the set range, perform subsequent operations; if it is not within the set range, report an error. S322: cropping the second bottle body image based on the liquid surface to obtain a third bottle body image below the liquid surface; S323: Use the second detection model to detect whether bacteria are present in the third bottle body image.

5. The method for detecting microorganisms inside a glass bottle for cultivating plant seedlings according to claim 4, characterized in that: The second detection model is a YOLOv5s detection model, which includes a backbone network, a neck network and a detection head. The backbone network adopts CSPDarknet, and an SPPF module is added to the end of CSPDarknet. The neck network adopts PANet, and the detection head adopts three sub-detection heads of different sizes.

6. The method for detecting microorganisms inside a glass bottle for cultivating plant seedlings according to claim 5 or claim 1, characterized in that: The second CSPBlock layer in the CSPDarknet adopts a channel separation strategy, and channel expansion is performed in the next CSP layer of the second CSPBlock layer.

7. A method for detecting microorganisms inside a glass bottle for culturing plant seedlings according to claim 5 or 6, characterized in that: The training process of the YOLOv5s detection model includes the following: Get the dataset: The dataset includes positive samples and negative samples; the positive samples are images of glass bottles with bacteria; the negative samples are images of glass bottles without bacteria; Preprocessing of the data set: grayscale histogram equalization and noise reduction preprocessing of the data set; Put the preprocessed dataset into the YOLOv5s detection model for training.

8. The method for detecting microorganisms inside a glass bottle for cultivating plant seedlings according to claim 4, characterized in that: Before step S323 , a pre-segmentation step is also included: segmenting the third bottle body image into a fourth bottle body image with light spots; and then detecting whether bacteria exist in the fourth bottle body image using the second detection model.

9. The method for detecting microorganisms inside a glass bottle for cultivating plant seedlings according to claim 1, characterized in that: In step S3, the first deep learning model is a target detection model, and the target detection model is one of a ConvNeXt model, a ResNet50 model, and a YOLOv5s model.

10. A method for detecting microorganisms inside a glass bottle for culturing plant seedlings according to claim 1 or 9, characterized in that: When inspecting several glass bottles, multiple industrial cameras are used to capture images of different glass bottles simultaneously.

Citation Information

Patent Citations

  • Real-time monitoring device and detecting method for microculture

    CN110066724A

  • Method and system for identifying bacteria and fungi by using Raman spectrum

    CN113390853A