Mold test detection method and device based on image processing

By preprocessing and model matching mold images using image processing technology, the problem of inaccurate mold species observation by the human eye is solved, and the automated and accurate identification and growth monitoring of mold species are realized.

CN119313924BActive Publication Date: 2026-04-21NANJING SUSHI GUANGBO ENVIRONMENTAL RELIABILITY LAB CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING SUSHI GUANGBO ENVIRONMENTAL RELIABILITY LAB CO LTD
Filing Date
2024-10-08
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, relying on human visual observation of mold species is subject to significant interference, leading to inaccurate mold species identification results, especially when multiple species coexist, making precise differentiation and identification difficult.

Method used

An image processing-based approach is adopted, which preprocesses and matches mold images using automated image processing technology. It uses a preset fungal species model to identify the types and quantities of molds, including median filtering, contrast enhancement, edge detection and binarization. Mold regions are extracted by combining preset detection methods, and a preset fungal species model is constructed for automated matching.

Benefits of technology

It improves the accuracy and efficiency of mold species identification, reduces human error, ensures the accuracy and timeliness of identification results, and provides automated mold species identification and growth monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313924B_ABST
    Figure CN119313924B_ABST
Patent Text Reader

Abstract

A method and apparatus for mold detection based on image processing, relating to the field of mold detection technology. In this method, a first image is acquired, which is an image of the target mold in a petri dish; the first image is preprocessed to obtain a second image; the second image is input into a preset microbial model for matching to obtain the number of first microbial species; it is determined whether the number of first microbial species is equal to the number of preset microbial species, which is the number of species corresponding to the microbial species pre-placed in the petri dish; when the number of first microbial species is equal to the number of preset microbial species, the target mold is confirmed to be in a normal state, so that the target mold can be tested according to the normal state. Implementing the technical solution provided in this application effectively solves the interference of direct human observation of various microbial species and improves the accuracy of mold species identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of mold detection technology, specifically to a mold testing method and apparatus based on image processing. Background Technology

[0002] Molds, as a widespread type of microorganism, possess extremely high reproductive capacity and adaptability. They can rapidly multiply, especially in high humidity and suitable temperature environments, and spread through the air. Their potential hazards are often underestimated but cannot be ignored. In the field of food safety, mold contamination not only damages the quality of agricultural products but may also produce mycotoxins. These toxins are difficult to identify with the naked eye in their early stages, posing a serious threat to consumer health. Therefore, effective management of mold problems is crucial for ensuring the quality of agricultural products and public health.

[0003] As consumers raise their standards for product hygiene, the building materials industry has responded actively by developing and promoting products with antibacterial and antifungal properties. These innovative technologies have been widely applied in paints, coatings, decorative materials, door and window systems, bathroom fixtures, and even antibacterial cooling towers, plastic pipes, and resin products in water treatment systems, effectively improving the health standards of the living environment. Currently, mold detection mainly relies on visual assessment methods, which use mold growth covering at least 90% of the control strip as the basic criterion for judging the validity of the test. However, given the extreme richness of mold species and the complex intertwined growth patterns during cultivation, visual observation alone is significantly insufficient in terms of comprehensive coverage and accurate differentiation. The coexistence of multiple species is extremely common in mold tests. Their growth states are subtle and their interactions are complex, which greatly limits the ability of the human eye to directly observe and analyze the details of the growth of each species, potentially leading to inaccurate mold species identification results.

[0004] Therefore, there is an urgent need for an image processing-based method and apparatus for mold testing that can solve the above-mentioned technical problems. Summary of the Invention

[0005] This application provides a mold test detection method and apparatus based on image processing. The method involves automated image processing, then inputting the processed image into a preset fungal species model for matching to obtain the number of fungal species. Based on the number of fungal species, the mold species are determined, which effectively solves the interference when the human eye directly observes various fungal species and improves the accuracy of mold species identification.

[0006] In a first aspect, this application provides an image processing-based method for detecting mold, applied in a server. The method includes: acquiring a first image, which is an image of a target mold in a petri dish; preprocessing the first image to obtain a second image; inputting the second image into a preset microbial model for matching to obtain a first microbial species quantity; determining whether the first microbial species quantity is equal to a preset microbial species quantity, which is the number of species corresponding to the microbial species placed in the petri dish beforehand; when the first microbial species quantity is equal to the preset microbial species quantity, it is confirmed that the target mold is in a normal state, so that the target mold can be tested according to the normal state.

[0007] By adopting the above technical solution, a first image of the target mold is obtained by taking a picture. The first image is then preprocessed to obtain a second image. The second image is then input into a preset fungal species model for matching to obtain the number of the first fungal species. Based on the preset fungal species model, the types and quantities of molds in the second image can be quickly and accurately identified, greatly shortening the identification time. The number of the first fungal species is then compared with the preset number of fungal species to ensure the accuracy of the identification results. The entire process is automated, avoiding errors caused by human misjudgment and improving the accuracy of mold species identification.

[0008] Optionally, the first image is preprocessed to obtain the second image; specifically, this includes: performing median filtering on the first image to obtain a first sub-image; enhancing the contrast of the first sub-image to obtain a second sub-image; extracting the mold region image from the second sub-image using a preset detection method; binarizing the mold region image to obtain a binary image; determining a set of contour maps from the binary image, each contour map being a multi-connected region in the binary image with a grayscale value of the target value; determining a target region in the first sub-image, wherein the target region includes the region in the first sub-image corresponding to each contour map in the set of contour maps; and cropping the target region to obtain the second image.

