Mould test detection method and device based on image processing

Through image processing technology, the inaccuracy problem of visual evaluation method in mold detection is solved, and the automatic identification of mold species and quantity is realized, the accuracy and efficiency of detection is improved, and real-time growth monitoring and early warning functions are provided.

CN119313924AActive Publication Date: 2025-01-14NANJING SUSHI GUANGBO ENVIRONMENTAL RELIABILITY LAB CO LTD
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202411395165.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-01-14
Estimated Expiration
2044-10-08

AI Technical Summary

Technical Problem

The prior art relies on visual evaluation methods in mold detection, which has inaccuracy and complexity in identifying mold species and quantity. Especially in the case of coexistence of multiple bacterial species, it is difficult to accurately identify mold species and growth status.

Method used

Using image processing-based detection method, images in petri dishes are acquired for pre-processing, including median filtering, contrast enhancement and binary processing, to identify the mold area, and input the processed images into the preset strain model for matching , automatically identify mold types and quantities.

Benefits of technology

It improves the accuracy and efficiency of mold species identification, reduces artificial misjudgment, realizes the automation and accuracy of mold species identification, and can monitor the growth of mold species in real time and generate warning prompts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313924A_ABST
    Figure CN119313924A_ABST
Patent Text Reader

Abstract

The invention discloses a mould test detection method and device based on image processing, and relates to the technical field of mould detection. In the method, a first image is obtained, and the first image is an image obtained by shooting a target mould in a culture dish; preprocessing the first image to obtain a second image; inputting the second image into a preset strain model for matching to obtain a first strain number; judging whether the first strain number is equal to a preset strain number or not, wherein the preset strain number is a variety number corresponding to strains placed in a culture dish in advance; and when the first strain number is equal to the preset strain number, determining that the target mould is in a normal state, so as to test the target mould according to the normal state. By implementing the technical scheme provided by the invention, the interference when various strains are directly observed by human eyes is effectively solved, and the accuracy of mould type identification is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of mold detection, and in particular to a mold test detection method and device based on image processing. Background Art

[0002] Mold is a widely distributed microorganism with strong reproductive capacity and adaptability. It can rapidly multiply and spread through the air, especially in high humidity and suitable temperature environments. Its potential harm is 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 the early stages and pose a serious threat to consumer health. Therefore, effective management of mold problems is crucial to ensuring the quality of agricultural products and public health.

[0003] As consumers' hygiene standards for products have improved, the building materials industry has also responded positively, developing and promoting products with antibacterial and anti-mildew properties. These innovative technologies have been widely used in paints, coatings, decorative materials, door and window systems, bathroom facilities, and even antibacterial cooling towers, plastic pipes, and resin products in water treatment systems, effectively improving the health standards of the living environment. At present, the field of mold detection mainly relies on visual evaluation methods, that is, the mold growth covers at least 90% of the control strip area as the basic basis for judging the effectiveness of the test. However, given the extreme richness of mold species and the complex intertwined growth patterns during the cultivation process, naked eye observation alone has significant deficiencies in comprehensive coverage and accurate distinction. The coexistence of multiple strains is extremely common in mold tests. The growth states between them are subtle and the interactions are complex, which greatly limits the ability of the human eye to directly observe and analyze the growth details of each strain, which may lead to inaccurate identification results of mold species.

[0004] Therefore, there is an urgent need for a mold test detection method and device based on image processing that can solve the above technical problems. Summary of the invention

[0005] The present application provides a mold test detection method and device based on image processing. The method performs automatic image processing, and then inputs the processed image into a preset strain model for matching to obtain the number of strains. The mold species is determined based on the number of strains, which effectively solves the interference caused by direct observation of various strains by the human eye and improves the accuracy of mold species identification.

[0006] In a first aspect, the present application provides a mold test detection method based on image processing, which is applied to a server, and the method includes: obtaining a first image, the first image being an image obtained by photographing a target mold in a culture dish; preprocessing the first image to obtain a second image; inputting the second image into a preset strain model for matching to obtain a first strain quantity; judging whether the first strain quantity is equal to a preset strain quantity, the preset strain quantity is the number of species corresponding to the strains pre-placed in the culture dish; when the first strain quantity is equal to the preset strain 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, the target mold is photographed to obtain a first image, and then the first image is preprocessed to obtain a second image. The second image is then input into a preset strain model for matching to obtain the first strain quantity. Based on the preset strain model, the type and quantity of mold in the second image can be quickly and accurately identified, greatly shortening the identification time. The first strain quantity is then compared with the preset strain quantity to ensure the accuracy of the identification result. The entire processing process is automated to avoid errors caused by human misjudgment and improve the accuracy of mold species identification.

[0008] Optionally, the first image is preprocessed to obtain a second image; specifically including: performing median filtering on the first image to obtain a first sub-image; performing contrast enhancement on the first sub-image to obtain a second sub-image; extracting the second sub-image using a preset detection method to obtain a mold area image; binarizing the mold area 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 whose grayscale value is a target value; determining a target area in the first sub-image, wherein the target area includes an area in the first sub-image corresponding to each contour map in a set of contour maps; and intercepting the target area to obtain a second image.

