Poria cocos strain infectious microbe detection method and device
Through machine vision technology and intelligent algorithms, we automatically distinguish Poria cocos species from mixed bacteria, solving the problem of time-consuming and low accuracy of traditional detection methods, achieving efficient and accurate bacterial strain detection, and improving the quality control level of Poria cocos production.
Patent Information
- Application Number
- CN202510296178.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-06-27
AI Technical Summary
Poria cocos species are easily contaminated by mixed bacteria during production. Traditional manual testing takes time, is not very accurate and depends on experience, making it difficult to effectively distinguish Poria cocos species from mixed bacteria, especially under pH conditions, the two are similar in shape.
Machine vision technology combined with intelligent algorithms is used to achieve the automated distinction between Poria cocos species and mixed bacteria through image processing and feature extraction. The specific steps include inoculating the Poria cocos seeds into culture medium, collecting image sequences of the mycelium growth process, performing pre-processing, feature extraction (including color, texture and morphological features) and classifying using a support vector machine classification model.
It improves the efficiency and accuracy of Poria cocos species detection, can effectively distinguish Poria cocos species from mixed bacteria, ensures the purity of bacteria and improves the production quality control level.
Smart Images

Figure CN120220061A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of biological monitoring, and particularly to a method and device for detecting miscellaneous bacteria in Poria cocos strains. Background Art
[0002] Poria cocos is a commonly used traditional Chinese medicine, and the purity of the strains directly affects the quality and efficacy during its production process. In actual production, Poria cocos strains are extremely vulnerable to contamination by miscellaneous bacteria. Especially under specific pH culture conditions, the miscellaneous bacteria and Poria cocos strains show high similarity in growth morphology, color, etc., which poses great challenges to traditional manual detection. Traditional detection methods are time-consuming and highly dependent on the experience of detection personnel, suffering from problems such as low precision and low efficiency. Detection technologies based on machine vision and intelligent algorithms can achieve automatic differentiation between Poria cocos strains and miscellaneous bacteria through image processing and feature extraction, thereby improving the efficiency and accuracy of detection. Especially the combined extraction and classification of multi-dimensional features such as color, texture, and morphology helps to solve the problem of high similarity between miscellaneous bacteria and highly acid-base resistant Poria cocos strains, ensuring the purity of strains during the production process. Currently, machine vision technology has been widely applied in the field of edible fungi, etc., but there is less research on Poria cocos strains. It will contribute to improving the quality control level of Poria cocos production. Summary of the Invention
[0003] The present invention provides a method and device for detecting miscellaneous bacteria in Poria cocos strains, aiming to improve the quality control level of Poria cocos production.
[0004] The present invention provides the following technical solutions:
[0005] On the one hand, the present application provides a method for detecting miscellaneous bacteria in Poria cocos strains, including:
[0006] S1: Inoculate Poria cocos strains on a standard culture medium and place them in an incubator with constant temperature and humidity, and collect a complete image sequence during the mycelium growth process;
[0007] S2: Preprocess the collected images, and the preprocessing process mainly includes steps of grayscale conversion, denoising, contrast enhancement, and image segmentation;
[0008] S3: Extract features from the preprocessed images, and the extracted features include color, texture, and morphological features;
[0009] S4: Classify the extracted multi-dimensional features through a support vector machine classification model;
[0010] S5: Display the detection results of Poria cocos strains and miscellaneous bacteria.
[0011] In a possible implementation manner, in S2, the grayscale conversion is calculated by weighted averaging of the RGB values of the original image, and the formula is as follows:
[0012] I gray = 0.299R + 0.587G + 0.114B
[0013] where I gray is the pixel value of the grayscale image, and R, G, and B are the pixel values of the red, green, and blue channels respectively.
[0014] In a possible implementation, in S2, the kernel function of the denoising Gaussian filter is:
[0015]
[0016] where G(x, y) is the weight of the filter, σ is the standard deviation of the Gaussian distribution, and x, y are the pixel coordinates.
[0017] In a possible implementation, in S2, the formula for histogram equalization for contrast enhancement is:
[0018]
[0019] where I eq is the pixel value after equalization, P(i) is the probability of pixels with grayscale value i, M and N are the width and height of the image respectively, and L is the number of gray levels.
[0020] In a possible implementation, in S2, the image segmentation formula is as follows:
[0021]
[0022] where is the between-class variance, w1(t) and w2(t) are the probabilities of foreground and background pixels under threshold t respectively, and μ1(t) and μ2(t) are the average grayscale values of foreground and background pixels.
[0023] In a possible implementation, in S3, for a color image, color features can be extracted before grayscale processing, and the color feature vector is expressed as:
[0024]
[0025] where H(i) is the frequency of grayscale level i in the color histogram, n i is the number of pixels with grayscale level i, and N is the total number of pixels in the image.
[0026] In a possible implementation, local binary pattern (LBP) and gray-level co-occurrence matrix (GLCM) are used to extract texture features. LBP is used to capture local texture patterns, and its calculation formula is:
[0027]
[0028] Among them, gp is the gray value of the neighboring pixels, g c is the gray value of the central pixel, s(x) is the threshold function, if x≥0, then s(x)=1, otherwise 0, GLCM is used to describe the gray dependence between pixels, and the common texture features include contrast, correlation, energy and entropy;
[0029] The contrast of the gray-level co-occurrence matrix is defined as:
[0030]
[0031] Among them, P(i,j) represents the probability of the occurrence of the pixel pair of gray levels i and j.
[0032] In a possible implementation manner, the shape factor can be used to analyze the morphological health status of the hyphae, and its calculation formula is:
[0033]
[0034] Among them, A is the area of the hyphae, P is the perimeter of the hyphae, a larger shape factor indicates that the hyphae are more evenly distributed and regular in shape, while a smaller shape factor indicates the invasion of contaminants.
[0035] In a possible implementation manner, during the feature extraction process, color features, texture features, and morphological features are extracted from each image, and these features are combined into a feature vector to represent the features of the hyphae in each image:
[0036] x = [H1, H2, …, LBP1, LBP2, …, GLCM1, …, ShapeFactor]
[0037] An optimal hyperplane is found in the feature space through SVM to separate the two types of samples of Poria cocos strains and contaminants, and the decision boundary is expressed as:
[0038] f(x) = w·x + b
[0039] Among them, w is the weight vector, b is the bias, the hyperplane is calculated according to the positions of the strain and contaminant samples in the training data, and is used to distinguish the two classes. The optimal hyperplane is selected by maximizing the distance between the two types of samples to this plane, so that the classification model has stronger generalization ability. SVM classifies by calculating the distance of the sample relative to the hyperplane. If f(x)≥0, it is determined as Poria cocos strain; otherwise, it is determined as contaminant.
[0040] On the other hand, the present application provides a Poria cocos strain and contaminant detection device, including:
[0041] An image preprocessing module, used to obtain a complete image sequence of the hyphae growth process;
[0042] An image preprocessing module for preprocessing images. The preprocessing process mainly includes grayscale conversion, denoising, contrast enhancement, and image segmentation;
[0043] A feature extraction module for extracting features from the preprocessed images. The extracted features include color, texture, and morphological features;
[0044] A miscellaneous bacteria detection module for classifying the extracted multi-dimensional features;
[0045] An output module for visually presenting the detection results of poria cocos strains and miscellaneous bacteria to the user.
[0046] It should be understood that the above general description and the following detailed description are only exemplary and do not limit the present invention.
[0047] In the present invention, the system provides corresponding processing suggestions according to the detection results. For example, when the miscellaneous bacteria spread to a certain extent, the system will suggest that the operator isolate the strains of this batch or stop using them to avoid the spread of contamination. The system can also generate a detailed detection report, and the report content includes the detection time, the health status of the strains, whether miscellaneous bacteria are detected, the distribution and spread of miscellaneous bacteria, etc. The report not only records the time points of each detection for convenient tracing of the growth status of the strains, but also provides processing suggestions according to the spread degree of the miscellaneous bacteria, such as isolation, stop using, or cleaning the equipment, etc., to ensure the hygiene of the production environment and the purity of the strains.
[0048] Based on the large amount of accumulated detection data, the system can also perform in-depth analysis to further optimize the production process of poria cocos strains, thereby improving the overall quality of the products. Brief Description of the Drawings
[0049] Figure 1 It is a schematic diagram of a method and device for detecting miscellaneous bacteria in poria cocos strains provided by an embodiment of the present invention;
[0050] Figure 2 It is a flowchart of a method and device for detecting miscellaneous bacteria in poria cocos strains provided by an embodiment of the present invention. Detailed Embodiments
[0051] The following describes the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention.
[0052] As Figure 1 shown, the embodiments of the present invention relate to a method and device for detecting miscellaneous bacteria in poria cocos strains. The method and device include the following main modules: image acquisition, image preprocessing, feature extraction, miscellaneous bacteria detection, and result output modules. Through the mutual cooperation of each module, the growth status of poria cocos strains can be detected in real time and the miscellaneous bacteria contamination situation can be identified.
[0053] The growth monitoring of Wolfiporia cocos strains requires regular acquisition of hyphal images. For this purpose, a high-resolution camera is used in the present invention to regularly photograph the cultivation environment of Wolfiporia cocos strains. The specific implementation process is as follows: Inoculate Wolfiporia cocos strains on a standard culture medium (such as PDA medium) and place it in an incubator with a constant temperature and humidity. By adjusting the conditions of the incubator, the growth of Wolfiporia cocos strains under different environments can be observed. Set an appropriate shooting frequency according to the growth rate of the hyphae. The conventional frequency is to take an image every 4 hours to record the growth dynamics of the hyphae. The shooting interval can be adjusted according to actual needs. The image acquisition camera should have an autofocus function to ensure that the photographed hyphal images are clear and the image resolution is high enough (≥2000×2000 pixels) for subsequent feature extraction and classification detection. Through the above settings, a complete image sequence of the hyphal growth process is obtained, and the collected original images are transmitted to a computer through a data interface for use by subsequent processing modules.
[0054] The purpose of the image preprocessing module is to improve the accuracy and robustness of image analysis. The preprocessing process mainly includes steps such as grayscale conversion, denoising, contrast enhancement, and image segmentation, which are as follows:
[0055] Color images contain redundant information, which is not conducive to subsequent feature extraction. Therefore, first convert the color image into a grayscale image. The grayscale value is calculated by weighted averaging the RGB values of the original image, and the formula is as follows:
[0056] I gray = 0.299R + 0.587G + 0.114B
[0057] where I gray is the pixel value of the grayscale image, and R, G, and B are the pixel values of the red, green, and blue channels respectively.
[0058] Noise (such as random noise, salt-and-pepper noise, etc.) may be introduced during the image acquisition process, and these noises will affect the accuracy of feature extraction. Therefore, Gaussian filtering is used to smooth the image and eliminate the noise. The kernel function of the Gaussian filter is:
[0059]
[0060] where G(x,y) is the weight of the filter, σ is the standard deviation of the Gaussian distribution, and x, y are pixel coordinates.
[0061] To improve the contrast between the hyphae and the background, the histogram equalization method is used to adjust the brightness distribution of the image, making the hyphal area more prominent. The formula for histogram equalization is:
[0062]
[0063] where Ieq is the equalized pixel value, P(i) is the probability of pixels with gray value i, M and N are the width and height of the image respectively, and L is the number of gray levels.
[0064] Use Otsu's method for image segmentation to separate the hypha region from the background and obtain a more accurate hypha contour. Otsu's method automatically determines the segmentation threshold by maximizing the between-class variance, and the formula is as follows:
[0065]
[0066] Among them, is the between-class variance, w1(t) and w2(t) are the probabilities of foreground and background pixels under threshold t respectively, and μ1(t) and μ2(t) are the average gray values of foreground and background pixels.
[0067] After the image preprocessing is completed, the feature extraction module analyzes the images of Poria cocos strains and miscellaneous bacteria regions in detail. The extracted features include color, texture, and morphological features, and the specific descriptions are as follows:
[0068] For color images, color features can be extracted before grayscale processing, mainly by means of color histograms, to analyze the color distribution of hyphae. The color distributions of different strains or miscellaneous bacteria may have obvious differences, which is an important basis for classification. By extracting the color histogram of the color image, the color distribution of hyphae is analyzed. The color histogram can reflect the color feature differences of different strains or miscellaneous bacteria. The color feature vector is expressed as:
[0069]
[0070] Among them, H(i) is the frequency of the gray level i in the color histogram, n i is the number of pixels with gray level i, and N is the total number of pixels in the image.
[0071] Extract texture features using Local Binary Pattern (LBP) and Gray-Level Co-Occurrence Matrix (GLCM). LBP is used to capture the local texture patterns on the hypha surface, which can reflect subtle structural differences. While GLCM is used to describe the gray-level dependence between adjacent pixels, reflecting texture information such as the thickness, directionality, and distribution uniformity of hyphae. LBP is used to capture local texture patterns, and its calculation formula is:
[0072]
[0073] Among them, gp is the gray value of the neighborhood pixel, g cis the gray value of the central pixel, s(x) is the threshold function, s(x)=1 if x≥0, otherwise 0. GLCM is used to describe the gray dependence between pixels. Common texture features include contrast, correlation, energy, and entropy. The contrast of the gray-level co-occurrence matrix is defined as:
[0074]
[0075] where P(i,j) represents the probability of the occurrence of pixel pairs with gray levels i and j.
[0076] Morphological features are used to describe the shape and geometric structure of hyphae, mainly including area, perimeter, shape factor, etc. The shape factor can be used to analyze the morphological health of hyphae, and its calculation formula is:
[0077]
[0078] where A is the area of the hyphae and P is the perimeter of the hyphae. The shape factor can be used to analyze the morphological health of hyphae. A larger shape factor indicates that the hyphae are more evenly distributed and regular in shape, while a smaller shape factor may indicate the invasion of contaminants. Through the above feature extraction, a complete feature dataset of Poria cocos strains and contaminants can be obtained.
[0079] After feature extraction, the contaminant detection module classifies the extracted multi-dimensional features through a support vector machine (SVM) classification model. SVM is a commonly used algorithm that is very suitable for binary classification problems, especially showing good accuracy and robustness in distinguishing Poria cocos strains and contaminants. The detection of Poria cocos strains and contaminants involves the combination of multiple features, including color, texture, and morphological features. Through the joint representation of these features, a feature vector can be constructed as the input of the SVM model for classification tasks.
[0080] During the feature extraction process, the system extracts color features, texture features, and morphological features from each image. These features are combined into a feature vector to represent the features of the hyphae in each image:
[0081] x = [H1, H2, …, LBP1, LBP2, …, GLCM1, …, ShapeFactor]
[0082] By using a large number of labeled sample images of Poria cocos strains and contaminants, the SVM classifier is trained. Each sample image has a corresponding label (i.e., Poria cocos strain or contaminant), and after feature extraction, it forms a feature vector. The goal of SVM is to find an optimal hyperplane in the feature space to separate the two types of samples of Poria cocos strains and contaminants. The representation of the decision boundary is:
[0083] f(x) = w·x + b
[0084] Among them, w is the weight vector and b is the bias. The hyperplane is calculated based on the positions of the wolfiporia cocos strains and the contaminant samples in the training data and is used to distinguish between the two classes. The optimal hyperplane is selected by maximizing the margin between the two types of samples to this plane, so that the classification model has stronger generalization ability. For each new image feature vector, the SVM classifies by calculating the distance of the sample relative to the hyperplane. If f(x)≥0, it is determined to be a wolfiporia cocos strain; otherwise, it is determined to be a contaminant. The model is updated regularly using newly collected samples to ensure that the model adapts to environmental changes, and a detection threshold is set to trigger an alarm when the contaminant probability exceeds it.
[0085] The output module of the present invention is used to visually display the detection results of wolfiporia cocos strains and contaminants to the user. The interface intuitively shows the health status of the strains and highlights the detected contaminant areas. The system provides corresponding processing suggestions according to the detection results. For example, when the contaminants spread to a certain extent, the system will suggest that the operator isolate this batch of strains or stop using them to avoid the spread of contamination. The system can also generate a detailed detection report, and the report content includes the detection time, the health status of the strains, whether contaminants are detected, the distribution and spread of the contaminants, etc. The report not only records the time points of each detection for facilitating the traceability of the growth status of the strains, but also provides processing suggestions according to the spread degree of the contaminants, such as measures like isolation, stopping use, or cleaning the equipment, etc., to ensure the hygiene of the production environment and the purity of the strains.
[0086] In addition, the system supports the traceability function of historical data, which is convenient for analyzing the relationship between the growth environment of the strains and the contaminant pollution, and helps the operator optimize the cultivation conditions. The system uses a variety of data visualization tools, such as charts and images, to display information such as the growth dynamics of the strains and the spread trend of the contaminants. These visualized data help the production personnel quickly judge the status of the strains and take measures in a timely manner to avoid the expansion of contamination. The generated report not only provides a basis for the operator for production management, but also can be used as a reference for subsequent quality control. Through the accumulated large amount of detection data, the system can also perform in-depth analysis to further optimize the production process of wolfiporia cocos strains, thereby improving the overall quality of the product.
[0087] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of changes or substitutions, which should all be covered by the protection scope of the present invention; without conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for detecting miscellaneous bacteria in Poria cocos, characterized in that: include: S1: The Poria cocos strains were inoculated into a standard culture medium and placed in an incubator with constant temperature and humidity to collect a complete image sequence of the mycelium growth process; S2: preprocessing the collected images, the preprocessing process mainly includes grayscale, denoising, contrast enhancement and image segmentation steps; S3: extracting features from the preprocessed image, the extracted features include color, texture and morphological features; S4: Classify the extracted multidimensional features through the support vector machine classification model; S5: Display the test results of Poria cocos strains and miscellaneous bacteria.
2. A method for detecting miscellaneous bacteria in Poria cocos according to claim 1, characterized in that: In S2, the grayscale is calculated by weighted average of the RGB values of the original image, and the formula is as follows: I gray =0.299R+0.587G+0.114B Among them, I gray is the grayscale image pixel value, R, G, and B are the pixel values of the red, green, and blue channels respectively.
3. A method for detecting miscellaneous bacteria in Poria cocos according to claim 1, characterized in that: In S2, the kernel function of the Gaussian filter for denoising is: Among them, G(x,y) is the weight of the filter, σ is the standard deviation of the Gaussian distribution, and x and y are pixel coordinates.
4. A method for detecting miscellaneous bacteria in Poria cocos according to claim 1, characterized in that: In S2, the formula for contrast enhancement histogram equalization is: Among them, I eq is the pixel value after equalization, P(i) is the probability of the pixel with gray value i, M and N are the width and height of the image respectively, and L is the gray level.
5. A method for detecting miscellaneous bacteria in Poria cocos according to claim 1, characterized in that: In S2, the image segmentation formula is as follows: in, is the inter-class variance, w1(t) and w2(t) are the probabilities of foreground and background pixels under threshold t, μ1(t) and μ2(t) are the average grayscale values of foreground and background pixels.
6. A method for detecting miscellaneous bacteria in Poria cocos according to claim 1, characterized in that: In S3, for color images, color features can be extracted before grayscale processing. The color feature vector is expressed as: Among them, H(i) is the frequency of gray level i in the color histogram, n i is the number of pixels with gray level i, and N is the total number of pixels in the image.
7. A method for detecting miscellaneous bacteria in Poria cocos according to claim 1, characterized in that: The local binary pattern (LBP) and gray-level co-occurrence matrix (GLCM) are used to extract texture features. LBP is used to capture local texture patterns, and its calculation formula is: Among them, gp is the gray value of the neighborhood pixel, g c is the gray value of the center pixel, s(x) is the threshold function, if x ≥ 0, then s(x) = 1, otherwise it is 0. GLCM is used to describe the gray dependency between pixels. Commonly used texture features include contrast, correlation, energy and entropy; The contrast of the gray-level co-occurrence matrix is defined as: Among them, P(i,j) represents the probability of occurrence of a pixel pair of gray levels i and j.
8. A method for detecting miscellaneous bacteria in Poria cocos according to claim 1, characterized in that: The shape factor can be used to analyze the morphological health of mycelium, and its calculation formula is: Among them, A is the area of mycelium, P is the perimeter of mycelium, and a larger shape factor indicates that the mycelium is more evenly distributed and has a regular shape, while a smaller shape factor indicates the invasion of foreign bacteria.
9. A method for detecting miscellaneous bacteria in Poria cocos according to claim 1, characterized in that: In the feature extraction process, color features, texture features, and morphological features are extracted from each image, and these features are combined into a feature vector to represent the characteristics of the hyphae in each image: x=[H1,H2,…,LBP1,LBP2,…,GLCM1,…,ShapeFactor] By using SVM to find an optimal hyperplane in the feature space, the samples of Poria cocos and miscellaneous fungi are separated. The decision boundary is expressed as: f(x)=w·x+b Where w is the weight vector, b is the bias, and the hyperplane is calculated based on the positions of the strains and miscellaneous fungi samples in the training data to distinguish the two classes. The optimal hyperplane is selected by maximizing the interval between the two types of samples and the plane, so that the classification model has stronger generalization ability. SVM classifies the sample by calculating the distance of the sample relative to the hyperplane. If f(x)≥0, it is judged to be a Poria species; otherwise, it is judged to be a miscellaneous fungus.
10. A device for detecting miscellaneous bacteria of Poria cocos, characterized in that: The steps for executing the method for detecting foreign bacteria in Poria cocos strains according to any one of claims 1 to 9 include: An image preprocessing module is used to obtain a complete image sequence of the mycelium growth process; Image preprocessing module, used to preprocess the image. The preprocessing process mainly includes grayscale, denoising, contrast enhancement and image segmentation; A feature extraction module is used to extract features from the preprocessed image. The extracted features include color, texture and morphological features. Miscellaneous bacteria detection module, used to classify the extracted multi-dimensional features; The output module is used to display the detection results of Poria cocos strains and miscellaneous bacteria to users in a visual way.