[0009] By employing the above technical solution, median filtering of the first image can effectively suppress noise in the image and reduce the impact of noise on image quality. Then, contrast enhancement is applied to the filtered first sub-image to obtain the second sub-image. This makes the brightness difference between the mold area and the background area in the image more obvious, improving image quality and clarity. A preset detection method is then used to extract the mold area image from the second sub-image. The mold area image is then binarized to obtain a binary image. A set of contour maps is determined from the binary image; these contour maps represent multi-connected regions in the binary image whose grayscale values ​​are the target values. The target region is then determined in the first sub-image, and the target region is cropped to obtain the second image. Unnecessary background information is removed, achieving precise extraction of the mold area.

[0010] Optionally, determining the target region in the first sub-image specifically includes: selecting a target contour map from a set of contour maps, the target contour map including contour maps whose first area data is within a preset area range, the first area data being data calculated from each contour map; and determining the target region corresponding to the target contour map in the first sub-image.

[0011] By employing the above technical solution, the area of ​​a set of contour images is calculated, and contour images whose first area data falls within a preset area range are selected as target contour images. This allows for the accurate identification of mold areas that meet specific size standards. This selection method is based on the actual characteristics of mold growth and effectively excludes areas of non-target molds. After determining the target contour image, the target area corresponding to the target contour image in the first sub-image is further determined. By accurately selecting and locating the target area, image data is provided for subsequent mold species identification.

[0012] Optionally, the target region is cropped to obtain a second image, specifically including: determining a target sub-image based on the target region, wherein the target sub-image is the image corresponding to the target region in the first sub-image; and cropping the target sub-image using an outer matrix method to obtain the second image.

[0013] By adopting the above technical solution and using the circumscribed matrix method to crop the target sub-image, it can be ensured that the cropped area completely includes the target area and minimize the interference of other non-target content. The circumscribed matrix method takes into account the boundary of the target area and the pixels around the boundary to ensure that the cropped image maintains visual integrity and coherence.

[0014] Optionally, when the number of the first bacterial species is equal to the preset number of bacterial species, the target mold is confirmed to be in a normal state. After testing the target mold in the normal state, the method further includes: acquiring a third image corresponding to the target mold at preset intervals; receiving a target request sent by a target user, the target request being a request to detect the growth area of ​​the target mold; calculating the third image according to the target request to obtain second area data, and sending the second area data to the target user.

[0015] By adopting the above technical solution, a third image of the target mold is acquired at preset intervals, enabling real-time monitoring of the mold growth process. The system receives detection requests from target users and calculates the third image according to user needs to accurately determine the growth area of ​​the target mold. This calculation method is based on image processing technology and can automatically identify and measure the target area in the image, avoiding the tediousness and errors of manual measurement and improving the accuracy of the data.

[0016] Optionally, before inputting the second image into the preset bacterial strain model for matching to obtain the number of the first bacterial strain, it is necessary to construct the preset bacterial strain model, which specifically includes: taking pictures of the cultured target bacterial strain to obtain historical images; processing the historical images to obtain the second bacterial strain information; determining the number of the second bacterial strain based on the second bacterial strain information, and constructing the preset bacterial strain model. The preset bacterial strain model includes a first correspondence relationship and a second correspondence relationship. The first correspondence relationship is the correspondence between the historical images and the second bacterial strain information, and the second correspondence relationship is the correspondence between the second bacterial strain information and the number of the second bacterial strain.

[0017] By adopting the above technical solution, the cultured fungal strains are photographed to obtain historical images, the types of molds are identified, and the number of fungal strains is determined based on the mold information. By constructing a preset fungal strain model, the identification and quantity statistics of mold types can be automated. When the first image is input into the preset fungal strain model, it is automatically compared with the historical images in the model, and the types and quantities of molds are calculated based on the correspondence. The entire process can be completed without manual intervention.

[0018] Optionally, after determining whether the number of the first bacterial species is equal to the preset number of bacterial species, the method further includes: when the number of the first bacterial species is not equal to the preset number of bacterial species, confirming that the target mold is in an abnormal state, generating an early warning message based on the abnormal state, so as to send the early warning message.

[0019] By adopting the above technical solution, when the number of the first strain is not equal to the preset number of strains, the target mold is confirmed to be in an abnormal state. The warning message is automatically generated based on the abnormal state, and the warning function can be realized without manual intervention, reducing the human burden and ensuring the timeliness and accuracy of the warning information.

[0020] A second aspect of this application provides an image processing-based mold testing device. The device is a server, which includes an acquisition unit, a processing unit, and a confirmation unit. The acquisition unit acquires a first image, which is an image of a target mold in a petri dish. The processing unit preprocesses the first image to obtain a second image. The second image is input into a preset microbial model for matching to obtain a first microbial species quantity. The processing unit determines whether the first microbial species quantity is equal to a preset microbial species quantity, which is the number of species corresponding to the microbial species placed in the petri dish beforehand. The confirmation unit confirms that the target mold is in a normal state when the first microbial species quantity is equal to the preset microbial species quantity, so that the target mold can be tested according to the normal state.

[0021] Optionally, the processing unit is used to perform median filtering on the first image to obtain a first sub-image; to perform contrast enhancement on the first sub-image to obtain a second sub-image; to extract the mold region image from the second sub-image using a preset detection method; to perform binarization on the mold region image to obtain a binary image; to determine a set of contour maps from the binary image, each contour map being a multi-connected region in the binary image with a gray value of the target value; to determine a target region in the first sub-image, wherein the target region includes the region in the first sub-image corresponding to each contour map in the set of contour maps; and to crop the target region to obtain the second image.

[0022] Optionally, the processing unit is used to filter out a target contour map from a set of contour maps, the target contour map including contour maps whose first area data is within a preset area range, the first area data being data calculated from each contour map; and to determine the target region corresponding to the target contour map in the first sub-image.