[0009] By adopting the above technical solution, the first image is subjected to median filtering, which can effectively suppress the noise in the image and reduce the influence of the noise on the image quality. The first sub-image after filtering is then contrast enhanced to obtain the second sub-image. The brightness difference between the mold area and the background area in the image can be made more obvious, thereby improving the quality and clarity of the image. The second sub-image is then extracted using a preset detection method to obtain a mold area image. The mold area image is binarized to obtain a binary image. A set of contour maps are determined from the binary image. These contour maps represent multi-connected areas in the binary image whose grayscale values ​​are target values. The target area is determined in the first sub-image, and the target area is intercepted to obtain the second image. Unnecessary background information is removed to achieve accurate extraction of the mold area.

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

[0011] By adopting the above technical solution, the area of ​​a group of contour maps is calculated, and the contour maps with the first area data within the preset area range are screened out as target contour maps, so that the mold areas that meet the specific size standards can be accurately identified. This screening method is based on the actual characteristics of mold growth and effectively excludes areas of non-target mold. After determining the target contour map, the target area corresponding to the target contour map in the first sub-image is further determined; by accurately screening and locating the target area, image data is provided for subsequent mold species identification.

[0012] Optionally, the target area is intercepted to obtain the second image, specifically including: determining a target sub-image according to the target area, the target sub-image being an image corresponding to the target area in the first sub-image; and intercepting the target sub-image using an external matrix method to obtain the second image.

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

[0014] Optionally, when the number of the first strains is equal to the preset number of strains, it is confirmed that the target mold is in a normal state, so that the target mold is tested according to the normal state, and the method also includes: obtaining a third image corresponding to the target mold at a preset time interval; receiving a target request sent by the target user, the target request is a request for detecting 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 obtained at preset time intervals to realize real-time monitoring of the mold growth process, receive a detection request from a target user, calculate the third image according to user needs, and accurately obtain 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 species model for matching and obtaining the first bacterial species quantity, it is necessary to construct the preset bacterial species model, specifically including: photographing the cultured target bacterial species to obtain a historical image; processing the historical image to obtain second bacterial species information; determining the second bacterial species quantity based on the second bacterial species information, and constructing the preset bacterial species model, the preset bacterial species model including a first corresponding relationship and a second corresponding relationship, the first corresponding relationship being the corresponding relationship between the historical image and the second bacterial species information, and the second corresponding relationship being the corresponding relationship between the second bacterial species information and the second bacterial species quantity.

[0017] By adopting the above technical solution, the cultured fungi are photographed to obtain historical images, the types of mold are identified, and the number of fungi is determined based on the mold information. By constructing a preset fungi model, the automatic processing of fungi species identification and quantity statistics can be achieved. When the first image is input into the preset fungi model, it is automatically compared with the historical images in the model, and the type and number of the mold are calculated based on the corresponding relationship. The entire process can be completed without human 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 early warning prompt information according to the abnormal state, so as to send the early warning prompt information.

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

[0020] In a second aspect of the present application, a mold test detection device based on image processing is provided, the device is a server, and the server includes an acquisition unit, a processing unit and a confirmation unit; the acquisition unit acquires a first image, the first image is an image obtained by photographing the target mold in the culture dish; the processing unit pre-processes the first image to obtain a second image; the second image is input into a preset bacterial species model for matching to obtain the first bacterial species quantity; it is determined whether the first bacterial species quantity is equal to the preset bacterial species quantity, the preset bacterial species quantity is the number of species corresponding to the bacterial species pre-placed in the culture dish; the confirmation unit confirms that the target mold is in a normal state when the first bacterial species quantity is equal to the preset bacterial species quantity, so as to test the target mold 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; 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 area image; perform binarization on the mold area image to obtain a binary image; determine a set of contour maps from the binary image, each contour map being a multiply connected region in the binary image whose grayscale value is a target value; determine a target area in the first sub-image, wherein the target area includes an area in the first sub-image corresponding to each contour map in a set of contour maps; and intercept the target area to obtain a second image.

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

[0023] Optionally, the processing unit is used to determine a target sub-image according to the target area, where the target sub-image is an image corresponding to the target area in the first sub-image; and to intercept the target sub-image using an external matrix to obtain a second image.

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

[0025] Optionally, the processing unit is used to photograph the target bacterial species after cultivation to obtain a historical image; process the historical image to obtain second bacterial species information; determine the number of second bacterial species based on the second bacterial species information, and construct a preset bacterial species model, which includes a first corresponding relationship and a second corresponding relationship, the first corresponding relationship being the corresponding relationship between the historical image and the second bacterial species information, and the second corresponding relationship being the corresponding relationship between the second bacterial species information and the number of second bacterial species.

[0026] Optionally, the confirmation unit is used to confirm that the target mold is in an abnormal state when the number of the first strain is not equal to the preset strain number, and generate early warning prompt information according to the abnormal state so as to send the early warning prompt information.

