Pig house colony classification detection method based on deep learning
By applying deep learning-based colony classification detection methods in pig houses, the problem that bacterial recognition and detection in the prior art relies on manual judgment is solved, efficient and accurate bacteria recognition and classification are achieved, and pig house management and economic benefits are improved.
Patent Information
- Application Number
- CN202411921716.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-22
AI Technical Summary
The prior art relies on manual experience and judgment in the identification and detection of pig house bacteria, resulting in low accuracy and high labor intensity, which affects pig house management and economic benefits.
Using the deep learning-based colony classification detection method in pig houses, by constructing a colony target detection model and bacterial species classification model, and using improved YOLOv5 and neural network technology, colonies in pig houses are automatically detected and classified.
It realizes the accurate identification and classification of bacteria in pig houses, reduces the labor intensity of breeders, improves the accuracy and efficiency of detection, and supports the rapid and accurate identification and precise disinfection and sterilization of large-scale pig farms.
Smart Images

Figure CN119859666A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent detection technology, and in particular to a pig house colony classification detection method based on deep learning. Background Art
[0002] Colony identification detection plays a vital role in pig house environmental management, and it has a significant impact on controlling bacteria in pig houses. As my country's pig farming industry shifts from the traditional free-range model to the large-scale, intensive farming model, most farms still rely on traditional manual monitoring methods based on the experience of farmers and the estrus performance of sows to assess the disinfection needs of pig houses. This method, which relies on subjective judgment, is not only labor-intensive, but also has limited accuracy. Due to inaccurate identification of microorganisms in the air, improper disinfectants may be selected, which in turn damages the reproductive performance of sows, which directly affects the growth environment and health of pigs, and ultimately affects the economic benefits of pig farms.
[0003] In recent years, people have begun to try to indirectly determine whether the pig house needs to be disinfected by monitoring the air quality in the pig house, such as the concentration of carbon dioxide, ammonia and sulfur dioxide. Although this method provides a new means of evaluation, it still relies on manual experience and judgment, which not only consumes a lot of time and energy, but also the technical level of the operator will affect the growth environment of the pigs.
[0004] Therefore, developing a system that can automatically identify and detect bacteria in pig houses to improve accuracy and efficiency is an urgent problem to be solved. Such a system will help optimize pig house management, ensure the health of pigs, and ultimately improve the overall economic benefits of the pig farm. How to automatically identify and detect bacteria in pig houses is a problem that needs to be solved.
[0005] Method content
[0006] In response to the above problems, the present invention proposes a pig house colony classification and detection method based on deep learning.
[0007] To achieve the above object, the present invention adopts the following technical solutions:
[0008] A pig house colony classification detection method based on deep learning, comprising the following steps:
[0009] Step 1, mixing nutrient agar powder and distilled water in a specific ratio to prepare a nutrient agar medium;
[0010] Step 2, cooling and shaping the nutrient agar medium prepared in step 1, sterilizing the cooled and shaped nutrient agar medium, and placing the sterilized nutrient agar medium into a culture dish;
[0011] Step 3, placing the culture dish of step 2 in a pig house to absorb the microorganisms in the pig house, and placing the culture dish with adsorbed microorganisms in a constant temperature incubator for bacterial culture;
[0012] Step 4, taking out the culture dish after bacterial culture from the incubator, taking a picture of the culture dish to obtain a culture dish image with bacterial colonies, and screening out a bacterial colony image from the culture dish image;
[0013] Step 5, preprocessing the colony image in step 4, and annotating the preprocessed colony image, adding labels to the preprocessed colony image, and obtaining a colony image dataset;
[0014] Step 6, constructing a colony target detection model, inputting the colony image dataset of step 5 into the target detection model for training and verification, and obtaining a colony recognition detection model;
[0015] Step 7, constructing a strain classification model based on a neural network, inputting the colony image data set described in step 5 into the strain classification model for training and verification, and obtaining a colony recognition prediction model;
[0016] Step 8, according to steps 1-3, use a culture dish filled with nutrient agar culture medium to adsorb the microorganisms in the pig house to be tested, put the culture dish with adsorbed microorganisms into a constant temperature incubator for bacterial culture, take a picture of the culture dish after culture, obtain a culture dish image with colonies, input the culture dish image into the colony recognition detection model, output the colony annotation image, input the colony annotation image into the colony recognition prediction model, output the number of colonies in the culture dish, and the bacterial species type corresponding to each colony, so as to determine the type of bacteria in the pig house.
[0017] In the above technical solution, the colony image dataset includes three file packages: Annotations, JEPGimages and ImageSet; wherein Annotations is an xml format file; JEPGimages is a jpg format file; ImageSet is four txt format files, and the four txt format files are training verification set, training set, verification set and test set respectively.
[0018] In the above technical solution, the preprocessing of the numbered bacterial colony images includes:
[0019] S5.1: Number each colony image, and adjust the color of the numbered colony images.
[0020] S5.2: performing data cleaning on the color-adjusted colony image to obtain an initial sample image;
[0021] S5.3: Determine whether the number of sample images with the same number in the initial sample image is less than the preset number of samples. If not, determine that the initial sample image is the final sample image; if so, flip, enlarge and reduce the sample image with the same number to obtain an enhanced sample image, and merge the enhanced sample image with the sample image with the same number to obtain the final sample image.
[0022] In the above technical solution, the data cleaning of the color-adjusted colony images includes: deleting the colony images that do not meet the requirements among the collected colony images; wherein the colony images that do not meet the requirements include images that do not contain colonies, have blurred colonies, are incomplete colonies, or have repeated colonies.
[0023] In the above technical solution, the constructed pig house colony recognition and detection model is a target detection model based on improved YOLOv5, including four modules: input layer, Backbone Network, Neck Network and Detector; wherein:
[0024] The input layer is used to preprocess the input training set and test set, including: parsing the training set and test set into a form in which the iterator can return a series of (img, bbox, label) tuples, performing channel conversion, pixel normalization, scaling, flipping and cropping of the image and bbox on the training set;
[0025] The Backbone Network consists of Focus, C3, PSA, DwConv and SPP modules; wherein the DwConv replaces the 3X3 ordinary convolution kernel in the Conv module used for downsampling in the original Backbone Network with a depth-separable convolution kernel, and then uses 1X1 convolution to disrupt the channel order of the feature map to promote information interaction between channels; the PSA is an efficient pyramid attention segmentation module, which is added after the last C3 module to strengthen the network's learning of the dependency relationship between channels and extract more fine-grained multi-scale spatial information, further enhancing the feature extraction capability of the Backbone Network;
[0026] The Neck Network includes a feature pyramid network and a path aggregation network; wherein the FPN upsamples high-level features and fuses low-level features from top to bottom to enhance the acquisition of semantic information; the PAN downsamples low-level features and fuses high-level features from bottom to top to enhance the acquisition of position information;
[0027] The Detector includes a Detect module of a model detection head and initial Anchor boxes with different aspect ratios; the detection heads are medium target detection heads and large target detection heads, and the small target detection heads are deleted; the Detect module is used to return the position, confidence and category information of the target detection box; the initial Anchor box matches the annotation information in the pig house colony image data set through the K-Means++ clustering algorithm and the genetic algorithm, and finally obtains 6 prior boxes with different aspect ratios.
[0028] In the above technical solution, the colony recognition prediction model consists of 2 LSTM layers, 2 Dropout layers, 1 fully connected layer and 1 Softmax layer, the 2 LSTM layers each contain 20 LSTM units, and the Dropoutrate of the 2 Dropout layers is 0.3.
[0029] In the above technical scheme, after the step 8 determines the bacterial species corresponding to each colony, the edge of each colony in the colony image can also be calculated, and the area of each colony can be calculated according to the edge of each colony. The colony areas of the same species are added together to obtain the sum of the colony areas of the same species, and the disinfection of pig houses is guided according to the sum of the colony areas of the same species.
[0030] The beneficial effects of the present invention are as follows:
[0031] The pig house colony classification and detection method based on deep learning of the present invention uses improved YOLOv5 to automatically detect the colony images collected from the culture dish to accurately extract and identify, thereby reducing the labor intensity of farmers and improving the accuracy and efficiency of colony detection. At the same time, combined with the classification model based on neural network, the colonies are classified non-contactly, which can be used for rapid and accurate identification of colonies in large-scale pig farms for precise disinfection and sterilization. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0033] Figure 1 Shown is a flow chart of the pig house colony classification and detection method based on deep learning described in the present invention.
[0034] Figure 2 Shown is a deep learning network framework diagram described in the present invention.
[0035] Figure 3Shown is a diagram of the colony identification test results described in the present invention. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0037] Example 1
[0038] A colony identification detection system, see Figure 1 , including: a data processing module 1, a data set training module 6 and a prediction module 7.
[0039] The data processing module 1 includes a data cleaning unit 2, a data enhancement unit 3 and a data annotation unit 4. The data cleaning unit 2 is used to delete the colony images that do not meet the requirements in the collected colony images to obtain an initial sample image; the data enhancement unit 3 is used to determine whether the number of sample images with the same number in the initial sample image is less than the set sample number. If not, the initial sample image is determined to be the final sample image; if so, the sample images with the same number are flipped, enlarged and reduced (the number of initial sample images of the nutrient agar culture medium is increased) to obtain an enhanced sample image, and the enhanced sample image is merged with the sample image with the same number to obtain a final sample image (wherein the sum of the number of enhanced sample images and the number of sample images with the same number is equal to the number of final sample images); the data annotation unit 4 is used to frame the colonies in the final sample image to obtain a colony image.
[0040] The data set training module 6 is used to divide the colony images into a training set and a test set, use the colony images in the training set as input and the colony image numbers as output to train the pig house colony recognition detection model, and use the test set to test the pig house colony recognition detection model.
[0041] The prediction module 7 is used to input the colony image data set into a pre-trained pig house colony recognition and detection model to obtain the number corresponding to the colony image; the colony image is a pre-processed colony image to be identified.
[0042] A deep learning-based colony classification and detection method for piggeries, see Figure 1 , including the following steps:
[0043] Step 1: Mix nutrient agar powder and distilled water in a specific ratio to prepare a nutrient agar medium.
[0044] Step 2, cooling and shaping the nutrient agar medium prepared in step 1, sterilizing the cooled and shaped nutrient agar medium, and placing the sterilized nutrient agar medium into a culture dish.
[0045] In this embodiment, the nutrient agar culture medium after cooling and setting is sterilized by ultraviolet sterilization.
[0046] Step 3, place the culture dish of step 2 in the pig house, let it stand for 5 minutes to absorb the microorganisms in the pig house, put the culture dish with adsorbed microorganisms into a constant temperature incubator at 27°C for bacterial culture, culture for 24 hours, and observe the culture results.
[0047] The culture dish in step 2 is placed at a height of 90-150 cm in the pig house, wherein the placement height of the culture dish is preferably 120 cm.
[0048] Step 4, taking out the culture dish after bacterial culture from the incubator, taking a picture of the culture dish to obtain a culture dish image with bacterial colonies, and screening out a bacterial colony image from the culture dish image.
[0049] Step 5, preprocess the colony image in step 4, and annotate the preprocessed colony image, add labels to the preprocessed colony image (experts pre-label the colony images in the culture dish, and note the species of the colonies), and obtain a colony image dataset (the colony image dataset is saved in xml format, including the colony image name, colony image size and number of channels, the category of the colonies in the colony image and the boundaries of each annotation box (four points on the upper left and lower right)), and divide the colony image dataset into a training set, a validation set and a test set.
[0050] This embodiment obtains different colony image data sets based on colony images obtained from different pig houses, and divides each colony image data set into a training set, a validation set, and a test set, which can ensure the independence of each data set. The colony image data set includes three file packages: Annotations, JEPGimages, and ImageSet; wherein Annotations is an xml format file; JEPGimages is a jpg format file (jpg format files are training sets and test sets named by numbers); ImageSet is four txt format files, and the four txt format files are training validation set, training set, validation set, and test set, respectively.
[0051] The preprocessing of the numbered bacterial colony images comprises:
[0052] S5.1: Number each colony image (colony images of the same nutrient agar medium have the same number; the format of the colony image is JPG format), and adjust the color of the numbered colony images.
[0053] S5.2: Perform data cleaning on the color-adjusted colony image to obtain an initial sample image.
[0054] The data cleaning of the color-adjusted colony images includes: deleting colony images that do not meet the requirements from the collected colony images, wherein the colony images that do not meet the requirements include images that do not contain colonies, have blurred colonies, are incomplete colonies, or have repeated colonies.
[0055] S5.3: Determine whether the number of sample images with the same number in the initial sample image is less than the preset number of samples. If not, determine that the initial sample image is the final sample image; if so, flip, enlarge, and reduce the sample image with the same number to obtain an enhanced sample image, and merge the enhanced sample image with the sample image with the same number to obtain the final sample image. Among them, the final sample image of this embodiment is preferably 8800. This embodiment uses the labeling software labelme to annotate the final sample image, frame the colonies in the final sample image, and add labels to obtain a colony image.
[0056] Step 6: construct a colony target detection model, input the colony image dataset of step 5 into the target detection model for training and verification, and obtain a colony recognition detection model.
[0057] Specifically, this embodiment inputs the training set into the target detection model based on the improved YOLOv5 (pig house colony recognition and detection model) to obtain the colony feature map in the training set, and all the colony features on the colony feature map are framed by prediction boxes, and each colony feature map and the corresponding anchors (reference boxes) are calculated. The coordinates of the center point, weight, probability of whether there is a target, and probability of the target category of each prediction box are calculated to perform prediction box decoding. Reshape (reshape function) boxes (prediction box), conf (confidence parameter), and prob (probability) to [batch_size, 13x13x3, 4], [batch_size, 13x13x3, 1], and [batch_size, 13x13x3, class_num] respectively, and merge the three feature maps; for each target category, perform non-maximum suppression according to the score, and filter according to the set score, iou, and maxboxes thresholds to finally obtain the prediction box of each target category; calculate the IoU (Intersection over Union) of the prediction box and the label box of each colony feature map, the threshold is the credibility of the colony features framed by the prediction box to distinguish the colony, IoU is the ratio of the intersection and union of the prediction box and the true box, the label box is the standard box, and the detection box is judged to belong to TP (True) based on whether the IOU is greater than 0.5. Positives / classified as positive samples and classified correctly) or FP (False Positives / classified as positive samples but classified incorrectly). Sort from high to low according to the confidence threshold of each prediction box, obtain Precision (precision) and Recal1 (recall rate) at different confidence thresholds, draw a PR curve according to the PR value, and determine the AP value according to the PR curve. Among them, draw a line segment to the left of each "peak point" of the PR curve until it intersects with the vertical line of the previous peak point. The area enclosed by the drawn line segment and the coordinate axis is the AP value (Average Precision). AP measures the quality of detection of a class, and mAP (mean Average Precision) measures the quality of detection of multiple classes. The AP values of all classes are averaged to obtain mAP; according to the mAP value and the AP value of each class, the data of the training set is adjusted, and the colony recognition APP7 is developed to accurately identify the individual colony features on the colony feature map.
[0058] See also Figure 2 , Figure 3 The constructed pig house colony recognition and detection model is a target detection model based on improved YOLOv5, including four modules: input layer, Backbone Network, Neck Network and Detector. Among them:
[0059] The input layer is used to preprocess the input training set and test set; specifically, it includes: parsing the training set and test set (three file packages) into a form in which the iterator can return a series of (img, bbox, label) tuples, performing channel conversion, pixel normalization, scaling, flipping (horizontally and vertically) and cropping of the training set.
[0060] The Backbone Network consists of Focus, C3, PSA, DwConv and SPP modules. Among them, the DwConv replaces the 3X3 ordinary convolution kernel in the Conv module used for downsampling in the original Backbone Network with a depth-separable convolution kernel, and then uses 1X1 convolution to disrupt the channel order of the feature map to promote information interaction between channels; the PSA is an efficient pyramid attention segmentation module, which is added after the last C3 module to strengthen the network's learning of inter-channel dependencies and extract more fine-grained multi-scale spatial information, further enhancing the feature extraction capability of the Backbone Network.
[0061] The Neck Network includes a Feature Pyramid Network (FPN) and a Path Aggregation Network (PAN). The FPN upsamples high-level features and fuses low-level features from top to bottom to enhance the acquisition of semantic information; the PAN downsamples low-level features and fuses high-level features from bottom to top to enhance the acquisition of position information.
[0062] The Detector includes a Detect module of a model detection head and initial Anchor boxes with different aspect ratios. The detection heads are medium target detection heads and large target detection heads, and the small target detection head is deleted; the Detect module is used to return the position, confidence and category information of the target detection box; the initial Anchor box matches the annotation information in the pig house colony image data set through the K-Means++ clustering algorithm and the genetic algorithm, and finally obtains 6 prior boxes with different aspect ratios.
[0063] Step 7, constructing a strain classification model based on a neural network, inputting the colony image data set described in step 5 into the strain classification model for training and verification, and obtaining a colony recognition prediction model.
[0064] The colony recognition prediction model of this embodiment is composed of 2 LSTM layers, 2 Dropout layers, 1 fully connected layer and 1 Softmax layer. The 2 LSTM layers each contain 20 LSTM units, and the Dropout rate of the 2 Dropout layers is 0.3. Among them, the function of the fully connected layer is to perform weighted summation on the extracted colony image features, and the function of the Softmax layer is to map the weighted summation result of the fully connected layer into probability.
[0065] Step 8, according to steps 1-3, use a culture dish filled with nutrient agar culture medium to adsorb the microorganisms in the pig house to be tested, put the culture dish with adsorbed microorganisms into a constant temperature incubator for bacterial culture, take a picture of the culture dish after culture, obtain a culture dish image with colonies, input the culture dish image into the colony recognition detection model, output the colony annotation image, input the colony annotation image into the colony recognition prediction model, output the number of colonies in the culture dish, and the bacterial species type corresponding to each colony, so as to determine the type of bacteria in the pig house.
[0066] This embodiment performs non-contact classification of colonies based on colony recognition technology, and realizes identification of colonies by collecting images of colonies, thereby achieving the purpose of convenient and economical identification of colonies.
[0067] Step 9, calculate the edge of each colony in the colony image through the edge detection algorithm, calculate the area of each colony according to the edge of each colony, add the colony areas of the same species to get the sum of the colony areas of the same species, and guide the disinfection of the pig house according to the sum of the colony areas of the same species. The larger the sum of the colony areas of the same species, the higher the concentration of microorganisms in the pig house, and the greater the disinfection intensity of the pig house (the longer the disinfection time of the pig house, the greater the concentration of the disinfectant water).
[0068] The above is a preferred implementation mode of the present invention and should not be regarded as any form of limitation on the present invention. The preferred embodiments and related technologies in the present invention have been described above, but they do not limit the present invention. For relevant technical personnel familiar with the technical field, without departing from the scope of the technical principles of the present invention, the technical principles described above can be used to make some improvements or substitutions, including modifications and equivalent changes based on the core content of the present invention, all of which are within the scope of protection of the present invention.
Claims
1. A pig house colony classification detection method based on deep learning, characterized in that: The following steps are involved: Step 1, mixing nutrient agar powder and distilled water in a specific ratio to prepare a nutrient agar medium; Step 2, cooling and shaping the nutrient agar medium prepared in step 1, sterilizing the cooled and shaped nutrient agar medium, and placing the sterilized nutrient agar medium into a culture dish; Step 3, placing the culture dish of step 2 in a pig house to absorb the microorganisms in the pig house, and placing the culture dish with adsorbed microorganisms in a constant temperature incubator for bacterial culture; Step 4, taking out the culture dish after bacterial culture from the incubator, taking a picture of the culture dish to obtain a culture dish image with bacterial colonies, and screening out a bacterial colony image from the culture dish image; Step 5, preprocessing the colony image in step 4, and annotating the preprocessed colony image, adding labels to the preprocessed colony image, and obtaining a colony image dataset; Step 6, constructing a colony target detection model, inputting the colony image dataset of step 5 into the target detection model for training and verification, and obtaining a colony recognition detection model; Step 7, constructing a strain classification model based on a neural network, inputting the colony image data set described in step 5 into the strain classification model for training and verification, and obtaining a colony recognition prediction model; Step 8, according to steps 1-3, use a culture dish filled with nutrient agar culture medium to adsorb the microorganisms in the pig house to be tested, put the culture dish with adsorbed microorganisms into a constant temperature incubator for bacterial culture, take a picture of the culture dish after culture, obtain a culture dish image with colonies, input the culture dish image into the colony recognition detection model, output the colony annotation image, input the colony annotation image into the colony recognition prediction model, output the number of colonies in the culture dish, and the bacterial species type corresponding to each colony, so as to determine the type of bacteria in the pig house.
2. The pig house colony classification detection method according to claim 1, characterized in that: The colony image dataset includes three file packages: Annotations, JPEGimages and ImageSet; wherein Annotations is an xml format file; JPEGimages is a jpg format file; ImageSet is four txt format files, and the four txt format files are respectively a training validation set, a training set, a validation set and a test set.
3. The pig house colony classification detection method according to claim 1, characterized in that: The preprocessing of the numbered bacterial colony images comprises: S5.1: Number each colony image, and adjust the color of the numbered colony images. S5.2: performing data cleaning on the color-adjusted colony image to obtain an initial sample image; S5.3: Determine whether the number of sample images with the same number in the initial sample image is less than the preset number of samples. If not, determine that the initial sample image is the final sample image; if so, flip, enlarge and reduce the sample image with the same number to obtain an enhanced sample image, and merge the enhanced sample image with the sample image with the same number to obtain the final sample image.
4. The pig house colony classification detection method according to claim 3, characterized in that: The data cleaning of the color-adjusted colony images includes: deleting colony images that do not meet the requirements from the collected colony images; wherein the colony images that do not meet the requirements include images that do not contain colonies, have blurred colonies, are incomplete colonies, or have repeated colonies.
5. The pig house colony classification detection method according to claim 1, characterized in that: The constructed pig house colony recognition and detection model is a target detection model based on improved YOLOv5, including four modules: input layer, Backbone Network, NeckNetwork and Detector; wherein: The input layer is used to preprocess the input training set and test set, including: parsing the training set and test set into a form in which the iterator can return a series of (img, bbox, label) tuples, performing channel conversion, pixel normalization, scaling, flipping and cropping of the image and bbox on the training set; The Backbone Network consists of Focus, C3, PSA, DwConv and SPP modules; wherein the DwConv replaces the 3X3 ordinary convolution kernel in the Conv module used for downsampling in the original Backbone Network with a depth-separable convolution kernel, and then uses 1X1 convolution to disrupt the channel order of the feature map to promote information interaction between channels; the PSA is an efficient pyramid attention segmentation module, which is added after the last C3 module to strengthen the network's learning of the dependency relationship between channels and extract more fine-grained multi-scale spatial information, further enhancing the feature extraction capability of the Backbone Network; The Neck Network includes a feature pyramid network and a path aggregation network; wherein the FPN upsamples high-level features and fuses low-level features from top to bottom to enhance the acquisition of semantic information; the PAN downsamples low-level features and fuses high-level features from bottom to top to enhance the acquisition of position information; The Detector includes a Detect module of a model detection head and initial Anchor boxes with different aspect ratios; the detection heads are medium target detection heads and large target detection heads, and the small target detection heads are deleted; the Detect module is used to return the position, confidence and category information of the target detection box; the initial Anchor box matches the annotation information in the pig house colony image data set through the K-Means++ clustering algorithm and the genetic algorithm, and finally obtains 6 prior boxes with different aspect ratios.
6. The pig house colony classification detection method according to claim 1, characterized in that: The colony recognition prediction model consists of 2 LSTM layers, 2 Dropout layers, 1 fully connected layer and 1 Softmax layer, the 2 LSTM layers each contain 20 LSTM units, and the Dropout rate of the 2 Dropout layers is 0.
3.
7. The pig house colony classification detection method according to claim 1, characterized in that: After the step 8 determines the bacterial species corresponding to each colony, the edge of each colony in the colony image can also be calculated, and the area of each colony can be calculated based on the edge of each colony. The colony areas of the same species are added together to obtain the sum of the colony areas of the same species, and the disinfection of the pig house is guided based on the sum of the colony areas of the same species.