[0023] Optionally, the processing unit is used to determine a target sub-image based on the target region, wherein the target sub-image is the image corresponding to the target region in the first sub-image; and to crop the target sub-image using an outer matrix method to obtain a second image.

[0024] Optionally, the acquisition unit is used to acquire a third image corresponding to the target mold at preset intervals; receive a target request sent by the target user, the target request being a request to detect the growth area of ​​the target mold; the processing unit is used to calculate the third image according to the target request, obtain second area data, and send the second area data to the target user.

[0025] Optionally, the processing unit is used to take pictures of the target bacterial strain after cultivation to obtain historical images; process the historical images to obtain second bacterial strain information; determine the quantity of the second bacterial strain based on the second bacterial strain information; and construct a preset bacterial strain model. The preset bacterial strain model includes a first correspondence relationship and a second correspondence relationship. The first correspondence relationship is the correspondence between the historical images and the second bacterial strain information, and the second correspondence relationship is the correspondence between the second bacterial strain information and the quantity of the second bacterial strain.

[0026] Optionally, the confirmation unit is used to confirm that the target mold is in an abnormal state when the number of the first bacterial species is not equal to the preset number of bacterial species, and to generate an early warning message based on the abnormal state so as to send the early warning message.

[0027] In a third aspect, this application provides an electronic device including a processor, a memory, a user interface, and a network interface. The memory is used to store instructions, the user interface and the network interface are used to communicate with other devices, and the processor is used to execute the instructions stored in the memory, causing the electronic device to perform the method as described in any of the above-described methods of this application.

[0028] In a fourth aspect, this application provides a computer-readable storage medium storing instructions that, when executed, perform any of the methods described above in this application.

[0029] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:

[0030] 1. The target mold is photographed to obtain a first image. The first image is then preprocessed to obtain a second image. The second image is then input into a preset fungal species model for matching to obtain the number of the first fungal species. Based on the preset fungal species model, the type and quantity of mold in the image can be quickly and accurately identified, greatly shortening the identification time. The number of the first fungal species is then compared with the preset number of fungal species to ensure the accuracy of the identification results. The entire process is automated, avoiding errors caused by human misjudgment and improving the accuracy of mold species identification.

[0031] 2. Median filtering is applied to the first image to effectively suppress noise and reduce its impact on image quality. Contrast enhancement is then applied to the filtered first sub-image to obtain the second sub-image. This makes the brightness difference between the mold area and the background area more pronounced, improving image quality and clarity. A preset detection method is then used to extract the mold area from the second sub-image. The mold area image is then binarized to obtain a binary image. A set of contour maps is determined from the binary image; these contour maps represent multi-connected regions in the binary image whose grayscale values ​​are the target values. The target region is then identified in the first sub-image, and this target region is cropped to obtain the second image. Unnecessary background information is removed, achieving precise extraction of the mold area. Attached Figure Description

[0032] Figure 1 This is a schematic flowchart of a mold test detection method based on image processing provided in an embodiment of this application;

[0033] Figure 2 This is a schematic diagram of a scenario for a mold test detection method based on image processing provided in an embodiment of this application;

[0034] Figure 3 This is a schematic diagram of the structure of a mold testing and detection device based on image processing provided in an embodiment of this application;

[0035] Figure 4 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application.

[0036] Explanation of reference numerals in the attached drawings: 301, acquisition unit; 302, processing unit; 303, confirmation unit; 400, electronic device; 401, processor; 402, communication bus; 403, user interface; 404, network interface; 405, memory. Detailed Implementation

[0037] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0038] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0039] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0040] Molds, as a widespread type of microorganism, possess extremely high reproductive capacity and adaptability. They can rapidly multiply, especially in high humidity and suitable temperature environments, and spread through the air. Their potential hazards are often underestimated but cannot be ignored. In the field of food safety, mold contamination not only damages the quality of agricultural products but may also produce mycotoxins. These toxins are difficult to identify with the naked eye in their early stages, posing a serious threat to consumer health. Therefore, effective management of mold problems is crucial for ensuring the quality of agricultural products and public health.

[0041] As consumers raise their standards for product hygiene, the building materials industry has responded actively by developing and promoting products with antibacterial and antifungal properties. These innovative technologies have been widely applied in paints, coatings, decorative materials, door and window systems, bathroom fixtures, and even antibacterial cooling towers, plastic pipes, and resin products in water treatment systems, effectively improving the health standards of the living environment. Currently, mold detection mainly relies on visual assessment methods, which use mold growth covering at least 90% of the control strip as the basic criterion for judging the validity of the test. However, given the extreme richness of mold species and the complex intertwined growth patterns during cultivation, visual observation alone is significantly insufficient in terms of comprehensive coverage and accurate differentiation. The coexistence of multiple species is extremely common in mold tests. Their growth states are subtle and their interactions are complex, which greatly limits the ability of the human eye to directly observe and analyze the details of the growth of each species, potentially leading to inaccurate mold species identification results.

[0042] Therefore, how to overcome the interference encountered by the human eye when directly observing various mold species and improve the accuracy of mold species identification is an urgent problem to be solved. This application provides an image processing-based mold detection method, applied in a server. The server in this application can be a platform providing mold species detection. Figure 1 This is a schematic flowchart of an image processing-based mold detection method provided in an embodiment of this application. (Refer to...) Figure 1 The method includes the following steps S101-S105.

[0043] S101: Acquire the first image, which is an image of the target mold in the petri dish.