[0027] In a third aspect of the present application, an electronic device is provided, which includes 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, so that an electronic device executes any one of the methods described above in the present application.

[0028] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any one of the above methods of the present application is executed.

[0029] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. Take a photo of the target mold to obtain a first image, then pre-process the first image to obtain a second image, and then input the second image into a preset strain model for matching to obtain the first strain quantity. Based on the preset strain model, the type and quantity of mold in the image can be quickly and accurately identified, greatly shortening the identification time. Then, the first strain quantity is compared with the preset strain quantity to ensure the accuracy of the identification result. The entire processing process is automated to avoid errors caused by human misjudgment and improve the accuracy of mold species identification.

[0030] 2. Performing median filtering on the first image can effectively suppress the noise in the image and reduce the impact of noise on the image quality. Then, performing contrast enhancement on the filtered first sub-image to obtain a second sub-image can make the brightness difference between the mold area and the background area in the image more obvious, thereby improving the quality and clarity of the image. Then, using a preset detection method to extract the second sub-image to obtain a mold area image, binarizing the mold area image to obtain a binary image, and determining a set of contour maps from the binary image. These contour maps represent multi-connected areas whose grayscale values ​​in the binary image are target values. Determine the target area in the first sub-image, intercept the target area, and obtain the second image. Remove unnecessary background information and achieve accurate extraction of the mold area. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 It is a schematic diagram of a flow chart of a mold test detection method based on image processing provided in an embodiment of the present application; Figure 2 This is a schematic diagram of a scene of a mold test detection method based on image processing provided in an embodiment of the present application; Figure 3 It is a structural schematic diagram of a mold test detection device based on image processing provided in an embodiment of the present application; Figure 4 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.

[0032] Explanation of the reference numerals: 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 DESCRIPTION

[0033] In order to enable technicians in this field 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 in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0034] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.

[0035] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0036] Mold is a widely distributed microorganism with strong reproductive capacity and adaptability. It can rapidly multiply and spread through the air, especially in high humidity and suitable temperature environments. Its potential harm is 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 the early stages and pose a serious threat to consumer health. Therefore, effective management of mold problems is crucial to ensuring the quality of agricultural products and public health.

[0037] As consumers' hygiene standards for products have improved, the building materials industry has also responded positively, developing and promoting products with antibacterial and anti-mildew properties. These innovative technologies have been widely used in paints, coatings, decorative materials, door and window systems, bathroom facilities, and even antibacterial cooling towers, plastic pipes, and resin products in water treatment systems, effectively improving the health standards of the living environment. At present, the field of mold detection mainly relies on visual evaluation methods, that is, the mold growth covers at least 90% of the control strip area as the basic basis for judging the effectiveness of the test. However, given the extreme richness of mold species and the complex intertwined growth patterns during the cultivation process, naked eye observation alone has significant deficiencies in comprehensive coverage and accurate distinction. The coexistence of multiple strains is extremely common in mold tests. The growth states between them are subtle and the interactions are complex, which greatly limits the ability of the human eye to directly observe and analyze the growth details of each strain, which may lead to inaccurate identification results of mold species.

[0038] Therefore, how to solve the interference of human eyes when directly observing various types of mold and improve the accuracy of mold species identification is a problem that needs to be solved urgently. The mold test detection method based on image processing provided in the embodiment of the present application is applied to the server. The server of the present application can be a platform for providing mold species detection. Figure 1 is a flow chart of a mold test detection method based on image processing provided in an embodiment of the present application, with reference to Figure 1 The method includes the following steps S101-S105.

[0039] S101: Acquire a first image, where the first image is an image obtained by photographing the target mold in the culture dish.

[0040] In the above S101, the test personnel first place the target fungus in a culture dish for culture. After 7 days of the mold test, the control strip used for the test is taken out. The control strip contains the growth of the target mold in the 7-day test. The control strip is placed under the microscope field of view, and then connected to a high-definition camera or other shooting equipment to ensure that the morphology and details of the target mold in the control strip can be clearly captured. When shooting, it is necessary to ensure that the shooting environment is well-lit and uniform to avoid the influence of shadows and reflections on the image quality. At the same time, keep the culture dish clean and stable to prevent shaking during shooting. Aim the camera at the target mold in the culture dish, adjust the focus and exposure, and ensure that the image is clear and the color is accurate. Press the shutter to shoot and obtain the first image. When shooting, it is also necessary to select a resolution, and a higher resolution is preferred for shooting. For example, the resolution can be selected as 2560*1440.

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