[0044] In step S101 above, the researchers first placed the target fungal strain in a petri dish for cultivation. After 7 days of mold testing, a control strip was removed, which contained information about the growth of the target mold during the 7-day test. The control strip was placed under a microscope, and then a high-definition camera or other imaging equipment was connected to ensure that the morphology and details of the target mold in the control strip could be clearly captured. During the shooting process, it is necessary to ensure that the ambient light is sufficient and uniform, avoiding the influence of shadows and reflections on image quality. At the same time, the petri dish should be kept clean and stable to prevent shaking during the shooting process. The camera was aimed at the target mold in the petri dish, and the focus and exposure were adjusted to ensure that the image was clear and the colors accurate. The shutter was pressed to capture the first image. When shooting, the resolution also needs to be selected, prioritizing higher resolutions. For example, a resolution of 2560*1440 can be selected.

[0045] S102: Preprocess the first image to obtain the second image.

[0046] In step S102 above, after acquiring the first image, the first image is preprocessed to obtain the second image. Specifically, this includes: performing median filtering on the first image to obtain a first sub-image; enhancing the contrast of the first sub-image to obtain the second sub-image; extracting the mold region image using a preset detection method; binarizing the mold region image to obtain a binary image; determining a set of contour maps from the binary image, where each contour map is a multi-connected region in the binary image with a grayscale value corresponding to the target value; determining a target region in the first sub-image, where the target region includes the region in the first sub-image corresponding to each contour map in the set of contour maps; and cropping the target region to obtain the second image. Specifically, firstly, the first image is subjected to median filtering. Median filtering is a nonlinear filtering technique based on ordinal statistics theory, which can effectively suppress noise in the image, especially salt-and-pepper noise, while preserving edge information. It achieves this by replacing the value of a pixel with the median value of pixels in its neighborhood. Typically, when using median filtering, a filtering window (such as 3x3, 5x5, 7x7, etc.) needs to be selected. The choice of window size depends on the intensity of the noise and the detail of the image. A larger window can suppress noise better but may blur image details; a smaller window may not be able to completely remove noise. For each pixel in the first image, the pixel values ​​of its neighborhood (i.e., pixels within the filtering window) are sorted, and the median of the sorted values ​​is selected as the new value for that pixel. This median filtering process is repeated for all pixels in the image to obtain the first sub-image. The first sub-image is then checked to confirm whether the noise has been effectively suppressed and whether edge information has been preserved. After obtaining the first sub-image, contrast enhancement is performed on it. Contrast enhancement aims to increase the brightness difference between the mold area and the background area in the image, making the image clearer. Commonly used contrast enhancement methods include histogram equalization, adaptive histogram equalization, contrast boosting, and nonlinear contrast enhancement algorithms (such as gamma correction). A suitable contrast enhancement method is selected based on the specific characteristics of the first sub-image (such as brightness distribution, noise level, etc.). For example, if the image is generally dark or lacks contrast, histogram equalization or contrast boosting can be chosen. For the selected contrast enhancement method, some parameters may need to be adjusted to achieve the best results. For example, in histogram equalization, different histogram normalization ranges may need to be set. The selected contrast enhancement method is applied to the first sub-image to obtain the second sub-image. Then, a preset detection method is used to extract the mold region image from the second sub-image. Here, the preset detection method refers to the Robert operator, a commonly used edge detection operator in image processing and computer vision. Its main principle is to detect edge information in the image by performing difference calculations on the gray values ​​of the neighborhood surrounding each pixel.The gradient of grayscale values ​​in the second sub-image is calculated using the Robert operator to extract the edges of the mold region, and then edge detection is performed to form a mold region image. The mold region image is then binarized, a process that converts an image into only two grayscale levels (typically 0 and 255). In the mold region image, this typically means setting the mold region (or other region of interest) to white (255) and the background to black (0). A suitable threshold is selected for binarization. The threshold selection depends on the brightness difference between the mold region and the background. The optimal threshold is usually determined through trial and error or an automatic threshold selection algorithm. The grayscale value of each pixel in the mold region image is compared to the threshold. If the grayscale value is greater than or equal to the threshold, the pixel is set to white (1); otherwise, it is set to black (0). In this application, white 1 represents the background, and black 0 represents the mold region. Binarization is performed by traversing all pixels in the image to obtain a binary image. The binary image is checked to confirm that the mold region has been accurately extracted and converted to a white region while the background has been converted to a black region. Besides binarization, which yields a binary image, the Otsu method can also be used to process mold region images to obtain a binary image. The Otsu method, also known as the Otsu method or Otsu thresholding method, is a widely used adaptive thresholding method in image processing. The basic idea of ​​the Otsu method is to divide pixels in an image into two classes using a threshold: one class contains pixels with gray values ​​all below the threshold, considered as background; the other class contains pixels with gray values ​​all above or equal to the threshold, considered as the target, i.e., mold. By calculating the variance of the gray values ​​of these two classes of pixels and finding the threshold that maximizes the variance, the optimal threshold is determined. A larger variance indicates a greater difference between the background and the target, and a lower probability of misclassification. The mold region image is then divided according to the optimal threshold, with the background represented by a gray value of 1 and the mold by a gray value of 0, resulting in a binary image. After obtaining the binary image, it can be processed to detect a set of contour maps. Each contour map can be understood as a multi-connected region in the binary image whose grayscale value is the target value. Multi-connected regions include four-connected regions and eight-connected regions. The specific choice of which type of multi-connected region to use depends on the arrangement of grayscale values ​​in the binary image. A four-connected region is a region where movement from a given point is limited to four directions: up, down, left, and right, and the boundary of the region cannot be crossed. An eight-connected region allows movement along the diagonal directions (upper left, upper right, lower left, lower right) in addition to the four directions, and again, movement is limited to the boundary of the region. Here, a given point refers to a point in the binary image whose grayscale value is the target value. Setting the target value to 0 means connecting points with a grayscale value of 0 using four-connected or eight-connected regions. Completing one four-connected or eight-connected region yields a contour map. After completing the connections, the various contour maps are combined into a set of contour maps.Based on the realities of binary graphs, a set of contour graphs may include one or more contour graphs. For example... Figure 2 As shown, the image of the moldy area is binarized to obtain a binary image, which is then... Figure 2 The first image in the image is then used to connect the points with a grayscale value of 0 through multi-connected regions to obtain a set of contours. Figure 2 A set of contour images consists of contour image a, contour image b, contour image c, and contour image d. Then, gray values ​​other than the target value are removed from the binary image, leaving only one set of contour images.