[0042] In the above S102, after acquiring the first image, the first image is preprocessed to obtain the second image; specifically, the method includes: performing median filtering on the first image to obtain a first sub-image; performing contrast enhancement on 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; performing binarization on the mold region image to obtain a binary image; determining a set of contour images from the binary image, each contour image being a multi-connected region whose grayscale value is a target value in the binary image; determining a target region in the first sub-image, wherein the target region includes a region in the first sub-image corresponding to each contour image in a set of contour images; and intercepting the target region to obtain a second image. Specifically, first, the first image is subjected to median filtering. Median filtering is a nonlinear filtering technique based on sorting statistics theory, which can effectively suppress noise in the image, especially salt and pepper noise, while protecting edge information. It is achieved by replacing the value of a pixel point with the median value of the pixel value in the neighborhood of the point. When median filtering is usually used, a filter 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 details of the image. A larger window can better suppress noise, but may blur the image details; a smaller window may not completely remove noise. For each pixel in the first image, sort the pixel values ​​of its neighborhood (i.e., the pixels within the filter window), and then select the sorted median as the new value of the pixel. Traverse all pixels in the image, complete the entire median filtering process, and obtain the first sub-image. Check the first sub-image to confirm whether the noise is effectively suppressed and whether the edge information is retained. After obtaining the first sub-image, contrast enhancement is performed on the first sub-image. Contrast enhancement aims to increase the brightness difference between the mold area and the background area in the image to make the image clearer. Common contrast enhancement methods include histogram equalization, adaptive histogram equalization, contrast boosting, and nonlinear contrast enhancement algorithms (such as gamma correction). According to the specific characteristics of the first sub-image (such as brightness distribution, noise level, etc.), select a suitable contrast enhancement method. For example, if the image is overall dark or lacks contrast, histogram equalization or contrast boosting can be selected. For the selected contrast enhancement method, some parameters may need to be adjusted to achieve the best effect. For example, in histogram equalization, different histogram normalization ranges may need to be set. The selected contrast enhancement method is performed on the first sub-image to obtain the second sub-image. The second sub-image is then extracted using a preset detection method to obtain a mold area image. At this time, the preset detection method refers to the Robert operator, which is an edge detection operator commonly used in image processing and computer vision. Its main principle is to detect edge information in the image by performing differential calculations on the grayscale values ​​in the neighborhood around the pixel point in the image.That is, the gradient of the grayscale value in the second sub-image is calculated using the Robert operator, and then the edge of the mold area is extracted, and then edge detection is performed to form a mold area image. The mold area image is then binarized. Binarization is a process of converting an image to contain only two grayscale levels (usually 0 and 255). In the mold area image, this usually means setting the mold area (or other area of ​​interest) to white (255) and the background to black (0). Select a suitable threshold for binarization. The choice of threshold depends on the brightness difference between the mold area and the background. The optimal threshold can usually be determined by experimental method or automatic threshold selection algorithm. The grayscale value of each pixel of the mold area image is compared with 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 area. All pixels in the image are traversed to complete the binarization process to obtain a binary image. Check the binary image to confirm whether the mold area is accurately extracted and converted to a white area and the background is converted to a black area. In addition to binary images obtained by binarization, the Otsu method can also be used to process the mold area image to obtain a binary image. The Otsu method, also known as the maximum between-class variance method (OTSU) or the maximum between-class threshold method, is an adaptive threshold determination method widely used in image processing. The basic idea of ​​the Otsu method is to use a threshold to divide the pixels in the image into two categories: the grayscale values ​​of the pixels in one category are all less than the threshold and are regarded as the background; the grayscale values ​​of the pixels in the other category are all greater than or equal to the threshold and are regarded as the target, that is, mold. By calculating the variance of the grayscale values ​​of these two categories of pixels and finding the threshold that maximizes the variance, the optimal threshold is obtained. The larger the variance, the greater the difference between the background and the target, and the smaller the probability of misclassification. Then, the mold area image is divided according to the optimal threshold, and the background is represented by a grayscale value of 1 and the mold is represented by a grayscale value of 0 to obtain a binary image. After obtaining the binary image, the binary image can be processed to detect a set of contour maps. Each contour map can be understood as a multi-connected region whose grayscale value in the binary image is the target value. The multi-connected region includes a four-connected region or an eight-connected region. The specific selection of which multi-connected region can be based on the arrangement of the grayscale values ​​in the binary image. A four-connected region means that from a certain point, other points in the region can only be reached by moving in the four directions of up, down, left, and right, and the boundary of the region cannot be crossed. An eight-connected region means that in addition to the four directions of up, down, left, and right, it can also move in the diagonal direction (upper left, upper right, lower left, and lower right), and it also cannot cross the boundary of the region. At this time, a certain point refers to a point in the binary image whose grayscale value is the target value. The target value is set to 0, that is, the points in the binary image whose grayscale value is 0 are connected by a four-connected region or an eight-connected region. After completing a four-connected region or an eight-connected region, a contour map can be obtained. After the connection is completed, each contour map is summarized into a group of contour maps.Based on the actual situation of binary images, a set of contour images includes one or more contour images. Figure 2 As shown in the figure, the mold area image is binarized to obtain a binary image. At this time, the binary image is Figure 2 The first image in the figure, and then connect the points with gray value 0 in the first image by multiply connected regions to obtain a set of contour groups. Figure 2 A set of contour maps includes contour map a, contour map b, contour map c and contour map d, and then the gray values ​​except the target value in the binary image are eliminated, and only one set of contour maps is retained after elimination.

[0043] In addition, after determining a group of contour images from the binary image, determining the target area in the first sub-image specifically includes: selecting a target contour image from a group of contour images, the target contour image includes a contour image whose first area data is within a preset area range, and the first area data is data obtained by calculating each contour image; determining the target area corresponding to the target contour image in the first sub-image. Specifically, all contour images in a group of contour images can be extracted first, and then each detected contour can be calculated. The area calculation function provided by the image database can be used to calculate the area of ​​each contour, that is, the first area data, and one first area data corresponds to one contour image. Then a preset area range is set, and the preset area range is set based on the minimum area and maximum area of ​​the target mold growth. Traverse all calculated contour first area data, and regard the contour whose first area data is within the preset range as the target contour image. Since the target contour image is currently a binary image and mold cannot be identified, the target contour image needs to be mapped to the first sub-image, and coordinate conversion may be required. This usually involves converting the coordinates of the target contour image into coordinates in the first sub-image. Once the target contour map is mapped into the first sub-image, the area covered by it is the target area, and the boundary points of the contour can also be used to define the boundary of the target area. The target area is output in an appropriate form, such as being marked on the first sub-image.

[0044] For example, if the preset area range is set to 100-2000, obtain the first area data corresponding to A in a set of contour maps. 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 strain. This is just an example and is not too limited.

[0045] Further, the target area is intercepted to obtain a second image, which specifically includes: determining a target sub-image according to the target area, the target sub-image is the image corresponding to the target area in the first sub-image; intercepting the target sub-image using an external matrix method to obtain a second image. Specifically, in the first sub-image, the target area is accurately located according to the coordinates of the target area. Then, the region cropping function in the image processing library is used to extract the corresponding target sub-image from the first sub-image according to the coordinate information of the target area. This step usually involves a slicing operation of the image matrix, that is, selecting a pixel matrix corresponding to the target area. The external matrix usually refers to the smallest rectangular frame that can completely contain the target area. In image processing, this can be achieved by calculating the minimum external rectangle of the target area. Using the cropping function in the image processing library, the target sub-image is cropped according to the coordinates of the calculated minimum external rectangle. This step is actually a further accurate interception on the extracted target sub-image to remove possible redundant edges and ensure that the second image contains only the minimum necessary part of the target area. If the target area is tilted, that is, its minimum bounding rectangle is not horizontal, then it may be necessary to rotate the target sub-image first so that the bounding rectangle becomes horizontal, and then crop it. The rotation operation involves calculating the rotation angle, constructing a rotation matrix, and using the rotation function in the image processing library to implement it. The intercepted image is output as the second image, which is composed of multiple sub-images and contains the clear outline and feature information of the target mold.

[0046] S103: Input the second image into a preset bacterial species model for matching to obtain the first bacterial species quantity.

[0047] In the above S103, before the second image is input into the preset strain model for matching and the first strain quantity is obtained, a preset strain model needs to be constructed, which specifically includes: photographing the cultured target strain to obtain a historical image; processing the historical image to obtain the second strain information; determining the second strain quantity according to the second strain information, and constructing the preset strain model, wherein the preset strain model includes a first corresponding relationship and a second corresponding relationship, wherein the first corresponding relationship is the corresponding relationship between the historical image and the second strain information, and the second corresponding relationship is the corresponding relationship between the second strain information and the second strain quantity. Specifically, a machine learning model capable of identifying mold species is pre-trained, and the preset strain model contains a large amount of image data of known mold species as a training set. First, the currently known strains are obtained, the known strains are standardizedly cultured in an experimental environment, and they are regularly photographed at different time periods using a high-resolution microscope to obtain a large number of high-quality strain growth images. In order to ensure the diversity of the data set, the culture conditions, such as light intensity, humidity and temperature, are deliberately changed during the shooting process to capture the growth state of the strains in different environments. Taking the cultivation of one of the strains as an example, the target strain is first cultivated. After the cultivation is completed, the cultivated target strain is placed in the shooting area to ensure that the strain is evenly distributed or clearly visible. Each historical image is assigned a unique name or number for subsequent management and query. The historical image is then subjected to preprocessing operations such as denoising and contrast enhancement to improve image quality. Color correction and grayscale processing can also be performed to better extract strain information. Image processing algorithms (such as edge detection, texture analysis, morphological processing, etc.) are then used to extract strain features in the image. Features may include the shape, size, color, texture, etc. of the strain. The extracted strain features are integrated into the second strain information. The second strain information is usually a data set containing the strain name and multiple feature parameters. Then, according to the feature parameters in the second strain information, the number of the second species of mold contained in the current second strain information is determined, that is, one strain corresponds to one number. Each historical image is associated with its corresponding second strain information to form a first corresponding relationship. Then, according to the quantity data in the second strain information, a corresponding relationship between the second strain information and the second strain quantity is established. This can also be achieved through data structures such as data tables and databases. The first corresponding relationship and the second corresponding relationship are integrated into a preset strain model. The model can automatically output the corresponding second strain quantity information according to the input historical image.