[0047] Furthermore, after determining a set of contour maps from the binary image, the target region is determined in the first sub-image. This specifically includes: filtering target contour maps from the set of contour maps, where the target contour maps include those whose first area data falls within a preset area range. The first area data is calculated from each contour map; and determining the target region corresponding to the target contour map in the first sub-image. Specifically, all contour maps in the set can be extracted first, and then the area of ​​each detected contour can be calculated using the area calculation function provided by the image database, i.e., the first area data, with one first area data corresponding to one contour map. A preset area range is then set, based on the minimum and maximum areas for target mold growth. All calculated first area data of contours are iterated through, and contours whose first area data falls within the preset range are considered target contour maps. Since the target contour map is currently a binary image and cannot identify mold, it needs to be mapped to the first sub-image, which may require coordinate transformation. This typically involves converting the coordinates of the target contour map to coordinates in the first sub-image. Once the target contour map is mapped onto the first sub-image, the area it covers is the target region. The boundaries of the target region can also be defined using the contour's boundary points. The target region is then output in an appropriate format, such as by labeling it on the first sub-image.

[0048] For example, if the preset area range is set to 100-2000, and the first area data corresponding to A in a set of contour maps is obtained, if the first area data corresponding to A is 200, and the first area data is within the preset area range, then confirm that A is included in the target contour map. If the first area data corresponding to D is 50, and the first area data is not within the preset area range, then confirm that the contour map corresponding to D is removed. The preset area range can be set based on the actual situation of each bacterial species; this is just an example and not a limitation.

[0049] Further, the target region is cropped to obtain the second image. This includes: determining a target sub-image based on the target region, where the target sub-image is the image corresponding to the target region in the first sub-image; and cropping the target sub-image using the bounding matrix method to obtain the second image. Specifically, in the first sub-image, the target region is precisely located based on its coordinates. Then, using the region cropping function in the image processing library, the corresponding target sub-image is extracted from the first sub-image based on the coordinate information of the target region. This step typically involves slicing the image matrix, i.e., selecting the pixel matrix corresponding to the target region. The bounding matrix usually refers to the smallest rectangle that can completely contain the target region. In image processing, this can be achieved by calculating the smallest bounding rectangle of the target region. Using the cropping function in the image processing library, the target sub-image is cropped based on the coordinates of the calculated smallest bounding rectangle. This step is essentially a further precise cropping of the already extracted target sub-image to remove any possible redundant edges, ensuring that the second image only contains the minimum necessary portion of the target region. If the target region is tilted, meaning its smallest bounding rectangle is not horizontal, it may be necessary to rotate the target sub-image first to make the bounding rectangle horizontal before cropping. The rotation operation involves calculating the rotation angle, constructing the rotation matrix, and using rotation functions from an image processing library. The cropped image is output as a second image, which consists of multiple sub-images containing a clear outline and feature information of the target mold.

[0050] S103: Input the second image into the preset bacterial strain model for matching to obtain the number of the first bacterial strain.

[0051] In step S103 above, before inputting the second image into the preset fungal species model for matching to obtain the number of the first fungal species, the preset fungal species model needs to be constructed. This specifically includes: taking pictures of the cultured target fungal species to obtain historical images; processing the historical images to obtain second fungal species information; determining the number of the second fungal species based on the second fungal species information; and constructing the preset fungal species model. The preset fungal species model includes a first correspondence and a second correspondence. The first correspondence is the correspondence between historical images and second fungal species information, and the second correspondence is the correspondence between second fungal species information and the number of second fungal species. Specifically, a machine learning model capable of identifying fungal species is pre-trained. The preset fungal species model contains a large amount of image data of known fungal species as a training set. First, the currently known fungal species are acquired, and then the known fungal species are cultured in a standardized experimental environment. Then, high-resolution microscopy is used to periodically photograph them at different time periods to obtain a large number of high-quality images of fungal growth. To ensure the diversity of the dataset, the culture conditions, such as light intensity, humidity, and temperature, are deliberately changed during the photographing process to capture the growth state of the fungal species under different environments. Taking the cultivation of a single fungal species as an example, the target species is first cultured. After cultivation, the cultured target species is placed in the shooting area to ensure even or clear visibility. Each historical image is assigned a unique name or number for subsequent management and retrieval. Preprocessing operations such as denoising and contrast enhancement are then performed on the historical images to improve image quality. Color correction and grayscale conversion can also be performed to better extract species information. Image processing algorithms (such as edge detection, texture analysis, and morphological processing) are then used to extract species features from the images. Features may include the shape, size, color, and texture of the species. The extracted species features are integrated into second species information. Second species information is typically a dataset containing species names and multiple feature parameters. Based on the feature parameters in the second species information, the number of second species of molds in the current second species information is determined, i.e., one species corresponds to one quantity. Each historical image is associated with its corresponding second species information, forming a first correspondence. Next, based on the quantity data in the second bacterial species information, a correspondence between the second bacterial species information and the quantity of the second bacterial species is established. This can also be achieved using data structures such as data tables or databases. The first and second correspondences are then integrated into a preset bacterial species model. This model can automatically output the corresponding quantity information of the second bacterial species based on the input historical images.