[0048] After building the preset strain model, the preset strain model needs to be trained. The training process is as follows: First, load the custom mold image dataset. These images have been annotated by tools such as LabelImg, including the type and location (bounding box) of the mold. In order to improve the generalization ability of the model, the training data is enhanced, such as random cropping, rotation, scaling, color jittering, etc., to increase the diversity of the dataset. The dataset is divided into training set, test set and validation set in a ratio of 8:1:1 to ensure that the performance of the model on different datasets can be evaluated. YOLOv5 is selected as the target detection model because it has good performance in both speed and accuracy. According to the characteristics of mold images, the network structure of YOLOv5 is optimized, such as adding detection layers, adding CBAM modules, and using NWD loss functions, to improve the model's detection ability for small targets. Set training parameters such as learning rate, weight decay, batch size, and number of iterations to control the training process. On a computer with a high-performance GPU, use the PyTorch framework and CUDA acceleration for training. The training data is fed into the model in batches, the loss is calculated through forward propagation, and then the model parameters are updated through back propagation. During the training process, an early stopping mechanism is used to avoid overfitting, that is, the training is stopped when the performance on the validation set begins to decline. During the training process, the weights and configurations of the model are saved regularly for subsequent evaluation and deployment. After the training is completed, the performance of the model is evaluated using the test set, including indicators such as mean average precision (mAP), accuracy (Precision) and recall (Recall). After the training is completed, the second image is input into the preset strain model. Since the second image is composed of multiple sub-images, one sub-image corresponds to the target sub-image. Each sub-image on the second image is compared and matched with the data of the training set in the preset strain model in turn to determine the type of the target mold in the second image. After the mold type in the second image is determined, the number of mold types is calculated to obtain the number of the first strain.

[0049] For example, the second image is input into a preset strain model. When there are four sub-images in the second image, the four sub-images are compared with the training set images in the preset strain model in turn to determine which mold species each sub-image belongs to. After the mold species is determined, the number of mold species is calculated to obtain the first strain quantity, and one strain quantity corresponds to one mold species.

[0050] S104: Determine whether the first bacterial species quantity is equal to a preset bacterial species quantity, where the preset bacterial species quantity is the number of species corresponding to the bacterial species pre-placed in the culture dish.

[0051] In the above S104, when the mold species in the second image is identified as the first species number, the species and number of the mold species placed in the culture dish in advance need to be determined in advance, that is, the preset species number. The first species number is compared with the preset species number.

[0052] S105: When the number of the first bacterial species is equal to the preset bacterial species number, it is confirmed that the target mold is in a normal state, so that the target mold is tested according to the normal state.

[0053] In the above S105, if the number of the first strain is equal to the preset strain number, it is confirmed that the target mold is in a normal state. At this time, subsequent test operations can be performed on the target mold according to the normal state, such as observing its growth process, measuring its metabolites, etc.

[0054] In addition, when the number of the first strain is not equal to the preset number of strains, it is confirmed that the target mold is in an abnormal state, and an early warning prompt information is generated according to the abnormal state so that the early warning prompt information can be sent. If the number of the first strain is not equal to the preset number of strains, it indicates that the target mold may be in an abnormal state (such as contamination, abnormal growth, etc.). At this time, an early warning prompt information should be generated and corresponding treatment measures should be taken, such as re-cultivation, checking the culture environment, etc. When sending the early warning prompt information, it is necessary to clarify the target audience of the early warning prompt information, that is, the person or organization who needs to receive and pay attention to the information. This may include laboratory staff, management personnel, regulatory authorities, suppliers or customers, etc. Send the early warning prompt information to the target audience according to the selected channel and format. During the sending process, the integrity and timeliness of the information should be ensured to avoid information loss or delay.

[0055] In a possible implementation, after the target mold is tested and the test is completed, the growth of the target mold is detected, so as to understand the growth of various molds in this test and provide improvement suggestions for subsequent materials, which specifically include: obtaining a third image corresponding to the target mold at a preset interval; receiving a target request sent by a target user, the target request is a request to detect the growth area of ​​the target mold; calculating the third image according to the target request to obtain the second area data, and sending the second area data to the target user. Specifically, according to the test requirements, a fixed time interval is set to obtain the image after the target mold is completed. This time interval should be set based on the cycle of the mold test so that the changes of the mold can be captured in time after the target mold is finished. An appropriate image acquisition device (such as a camera, a microscope camera, etc.) can be used to aim at the target mold for shooting. Ensure that the settings of the image acquisition device (such as resolution, exposure time, focus, etc.) are consistent, and then output the acquired image as the third image. Then receive the target request sent by the target user, the target user refers to the person who conducts the mold test. The server receives the request sent by the user. Parse the request, that is, detect the growth of the target mold in the third image to output the area data. Perform necessary preprocessing operations on the third image, such as grayscale, filtering and denoising, contrast enhancement, etc., to improve image quality and reduce computational complexity. Use image processing algorithms (such as threshold segmentation, edge detection, contour extraction, etc.) to detect the mold area in the image. Then identify and extract the mold area based on its characteristics (such as color, texture, shape, etc.). Calculate the area of ​​the detected mold area. This usually involves counting the pixels in the area or using the area calculation function provided by the image processing library. Format the calculated second area data into a format that is easy for users to understand (such as text, charts, etc.). That is, the mold growth ratio of a certain mold in the target mold. The detection and monitoring of the target mold growth area can be achieved, and the results can be fed back to the target user in a timely manner.