[0052] After constructing the pre-defined fungal strain model, it needs to be trained. The training process is as follows: First, a custom mold image dataset is loaded. These images have been labeled using tools such as LabelImg, including the type and location of the mold (bounding boxes). To improve the model's generalization ability, the training data is augmented, such as through random cropping, rotation, scaling, and color jittering, to increase the diversity of the dataset. The dataset is divided into training, test, and validation sets in an 8:1:1 ratio to ensure that the model's performance can be evaluated on different datasets. YOLOv5 is chosen as the object detection model because it performs well in both speed and accuracy. Based on the characteristics of mold images, the YOLOv5 network structure is optimized, such as by adding a detection layer, adding a CBAM module, and adopting the NWD loss function, to improve the model's ability to detect small objects. Training parameters such as learning rate, weight decay, batch size, and number of iterations are set to control the training process. Training is performed on a computer with a high-performance GPU using the PyTorch framework and CUDA acceleration. Training data is fed into the model in batches, and the loss is calculated through forward propagation. Then, the model parameters are updated through backpropagation. During training, an early stopping mechanism is used to avoid overfitting; training stops when performance on the validation set begins to decline. During training, the model's weights and configuration are periodically saved for subsequent evaluation and deployment. After training, the model's performance is evaluated using a test set, including metrics such as mean average precision (mAP), precision, and recall. After training, a second image is input into the preset fungal species model. Since the second image consists of multiple sub-images, each sub-image corresponds to a target sub-image. Each sub-image in the second image is compared and matched with the data in the training set of the preset fungal species model to determine the species of the target mold in the second image. After determining the mold species in the second image, the number of mold species is calculated to obtain the first species count.

[0053] For example, when the second image is input into the preset fungal species model, when there are 4 sub-images in the second image, the 4 sub-images are compared with the training set images in the preset fungal species model in turn to determine which fungal species each sub-image belongs to. After determining the fungal species, the number of fungal species is calculated to obtain the first fungal species count. One fungal species count corresponds to one fungal species.

[0054] S104: Determine whether the number of the first bacterial strain is equal to the preset number of bacterial strains. The preset number of bacterial strains is the number of species corresponding to the bacterial strains placed in the culture dish beforehand.

[0055] In step S104 above, when the mold species in the second image is identified as the first bacterial species quantity, the bacterial species and quantity placed in the petri dish beforehand need to be determined in advance, i.e., the preset bacterial species quantity. The first bacterial species quantity is then compared with the preset bacterial species quantity.

[0056] S105: When the number of the first bacterial strain is equal to the preset number of bacterial strains, the target mold is confirmed to be in a normal state so that the target mold can be tested according to the normal state.

[0057] In step S105 above, if the number of the first microbial strain equals the preset number of microbial strains, the target mold is confirmed to be in a normal state. At this time, subsequent experimental operations can be performed on the target mold based on its normal state, such as observing its growth process and measuring its metabolic products.

[0058] Furthermore, if the quantity of the first bacterial strain does not equal the preset quantity, the target mold is confirmed to be in an abnormal state. An early warning message is generated based on this abnormal state and sent out. If the quantity of the first bacterial strain does not equal the preset quantity, it indicates that the target mold may be in an abnormal state (e.g., contamination, abnormal growth). In this case, an early warning message should be generated, and corresponding measures should be taken, such as re-culturing or checking the culture environment. When sending the early warning message, the target audience must be clearly defined, i.e., the personnel or organizations that need to receive and pay attention to this information. This may include laboratory staff, managers, regulatory authorities, suppliers, or customers. The early warning message should be sent to the target audience according to the selected channel and format. During the transmission process, the integrity and timeliness of the information should be ensured to avoid information loss or delay.

[0059] In one possible implementation, after testing the target mold and completing the test, the growth of the target mold is monitored to understand the growth of various molds during the test and provide suggestions for improvement of subsequent materials. Specifically, this includes: acquiring a third image of the target mold at preset time intervals; receiving a target request from a target user requesting the detection of the growth area of ​​the target mold; calculating the second area data based on the target request in the third image and sending the second area data to the target user. Specifically, a fixed time interval is set according to the experimental requirements to acquire images of the target mold after the test ends. This time interval should be set based on the cycle of the mold test to ensure timely capture of changes in the mold after the test ends. Appropriate image acquisition devices (such as cameras, microscope cameras, etc.) can be used to photograph the target mold. Ensure that the settings of the image acquisition device (such as resolution, exposure time, focus, etc.) are consistent before outputting the acquired image as the third image. Then, a target request is received from the target user, who refers to the personnel conducting the mold test. The server receives the request sent by the user. The request is parsed, which requires detecting the growth of target mold in the third image to output area data. Necessary preprocessing operations are performed on the third image, such as grayscale conversion, filtering and noise reduction, and contrast enhancement, to improve image quality and reduce computational complexity. Image processing algorithms (such as thresholding, edge detection, and contour extraction) are used to detect mold regions in the image. Then, the mold regions are identified and extracted based on their characteristics (such as color, texture, and shape). The area of ​​the detected mold regions is calculated. This typically involves counting the pixels in the region or using area calculation functions provided by an image processing library. The calculated second area data is formatted into a user-understandable format (such as text or charts). This represents the proportion of a certain type of mold growth within the target mold. This allows for the detection and monitoring of the target mold growth area, with results promptly fed back to the target user.

[0060] Using the above method, the original image is first denoised using median filtering to obtain the original grayscale image. Median filtering is a commonly used non-linear smoothing filtering method that effectively eliminates isolated noise points and improves the signal-to-noise ratio of the image by adjusting pixels with large differences in grayscale values ​​to levels close to those of surrounding pixels. Next, after enhancing the contrast between the mold and the background, the Roberts operator is used for edge detection to accurately extract the mold region from the background. Subsequently, automatic threshold binarization is performed using the Otsu method to convert the sample images into binary images, and the contour area in each sample image is calculated. Regions that do not meet expectations are automatically filtered out. Finally, the original grayscale image corresponding to the contour is cropped using a bounding rectangle to obtain the processed image. The processed image is then input into a preset fungal species model for matching, which can identify the type of mold and output the mold species to the user, laying a solid foundation for subsequent calculation of mold growth area and ensuring the accuracy and reliability of the detection results.

[0061] This application also provides an image processing-based mold testing device. Figure 3 This is a schematic diagram of the structure of a mold testing and detection device based on image processing provided in an embodiment of this application. (Refer to...) Figure 3 The device is a server, which includes an acquisition unit 301, a processing unit 302, and a confirmation unit 303.

[0062] The acquisition unit 301 acquires a first image, which is an image of the target mold in the petri dish.

[0063] The processing unit 302 preprocesses the first image to obtain a second image; inputs the second image into a preset bacterial strain model for matching to obtain the number of first bacterial strains; and determines whether the number of first bacterial strains is equal to the number of preset bacterial strains, where the number of preset bacterial strains is the number of species corresponding to the bacterial strains placed in the culture dish in advance.

[0064] The confirmation unit 303 confirms that the target mold is in a normal state when the number of the first bacterial species is equal to the number of preset bacterial species, so that the target mold can be tested according to the normal state.

[0065] In one possible implementation, the processing unit 302 is configured to perform median filtering on the first image to obtain a first sub-image; perform contrast enhancement on the first sub-image to obtain a second sub-image; extract the second sub-image using a preset detection method to obtain a mold region image; perform binarization on the mold region image to obtain a binary image; determine a set of contour maps from the binary image, each contour map being a multi-connected region in the binary image with a grayscale value of a target value; determine a target region in the first sub-image, wherein the target region includes the region in the first sub-image corresponding to each contour map in the set of contour maps; and crop the target region to obtain the second image.

[0066] In one possible implementation, the processing unit 302 is used to filter out a target contour map from a set of contour maps, the target contour map including contour maps whose first area data is within a preset area range, the first area data being data calculated from each contour map; and to determine the target region corresponding to the target contour map in the first sub-image.

[0067] In one possible implementation, the processing unit 302 is used to determine a target sub-image based on the target region, wherein the target sub-image is the image corresponding to the target region in the first sub-image; and to crop the target sub-image using an outer matrix method to obtain a second image.

[0068] In one possible implementation, the acquisition unit 301 is used to acquire a third image corresponding to the target mold at preset time intervals; receive a target request sent by the target user, the target request being a request to detect the growth area of ​​the target mold; and the processing unit 302 is used to calculate the third image according to the target request, obtain second area data, and send the second area data to the target user.

[0069] In one possible implementation, the processing unit 302 is used to take pictures of the cultured target bacterial strain to obtain historical images; process the historical images to obtain second bacterial strain information; determine the quantity of the second bacterial strain based on the second bacterial strain information; and construct a preset bacterial strain model. The preset bacterial strain model includes a first correspondence relationship and a second correspondence relationship. The first correspondence relationship is the correspondence between the historical images and the second bacterial strain information, and the second correspondence relationship is the correspondence between the second bacterial strain information and the quantity of the second bacterial strain.

[0070] In one possible implementation, the confirmation unit 303 is used to confirm that the target mold is in an abnormal state when the number of the first bacterial species is not equal to the preset number of bacterial species, and to generate an early warning message based on the abnormal state so as to send the early warning message.

[0071] It should be noted that the above embodiments of the apparatus are only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0072] This application also discloses an electronic device. (See reference...) Figure 4 , Figure 4 This application provides a schematic diagram of the structure of an electronic device. The electronic device 400 may include: at least one processor 401, at least one network interface 404, a user interface 403, a memory 405, and at least one communication bus 402.

[0073] The communication bus 402 is used to enable communication between these components.

[0074] The user interface 403 may include a display screen and a camera. Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.

[0075] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0076] The processor 401 may include one or more processing cores. The processor 401 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 405, and by calling data stored in memory 405. Optionally, the processor 401 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 401 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and application requests; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 401 and may be implemented as a separate chip.

[0077] The memory 405 may include random access memory (RAM) or read-only memory. Optionally, the memory 405 may include a non-transitory computer-readable storage medium. The memory 405 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 405 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 405 may also be at least one storage device located remotely from the aforementioned processor 401.

[0078] like Figure 4 As shown, the memory 405, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for mold test detection based on image processing.

[0079] exist Figure 4In the electronic device 400 shown, the user interface 403 is mainly used to provide an input interface for the user and to obtain the user input data; while the processor 401 can be used to call the application program for mold test detection based on image processing stored in the memory 405. When executed by one or more processors, the electronic device performs one or more of the methods described in the above embodiments.

[0080] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0081] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0082] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some service interfaces; indirect couplings or communication connections between devices or units may be electrical or other forms.

[0083] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0084] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0085] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0086] The foregoing description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Those skilled in the art will readily conceive of other embodiments of this disclosure upon considering the specification and practical application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure.

Claims