[0056] Using the above method, the original image is subjected to image denoising by using the median filtering technique in advance to obtain the original grayscale image. Median filtering is a commonly used nonlinear smoothing filtering method. By adjusting the pixels with large grayscale value differences of the surrounding pixels to a level close to the surrounding pixel values, isolated noise points are effectively eliminated and the signal-to-noise ratio of the image is improved. Then, after enhancing the contrast between the mold and the background, the Roberts operator is used to detect the edge of the image to accurately extract the mold area from the background. Subsequently, the Otsu method is used for automatic threshold binarization to convert the sample image into a binary image, and the contour area in each sample image is calculated. For areas that do not meet expectations, they are automatically filtered out, and finally the original grayscale image corresponding to the contour is intercepted using the circumscribed rectangle to obtain the processed image. The processed image is then input into the preset strain model for matching, the type of mold can be identified, and the type of mold is output to the user, which lays a solid foundation for the subsequent calculation of the growth area of ​​mold detection and ensures the accuracy and reliability of the detection results.

[0057] The present application also provides a mold test detection device based on image processing. Figure 3 is a schematic diagram of a mold test detection device based on image processing provided in an embodiment of the present application, with reference to Figure 3 The device is a server, and the server includes an acquisition unit 301, a processing unit 302 and a confirmation unit 303.

[0058] The acquisition unit 301 acquires a first image, where the first image is an image obtained by photographing the target mold in the culture dish.

[0059] The processing unit 302 pre-processes the first image to obtain a second image; inputs the second image into a preset bacterial species model for matching to obtain the first bacterial species quantity; and determines whether the first bacterial species quantity is equal to the preset bacterial species quantity, where the preset bacterial species quantity is the number of species corresponding to the bacterial species pre-placed in the culture dish.

[0060] The confirmation unit 303 confirms that the target fungus is in a normal state when the first fungus species quantity is equal to the preset fungus species quantity, so as to test the target fungus according to the normal state.

[0061] In one possible implementation, the processing unit 302 is used 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 area image; perform binarization on the mold area image to obtain a binary image; determine a set of contour maps from the binary image, each contour map being a multiply connected region in the binary image whose grayscale value is a target value; determine a target area in the first sub-image, wherein the target area includes an area in the first sub-image corresponding to each contour map in a set of contour maps; and intercept the target area to obtain a second image.

[0062] In a possible implementation, the processing unit 302 is used to filter out a target contour map from a group of contour maps, where the target contour map includes a contour map whose first area data is within a preset area range, and the first area data is data calculated for each contour map; and determine the target area corresponding to the target contour map in the first sub-image.

[0063] In a possible implementation, the processing unit 302 is configured to determine a target sub-image according to the target area, where the target sub-image is an image corresponding to the target area in the first sub-image; and to intercept the target sub-image using an external matrix to obtain a second image.

[0064] In a possible implementation, the acquisition unit 301 is used to acquire a third image corresponding to the target mold at a preset time interval; receive a target request sent by a target user, where the target request is 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 to obtain second area data, and send the second area data to the target user.

[0065] In one possible implementation, the processing unit 302 is used to photograph the cultured target bacterial species to obtain a historical image; process the historical image to obtain second bacterial species information; determine the number of second bacterial species based on the second bacterial species information, and construct a preset bacterial species model, which includes a first corresponding relationship and a second corresponding relationship, the first corresponding relationship being the corresponding relationship between the historical image and the second bacterial species information, and the second corresponding relationship being the corresponding relationship between the second bacterial species information and the number of second bacterial species.

[0066] In a 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 strain is not equal to the preset strain number, and to generate warning prompt information according to the abnormal state so as to send the warning prompt information.

[0067] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0068] The present application also discloses an electronic device. Figure 4 , Figure 4 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 .

[0069] The communication bus 402 is used to realize the connection and communication between these components.

[0070] The user interface 403 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 403 may also include a standard wired interface and a wireless interface.

[0071] The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0072] Among them, the processor 401 may include one or more processing cores. The processor 401 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 405, and calling data stored in the memory 405. Optionally, the processor 401 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 401 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application requests; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 401, and it can be implemented separately through a chip.

[0073] Among them, the memory 405 may include a random access memory (RAM) or a read-only memory (Read-Only Memory). Optionally, the memory 405 includes a non-transitory computer-readable storage medium. The memory 405 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 405 may include a program storage area and a data storage area, wherein the program storage area. Instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. can be stored; the data storage area can store data involved in the above-mentioned various method embodiments, etc. The memory 405 can also be optionally at least one storage device located away from the aforementioned processor 401.