1. A method for detecting mold based on image processing, characterized in that, When applied to a server, the method includes: Acquire a first image, which is an image of the target mold in a petri dish; The first image is preprocessed to obtain a second image; specifically, the preprocessing of the first image to obtain a second image includes: performing median filtering on the first image to obtain a first sub-image; The first sub-image is contrast-enhanced to obtain a second sub-image; the second sub-image is extracted using a preset detection method to obtain a mold region image; the mold region image is binarized to obtain a binary image; a set of contour maps are determined from the binary image, each contour map being a multi-connected region in the binary image with a grayscale value of a target value; a target region is determined in the first sub-image, wherein the target region includes the region in the first sub-image corresponding to each contour map in the set of contour maps; the target region is cropped to obtain the second image; The second image is input into the preset bacterial strain model for matching to obtain the number of the first bacterial strain. Before inputting the second image into the preset bacterial strain model for matching to obtain the number of the first bacterial strain, the preset bacterial strain model needs to be constructed, which specifically includes: taking pictures of the cultured target bacterial strain to obtain historical images. The historical images are processed to obtain bacterial species features, which are then integrated into second bacterial species information. The second bacterial species information is a dataset containing bacterial species names and multiple feature parameters. The number of second bacterial species is determined based on the second bacterial species information, and the preset bacterial species model is constructed. The preset bacterial species model includes a first correspondence relationship and a second correspondence relationship. The first correspondence relationship is the correspondence between the historical images and the second bacterial species information, and the second correspondence relationship is the correspondence between the second bacterial species information and the number of second bacterial species. The system determines whether the quantity of the first bacterial strain is equal to the preset quantity of bacterial strains, where the preset quantity of bacterial strains is the number of different types of bacteria corresponding to the strains placed in the culture dish beforehand. When the quantity of the first bacterial strain is equal to the preset quantity of bacterial strains, the target mold is confirmed to be in a normal state, so that the target mold can be tested according to the normal state. When the quantity of the first bacterial strain is not equal to the preset quantity of bacterial strains, the target mold is confirmed to be in an abnormal state, and an early warning message is generated according to the abnormal state, so that the early warning message can be sent.

2. The method according to claim 1, characterized in that, Determining the target region in the first sub-image specifically includes: Target contour maps are selected from the set of contour maps. The target contour maps include contour maps whose first area data is within a preset area range. The first area data is data calculated from each of the contour maps. Determine the target region corresponding to the target contour map in the first sub-image.

3. The method according to claim 2, characterized in that, The step of cropping the target region to obtain the second image specifically includes: A target sub-image is determined based on the target region, and the target sub-image is the image corresponding to the target region in the first sub-image; The target sub-image is cropped using the circumscribed matrix method to obtain the second image.

4. The method according to claim 1, characterized in that, After confirming that the target mold is in a normal state when the quantity of the first bacterial strain equals the preset bacterial strain quantity, so that the target mold can be tested according to the normal state, the method further includes: At preset time intervals, a third image corresponding to the target mold is acquired; Receive a target request sent by a target user, wherein the target request is a request to detect the growth area of ​​the target mold; The third image is calculated according to the target request to obtain second area data, and the second area data is sent to the target user.

5. A mold testing and detection device based on image processing, characterized in that, The device is a server, which includes an acquisition unit (301), a processing unit (302), and a confirmation unit (303). The acquisition unit (301) acquires a first image, which is an image of the target mold in the petri dish. The processing unit (302) preprocesses the first image to obtain a second image. Specifically, the preprocessing of the first image to obtain the second image includes: performing median filtering on the first image to obtain a first sub-image; enhancing the contrast of the first sub-image to obtain a second sub-image; extracting the second sub-image using a preset detection method to obtain a mold region image; binarizing the mold region image to obtain a binary image; determining a set of contour maps from the binary image, each contour map being a multi-connected region in the binary image with a grayscale value of a target value; determining a target region in the first sub-image, wherein the target region includes regions in the first sub-image corresponding to each contour map in the set of contour maps; cropping the target region to obtain the second image; and inputting the second image into a preset fungal strain model for matching to obtain a first fungal strain. The number of species is determined; it is then determined whether the number of the first species is equal to the number of preset species, where the preset species number is the number of species corresponding to the species placed in the culture dish beforehand. Before inputting the second image into the preset species model for matching to obtain the number of the first species, the preset species model needs to be constructed. Specifically, this includes: taking pictures of the target species after cultivation to obtain historical images; processing the historical images to obtain species features; integrating the species features into second species information, where the second species information is a dataset containing species names and multiple feature parameters; determining the number of the second species based on the second species information; and constructing the preset species model, where the preset species model includes a first correspondence and a second correspondence, where the first correspondence is the correspondence between the historical images and the second species information, and the second correspondence is the correspondence between the second species information and the number of the second species. The confirmation unit (303) confirms that the target mold is in a normal state when the number of the first bacterial species is equal to the number of preset bacterial species, so as to conduct an experiment on the target mold according to the normal state; when the number of the first bacterial species is not equal to the number of preset bacterial species, it confirms that the target mold is in an abnormal state, generates an early warning message according to the abnormal state, and sends the early warning message.

6. An electronic device, characterized in that, The device includes a processor (401), a memory (405), a user interface (403), and a network interface (404). The memory (405) is used to store instructions. The user interface (403) and the network interface (404) are used to communicate with other devices. The processor (401) is used to execute the instructions stored in the memory (405) to cause the electronic device (400) to perform the method as described in any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Aspergillus niger suitability test strain and preparation method thereof

    CN109797108A

  • Bacterial morphology identification system

    CN110618130A

  • Target colony growth characteristic identification method

    CN111178173A