[0074] like Figure 4 As shown, the memory 405 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.

[0075] exist Figure 4In the electronic device 400 shown, the user interface 403 is mainly used to provide an input interface for the user and obtain data input by the user; and 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 executes one or more methods described in the above embodiments.

[0076] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.

[0077] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0078] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

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

[0080] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0081] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, 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, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.

[0082] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, it will be easy for those skilled in the art to think of other embodiments of the present disclosure. This application is intended to cover any variation, use or adaptive change of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field that are not recorded in the present disclosure.

Claims

1. A mold test detection method based on image processing, characterized in that: Applied in a server, the method comprises: Acquire a first image, where the first image is an image obtained by photographing the target mold in the culture dish; Preprocessing the first image to obtain a second image; Inputting the second image into a preset bacterial species model for matching to obtain the first bacterial species quantity; Determine whether the first bacterial species quantity is equal to a preset bacterial species quantity, where the preset bacterial species quantity is the number of species corresponding to the bacterial species pre-placed in the culture dish; When the first bacterial species quantity is equal to the preset bacterial species quantity, it is confirmed that the target mold is in a normal state, so that the target mold is tested according to the normal state.

2. The method according to claim 1, characterized in that The preprocessing of the first image to obtain the second image specifically includes: Performing median filtering on the first image to obtain a first sub-image; performing contrast enhancement on the first sub-image to obtain a second sub-image; Extracting the second sub-image using a preset detection method to obtain a mold area image; Binarizing the mold region image to obtain a binary image; Determine a set of contour maps from the binary image, each of the contour maps being a multiply connected region in the binary image whose grayscale value is a target value; Determine a target area in the first sub-image, wherein the target area includes an area in the first sub-image corresponding to each of the contour images in the set of contour images; The target area is intercepted to obtain the second image.

3. The method according to claim 2, characterized in that The determining of the target area in the first sub-image specifically includes: Filtering out a target contour map from the group 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 obtained by calculating each of the contour maps; Determine the target area corresponding to the target contour image in the first sub-image.

4. The method according to claim 3, characterized in that The intercepting the target area to obtain the second image specifically includes: Determine a target sub-image according to the target area, where the target sub-image is an image corresponding to the target area in the first sub-image; The target sub-image is intercepted by using an external matrix method to obtain the second image.

5. The method according to claim 1, characterized in that When the first bacterial species quantity is equal to the preset bacterial species quantity, it is confirmed that the target mold is in a normal state, so as to test the target mold according to the normal state, the method further includes: At preset time intervals, obtaining a third image corresponding to the target mold; receiving a target request sent by a target user, wherein the target request is a request for detecting a 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.

6. The method according to claim 1, characterized in that Before inputting the second image into the preset bacterial species model for matching to obtain the first bacterial species quantity, the preset bacterial species model needs to be constructed, which specifically includes: Photograph the cultured target bacteria to obtain historical images; Processing the historical image to obtain second bacterial species information; The number of the second strain is determined according to the second strain information, and the preset strain model is constructed. The preset strain model includes a first correspondence relationship and a second correspondence relationship. The first correspondence relationship is the correspondence relationship between the historical image and the second strain information, and the second correspondence relationship is the correspondence relationship between the second strain information and the number of the second strain.

7. The method according to claim 1, characterized in that After determining whether the first bacterial species quantity is equal to a preset bacterial species quantity, the method further includes: When the first bacterial species quantity is not equal to the preset bacterial species quantity, it is confirmed that the target mold is in an abnormal state, and an early warning prompt information is generated according to the abnormal state, so as to send the early warning prompt information.

8. A mold test detection device based on image processing, characterized in that: The device is a server, and the server comprises an acquisition unit (301), a processing unit (302) and a confirmation unit (303); The acquisition unit (301) acquires a first image, wherein the first image is an image obtained by photographing the target mold in the culture dish; The processing unit (302) pre-processes the first image to obtain a second image; inputs the second image into a preset bacterial species model for matching to obtain a first bacterial species quantity; and determines whether the first bacterial species quantity is equal to a preset bacterial species quantity, wherein the preset bacterial species quantity is the number of species corresponding to the bacterial species pre-placed in the culture dish; The confirmation unit (303) confirms that the target mold is in a normal state when the first bacterial species quantity is equal to the preset bacterial species quantity, so as to test the target mold according to the normal state.

9. An electronic device, characterized in that: The electronic device (400) comprises a processor (401), a memory (405), a user interface (403) and a network interface (404), wherein the memory (405) is used to store instructions, the user interface (403) and the network interface (404) are used to communicate with other devices, and the processor (401) is used to execute the instructions stored in the memory (405) so that the electronic device (400) executes the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is executed.

Citation Information

Patent Citations

  • Mould test method

    CN107843595A

  • Candida albicans applicability testing strain and preparation method thereof

    CN109735459A

  • Aspergillus niger suitability test strain and preparation method thereof

    CN109797108A

  • Bacterial morphology identification system

    CN110618130A

  • Target colony growth characteristic identification method

    CN111178173A