Fence excrement detection method and intelligent fence excrement cleaning robot

By extracting and fusing features from manure images in livestock pens using a manure detection model, the problem of existing cleaning robots being unable to accurately detect the location of manure has been solved, achieving efficient manure detection and cleaning and meeting the needs of large-scale farming.

CN120877037APending Publication Date: 2025-10-31SHENZHEN SHUYING TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510880114.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

Existing manure cleaning robots lack environmental perception capabilities and cannot accurately detect the location of manure, resulting in low cleaning efficiency and failing to meet the needs of large-scale farming.

Method used

A fecal waste detection model is adopted, including an initial feature extraction module, a dual-branch feature learning and fusion module, a detection head, and a bidirectional weighted feature pyramid unit. By extracting, fusing, and detecting features from fecal waste images in the pen, the location of fecal waste can be accurately perceived.

Benefits of technology

It improves the accuracy and efficiency of manure detection, enhances the cleaning efficiency of cleaning robots, and meets the needs of large-scale farming.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120877037A_ABST
    Figure CN120877037A_ABST
Patent Text Reader

Abstract

The invention provides a shed excrement detection method and an intelligent shed excrement cleaning robot, and the method comprises the steps: receiving a shed excrement image, and inputting the shed excrement image into an excrement detection model; extracting an initial feature of the pigsty excrement image based on an initial feature extraction module; performing channel dimension division and dual-channel feature learning and fusion on the initial features based on a dual-branch feature learning and fusion module to obtain target features; fusing the initial features and the target features based on a feature fusion module to obtain fused features; and detecting the fusion features based on a detection head to obtain a detection result of the pigsty feces. According to the method, learning of different dimensions is carried out on different features of the divided channels, the feature level diversity in the target features is improved, feature fusion in the top-down direction and the bottom-up direction is achieved through the bidirectional weighted feature pyramid unit, the comprehensiveness of the feature scale is improved, and the robustness of the target features is improved. And the detection accuracy of the pigsty feces is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of pig farming technology, specifically to a method for detecting manure in pig pens and an intelligent manure cleaning robot for pig pens. Background Technology

[0002] As the scale of pig farming continues to increase, the risk of disease transmission has risen significantly, placing higher demands on biosecurity management in pig farms. Timely and efficient removal of pig manure and ensuring the cleanliness and hygiene of pig pens are crucial for ensuring biosecurity. However, current manure cleaning in pig pens mainly relies on manual labor, which requires a large investment of manpower and is inefficient. Furthermore, poor air quality and high ammonia concentrations in pig pens pose a threat to the safety of employees.

[0003] Against this backdrop, the Dutch company Lely developed an automated manure-scraping robot that uses a bottom-linked scraper mechanism to collect manure from the pen floor into a storage bin via a mechanical transmission system. The Danish company Washpower launched a cleaning robot called ProCleaner X100, which navigates using ultrasonic sensors and uses its onboard high-pressure water hose to flush away manure. While these cleaning robots achieve a degree of automation, they all share a common problem: a lack of sufficient environmental awareness. Due to the complex environment of pig farms and the random distribution of manure, existing cleaning robots struggle to accurately pinpoint the location of manure. This leads to robots missing areas during actual cleaning, significantly reducing overall cleaning efficiency and failing to meet the needs of large-scale farming.

[0004] Therefore, there is an urgent need to provide a method for detecting manure in livestock pens and an intelligent manure cleaning robot to detect manure, provide a reference for the cleaning robot, and thus improve its cleaning efficiency to meet the needs of large-scale farming. Summary of the Invention

[0005] In view of this, it is necessary to provide a method for detecting manure in livestock pens and an intelligent manure cleaning robot to solve the technical problem in the existing technology that the specific location of manure cannot be accurately detected, resulting in low cleaning efficiency of the cleaning robot and the inability to achieve large-scale breeding.

[0006] In a first aspect, the present invention provides a method for detecting manure in livestock pens, comprising: The system receives images of manure and waste in the pen and inputs these images into a manure and waste detection model. The manure and waste detection model includes an initial feature extraction module, a dual-branch feature learning and fusion module, a detection head, and a feature fusion module that includes bidirectional weighted feature pyramid units. The initial features of the manure image in the pen are extracted based on the initial feature extraction module. Based on the dual-branch feature learning and fusion module, the initial features are divided into channel dimensions and dual-channel features are learned and fused to obtain the target features; The initial features and the target features are fused based on the feature fusion module to obtain fused features; The detection head is used to detect the fused features to obtain the detection results of manure in the pen.

[0007] In some possible implementations, the dual-branch feature learning and fusion module includes a cascaded first dual-branch feature learning and fusion unit, a first convolutional layer, a second dual-branch feature learning and fusion unit, and a spatial pyramid fast pooling unit; The first dual-branch feature learning and fusion unit is used to perform channel dimension division and dual-channel feature learning and fusion on the initial features to obtain the first preliminary learned features; The first convolutional layer is used to perform a convolution operation on the initially learned features to obtain the first extracted features; The second dual-branch feature learning and fusion unit is used to perform channel dimension division and dual-channel feature learning and fusion on the first extracted features to obtain the second preliminary learned features; The spatial pyramid fast pooling unit is used to perform fast pooling on the second preliminary learned features to obtain the target features.

[0008] In some possible implementations, the first dual-branch feature learning and fusion unit includes a segmentation layer, a first branch, a second branch connected in parallel with the first branch, a first concatenation layer, and a second convolutional layer. The first branch includes a third convolutional layer, a fourth convolutional layer, and a third concatenation layer. The second branch includes a multi-head attention mechanism layer, a fourth concatenation layer, a convolutional gated linear unit layer, and a fifth concatenation layer. The segmentation layer is used to segment the initial features along the channel dimension, dividing them into first channel features and second channel features; The third and fourth convolutional layers are used to sequentially perform convolution operations on the first channel features to obtain channel convolutional features; The third splicing layer is used to splice the channel convolutional features and the first channel features to obtain the first branch features; The multi-head attention mechanism layer is used to perform multi-head attention learning on the second channel features to obtain multi-head attention features; The fourth splicing layer is used to splice the multi-head attention features and the second channel features to obtain preliminary splicing features; The convolutional gated linear unit layer is used to perform feature transfer and learning on the preliminary spliced ​​features to obtain transferred features; The fifth splicing layer is used to splice the transmitted features and the preliminary splicing features to obtain the second branch features; The first splicing layer is used to splice the first branch feature and the second branch feature to obtain the channel splicing feature; The second convolutional layer is used to perform convolution processing on the channel splicing features to obtain the first preliminary learned features.

[0009] In some possible implementations, the second branch further includes a first normalization layer connected to the input of the multi-head attention mechanism layer, a first path drop-out layer disposed between the multi-head attention mechanism layer and the fourth splicing layer, a second normalization layer connected to the input of the convolutional gated linear unit layer, and a second path drop-out layer disposed between the convolutional gated linear unit layer and the fifth splicing layer.

[0010] In some possible implementations, the initial features include a first initial feature, a second initial feature, a third initial feature, and a fourth initial feature with different scales; the feature fusion module includes a first fusion convolutional layer, a second fusion convolutional layer, a third fusion convolutional layer, and a fourth fusion convolutional layer corresponding one-to-one with the first initial feature, the second initial feature, the third initial feature, and the fourth initial feature; a first bidirectional weighted feature pyramid unit that fuses the output features of the third fusion convolutional layer and the fourth fusion convolutional layer; a second bidirectional weighted feature pyramid unit that fuses the output features of the second fusion convolutional layer and the first bidirectional weighted feature pyramid unit; a third bidirectional weighted feature pyramid unit that fuses the output features of the first fusion convolutional layer and the second bidirectional weighted feature pyramid unit; a fourth bidirectional weighted feature pyramid unit that fuses the features of the third fusion convolutional layer, the first bidirectional weighted feature pyramid unit, and the output of the third bidirectional weighted feature pyramid unit; and a fifth bidirectional weighted feature pyramid unit that fuses the features of the fourth bidirectional weighted feature pyramid unit.

[0011] In some possible implementations, the detection head includes a cascaded first detection module, a second detection module, and a third detection module; The first detection module includes a cascaded first average pooling layer, a first detection convolutional layer, a first activation function layer, a second activation function layer, and a first detection splicing layer. The first detection splicing layer is used to splice the output of the first average pooling layer and the output of the second activation function layer. The second detection module includes a deformable convolutional layer, a regular convolutional layer, an offset layer, a third activation function layer, and a second detection splicing layer. The offset layer is used to extract offset features from the output of the regular convolutional layer to obtain offset features. The third activation function layer is used to activate the output of the regular convolutional layer to obtain activation features. The second detection splicing layer is used to splice the offset features, the activation features, and the output of the deformable convolutional layer. The third detection module includes a cascaded second average pooling layer, a first fully connected layer, a fourth activation function layer, a second fully connected layer, a detection normalization layer, a fifth activation function layer connected to the output of the second average pooling layer, and a third detection splicing layer connected to the output of the detection normalization layer. The third detection splicing layer is used to splice the spatial feature vectors of the output and input of the detection normalization layer to obtain a spliced ​​vector. The fifth activation function layer is used to activate the spliced ​​vector and the output of the second average pooling layer to obtain the detection result of the manure in the pen.

[0012] In some possible implementations, the method further includes, before receiving images of manure in the pen, the following: An initial dataset of manure and sludge from the pen is obtained using an image acquisition device, and defective data that does not meet the requirements in the initial dataset is removed to generate a manure and sludge dataset. Data augmentation is performed on the aforementioned pen manure dataset to obtain an augmented pen manure dataset; The initial fecal waste detection model was trained, tested, and validated based on the enhanced fecal waste dataset of the pen, and the fecal waste detection model was obtained.

[0013] In some possible implementations, the initial fecal waste detection model uses a loss function that is a weighted sum of the EIOU loss function and the Inner-IOU loss function during training.

[0014] Secondly, the present invention also provides an intelligent pen cleaning robot, including: a camera and a fecal waste detection module; The camera is used to acquire images of manure and sewage in the pen; The fecal waste detection module is used to detect the fecal waste image of the pen based on the pen fecal waste detection method, and obtain the pen fecal waste detection result; The method for detecting manure in the pen is the same as the method for detecting manure in the pen mentioned in the above-discussed possible implementation.

[0015] In one possible implementation, the intelligent enclosure cleaning robot also includes a decision-making module, an execution module, and an interaction module; The interaction module is used to receive human input actions and generate input instructions based on the human input actions; The decision module is used to generate a cleaning instruction based on the results of the manure detection in the pen, and / or the input instruction; The execution module is used to clean the enclosure in response to the cleaning command.

[0016] The beneficial effects of the above embodiments are as follows: The manure detection method for livestock pens provided by this invention, by setting a manure detection model including a dual-branch feature learning and fusion module, divides the initial features into channel dimensions. It can learn different dimensional feature quantities for two features with different channels after division, obtaining two branch features of different dimensions. Then, the learned two branch features are fused to obtain the target feature, improving the feature hierarchy diversity in the target feature, i.e., improving feature diversity, and thus improving the accuracy of the obtained manure detection results. Furthermore, by setting a feature fusion module including bidirectional weighted feature pyramid units, feature fusion in both top-down and bottom-up directions is achieved. This improves both the comprehensiveness of feature scale and the efficiency of feature fusion, i.e., improving both the accuracy and efficiency of manure detection results. In summary, this invention achieves accurate and rapid perception of the specific location of manure, thereby improving the cleaning efficiency of cleaning robots and meeting the needs of large-scale farming. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram of an embodiment of the fecal waste detection model provided by the present invention; Figure 2 A schematic flowchart of an embodiment of the pen manure detection method provided by the present invention; Figure 3 A schematic diagram of an embodiment of the dual-branch feature learning and fusion module provided by the present invention; Figure 4 A schematic diagram of an embodiment of the first dual-branch feature learning and fusion unit provided by the present invention; Figure 5 A schematic diagram of an embodiment of the feature fusion module provided by the present invention; Figure 6 A schematic diagram of an embodiment of the bidirectional weighted feature pyramid unit provided by the present invention; Figure 7 A schematic diagram of an embodiment of the detection head provided by the present invention; Figure 8 A schematic flowchart of an embodiment of the process for constructing the fecal waste detection model provided by the present invention; Figure 9 A schematic diagram of an embodiment of the intelligent pen manure cleaning robot provided by the present invention; Figure 10 This is a schematic diagram of an embodiment of the cleaning process of the intelligent pen manure cleaning robot provided by the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.

[0020] It should be understood that the illustrative drawings are not drawn to scale. The flowcharts used in this invention illustrate operations implemented according to some embodiments of the invention. It should be understood that the operations in the flowcharts may be implemented out of order, and steps without logical contextual relationships may be reversed or performed simultaneously. Furthermore, those skilled in the art, guided by the content of this invention, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor systems and / or microcontroller systems.

[0021] The terms "first," "second," etc., used in the embodiments of this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of those features.

[0022] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0023] This invention provides a method for detecting manure in livestock pens and an intelligent manure cleaning robot, which will be described below.

[0024] In this embodiment of the invention, the method for detecting manure in animal pens is based on a manure detection model. The basic architecture of this manure detection model is YOLOv8. For the specific scenario of manure detection in animal pens, YOLOv8 has been adaptively improved to obtain the resulting model. Therefore, the manure detection model in this embodiment of the invention possesses all the advantages of YOLOv8.

[0025] Figure 1 This is a schematic diagram of an embodiment of the fecal waste detection model proposed in this invention, as shown below. Figure 1 As shown, the fecal waste detection model includes an initial feature extraction module, a dual-branch feature learning and fusion module, a detection head, and a feature fusion module including a bidirectional weighted feature pyramid unit (BiFPN). Based on the fecal waste detection model, a method for detecting fecal waste in animal pens is proposed. Figure 2 This is a schematic flowchart of an embodiment of the pen manure detection method proposed in this invention, as shown below. Figure 2 As shown, the methods for detecting manure in animal pens include: S201. Receive images of manure and waste in the pen and input them into the manure and waste detection model.

[0026] Specifically, the images of manure and sewage in the pen are received by communicating with an image acquisition device to obtain real-time images of manure and sewage in the pen, or by retrieving them from a storage device / medium that stores images of manure and sewage in the pen.

[0027] S202. Extract initial features from the manure and sewage image of the pen based on the initial feature extraction module; In specific embodiments of the present invention, such as Figure 3 As shown, the initial feature extraction module includes a cascaded first initial convolutional layer, a second initial convolutional layer, a first C2F layer, a third initial convolutional layer, a second C2F layer, and a fourth initial convolutional layer. The manure image of the pen passes through the above hierarchical structure in sequence to obtain the initial features.

[0028] S203. Based on the dual-branch feature learning and fusion module, the initial features are divided into channel dimensions and dual-channel features are learned and fused to obtain the target features.

[0029] The dual-branch feature learning and fusion module includes two parallel branches. Based on the two branches, local and global features are extracted from the features of different channels respectively, and then fused to obtain the target features. This makes the target features have both local and global features, improving the hierarchical nature of the features.

[0030] S204. The initial features and target features are fused based on the feature fusion module to obtain fused features.

[0031] The feature fusion module improves the feature scale diversity of the fused features by fusing initial features and target features of different scales, thereby improving the accuracy of the detection results.

[0032] S205. Based on the detection head, the fusion features are detected to obtain the detection results of manure in the pen.

[0033] In the embodiments of the present invention, the features refer to feature maps.

[0034] It should be understood that the pen manure detection method in this embodiment of the invention can be implemented in any device based on the pen manure detection method, such as a cleaning robot. Specifically, the pen manure detection method is stored in the device as a pre-programmed program. When the device is started, the program is invoked, and the pen manure detection method is implemented.

[0035] Compared with existing technologies, the manure detection method for livestock pens provided in this invention, by setting up a manure detection model including a dual-branch feature learning and fusion module, divides the initial features into channel dimensions. It can learn different dimensional feature quantities for two features in different channels after division, obtaining two branch features of different dimensions. Then, the learned two branch features are fused to obtain the target feature, improving the feature hierarchy diversity in the target feature, thus increasing the accuracy of the obtained manure detection results. Furthermore, by setting up a feature fusion module including bidirectional weighted feature pyramid units, feature fusion is achieved in both top-down and bottom-up directions. This improves both the comprehensiveness of the feature scale and the efficiency of feature fusion, thereby improving both the accuracy and efficiency of manure detection results. In summary, this invention achieves precise and rapid perception of the specific location of manure, thereby improving the cleaning efficiency of cleaning robots and meeting the needs of large-scale farming.

[0036] In some embodiments of the present invention, such as Figure 3 As shown, the dual-branch feature learning and fusion module includes a cascaded first dual-branch feature learning and fusion (DFLF) unit, a first convolutional layer, a second dual-branch feature learning and fusion unit, and a spatial pyramid pooling fast unit. The first dual-branch feature learning and fusion unit is used to perform channel dimension division and dual-channel feature learning and fusion on the initial features to obtain the first preliminary learned features; The first convolutional layer is used to perform convolution operations on the initially learned features to obtain the first extracted features; The second dual-branch feature learning and fusion unit is used to perform channel dimension division and dual-channel feature learning and fusion on the first extracted features to obtain the second preliminary learned features. The spatial pyramid fast pooling unit is used to quickly pool the second preliminary learned features to obtain the target features.

[0037] This invention, through the setting of a dual-branch feature learning and fusion module including a first dual-branch feature learning and fusion unit and a second dual-branch feature learning and fusion unit, extracts further image features, thereby improving the diversity of feature scale and level in the input feature fusion module, providing a data foundation for the detection head, and ensuring the accuracy and reliability of the detection results.

[0038] It should be understood that the first bi-branch feature learning and fusion unit and the second bi-branch feature learning and fusion unit have exactly the same structure and function. The following description uses the first bi-branch feature learning and fusion unit as an example. Specifically, as follows... Figure 4 As shown, the first dual-branch feature learning and fusion unit includes a segmentation layer, a first branch, a second branch connected in parallel with the first branch, a first concatenation layer, and a second convolutional layer. The first branch includes a third convolutional layer, a fourth convolutional layer, and a third concatenation layer. The second branch includes a multi-head attention mechanism layer, a fourth concatenation layer, a convolutional gated linear unit layer, and a fifth concatenation layer. The segmentation layer is used to segment the initial features along the channel dimension, dividing them into first channel features and second channel features; The third and fourth convolutional layers are used to perform convolution operations on the first channel features in sequence to obtain channel convolutional features; The third concatenation layer is used to concatenate the channel convolution features and the first channel features to obtain the first branch features; The multi-head attention mechanism layer is used to learn multi-head attention on the second channel features to obtain multi-head attention features; The fourth stitching layer is used to stitch together the multi-head attention features and the second channel features to obtain preliminary stitched features; The Convolutional Gated Linear Unit (CGLU) layer is used to perform feature transfer and learning on the initial spliced ​​features to obtain the transferred features; The fifth splicing layer is used to splice the transmitted features and the initial splicing features to obtain the second branch features; The first splicing layer is used to splice the first branch features and the second branch features to obtain channel splicing features; The second convolutional layer is used to perform convolution processing on the channel splicing features to obtain the first preliminary learned features.

[0039] This invention employs a cascaded third concatenation layer to stitch together the convolutional features of the first channel and the features of the second channel. This introduces a residual connection mechanism, enhancing gradient flow, preserving original feature information, mitigating gradient vanishing and network degradation issues, and improving the feature extraction performance and generalization ability of the first branch. Furthermore, the cascaded third and fourth convolutional layers extract local features from the initial features, while the multi-head attention mechanism layer and the convolutionally gated linear unit layer extract global dependencies from the initial features. This multi-level feature complementarity enhancement improves the accuracy of manure detection results in livestock pens.

[0040] To improve the stability of the feature distribution and further enhance the model's generalization ability to avoid overfitting, in some embodiments of the present invention, such as... Figure 4 As shown, the second branch also includes a first normalization layer connected to the input of the multi-head attention mechanism layer, a first droppath layer set between the multi-head attention mechanism layer and the fourth splicing layer, a second normalization layer connected to the input of the convolutional gated linear unit layer, and a second droppath layer set between the convolutional gated linear unit layer and the fifth splicing layer.

[0041] This invention, through adding a first normalization layer and a second normalization layer before the multi-head attention mechanism layer and the convolutional gated linear unit layer, respectively, normalizes the features before each layer, stabilizing the feature distribution. Simultaneously, by adding a first path dropout layer and a second path dropout layer after the multi-head attention mechanism layer and the convolutional gated linear unit layer, the generalization ability of the neural network is improved and overfitting is mitigated by randomly "dropping" neurons.

[0042] In some embodiments of the present invention, the initial features include a first initial feature, a second initial feature, a third initial feature, and a fourth initial feature with different scales. The first initial feature is the feature output by the second initial convolutional layer, the second initial feature is the feature output by the third initial convolutional layer, the third initial feature is the feature output by the fourth initial convolutional layer, and the fourth initial feature is the feature output by the first convolutional layer and the feature output by the spatial pyramid fast pooling unit.

[0043] Then as Figure 5As shown, the feature fusion module includes a first fusion convolutional layer, a second fusion convolutional layer, a third fusion convolutional layer, and a fourth fusion convolutional layer, each corresponding to a first initial feature, a second initial feature, a third initial feature, and a fourth initial feature. It also includes a first bidirectional weighted feature pyramid unit that fuses the output features of the third and fourth fusion convolutional layers; a second bidirectional weighted feature pyramid unit that fuses the output features of the second fusion convolutional layer and the first bidirectional weighted feature pyramid unit; a third bidirectional weighted feature pyramid unit that fuses the output features of the first and second fusion convolutional layers; a fourth bidirectional weighted feature pyramid unit that fuses the output features of the third fusion convolutional layer, the first bidirectional weighted feature pyramid unit, and the third bidirectional weighted feature pyramid unit; and a fifth bidirectional weighted feature pyramid unit that fuses the features of the fourth bidirectional weighted feature pyramid unit.

[0044] It should be noted that: such as Figure 5 As shown, an upsampling layer is also included between the fourth fusion convolutional layer and the first bidirectional weighted feature pyramid unit. A C2F layer and an upsampling layer are also included between the first and second bidirectional weighted feature pyramid units. A C2F layer is also included between the second and third bidirectional weighted feature pyramid units. A C2F layer and a convolutional layer are also included between the third and fourth bidirectional weighted feature pyramid units and between the fourth and fifth bidirectional weighted feature pyramid units. Furthermore, a C2F layer is connected after the fifth bidirectional weighted feature pyramid unit.

[0045] Among them, such as Figure 6 As shown, the bidirectional weighted feature pyramid unit includes feature extraction and fusion paths in both top-down and bottom-up directions. Furthermore, the bidirectional weighted feature pyramid unit removes single-input edge nodes, simplifying the network structure and further improving feature fusion efficiency, thus enhancing fecal contamination detection efficiency. Simultaneously, the bidirectional weighted feature pyramid unit establishes supplementary connection paths between original input nodes at the same level, achieving richer feature interactions with extremely low computational overhead, ensuring the accuracy and reliability of features, and consequently ensuring the accuracy of fecal contamination detection.

[0046] To further improve the detection performance of the detection head, embodiments of the present invention have also improved the detection head, specifically, as follows: Figure 7 As shown, the detection head includes a cascaded first detection module, a second detection module, and a third detection module; The first detection module includes a cascaded first average pooling layer, a first detection convolutional layer, a first activation function layer, a second activation function layer, and a first detection splicing layer. The first detection splicing layer is used to splice the output of the first average pooling layer and the output of the second activation function layer.

[0047] The activation function of the first activation function layer is ReLU, and the activation function of the second activation function layer is Sigmod.

[0048] The second detection module includes a deformable convolutional layer, a regular convolutional layer, an offset layer, a third activation function layer, and a second detection concatenation layer. The offset layer is used to extract offset features from the output of the regular convolutional layer to obtain offset features. The third activation function layer is used to activate the output of the regular convolutional layer to obtain activation features. The second detection concatenation layer is used to concatenate the offset features, activation features, and the output of the deformable convolutional layer.

[0049] The activation function for the third activation function layer is Sigmod.

[0050] The third detection module includes a cascaded second average pooling layer, a first fully connected layer, a fourth activation function layer, a second fully connected layer, a detection normalization layer, a fifth activation function layer connected to the output of the second average pooling layer, and a third detection splicing layer connected to the output of the detection normalization layer. The third detection splicing layer is used to splice the spatial feature vectors of the output and input of the detection normalization layer to obtain a spliced ​​vector. The fifth activation function layer is used to activate the spliced ​​vector and the output of the second average pooling layer to obtain the detection results of manure in the pen.

[0051] The activation functions for the fourth and fifth activation function layers are ReLU.

[0052] This invention, through the use of deformable convolution and offset layers, enhances the flexibility of target detection and significantly improves its adaptability to detecting feces and sewage in complex pen environments. Specifically, targets of different scales exhibit different features and positional distributions in images. By adjusting the offset amount through the offset layer, the bounding boxes of targets at different scales can be flexibly adjusted. For example, when encountering small targets, the offset layer can help to more accurately frame the target with the bounding box; when encountering large targets, it can also prevent the bounding box from being too large and causing unnecessary background to be included, effectively improving positioning accuracy.

[0053] Furthermore, by setting a third detection splicing layer in the third detection module to splice the spatial feature vectors of the output and input of the detection normalization layer to obtain a spliced ​​vector, spatial perception capability is introduced to further improve the target positioning accuracy, that is, to improve the detection accuracy of manure in the pen.

[0054] It should be understood that before a fecal waste detection model can be practically applied to detection, it needs to be trained, tested, and validated based on a sample set to ensure the model's detection performance. Therefore, in some embodiments of the present invention, such as... Figure 8 As shown, before step S201, the procedure further includes: S801. Obtain the initial dataset of manure and sludge from the pen based on the image acquisition device, and remove defective data in the initial dataset of manure and sludge that do not meet the requirements to generate the manure and sludge dataset.

[0055] The strict biosecurity measures implemented by pig farms severely restrict data collection. External personnel and collection equipment must undergo multiple disinfection procedures (such as atomized disinfection and 48-hour quarantine) before entering the farm, significantly extending the data collection cycle. Furthermore, data on pen environmental parameters (such as temperature and humidity control strategies and pen density) and feeding management systems involve core farming technologies, and farms, for commercial reasons, often impose strict restrictions on data sharing. These issues result in a severe shortage of publicly available manure datasets, hindering the design of manure detection models and leaving insufficient data support.

[0056] To address the technical challenge of the scarcity of publicly available manure image datasets, this invention employs an image acquisition device to capture images of manure accumulation scenes in a large-scale pig farm environment, thereby obtaining an initial dataset of manure in the pigpens. Specifically, the initial dataset consists of data collected between 8:00-11:00 AM and 2:00-5:30 PM, representing the peak excretion period after active feeding by the pigs. The images are captured handheld, with the shooting distance between the device and the manure maintained at 80-100 cm to simulate the effect of a pigpen cleaning robot. The final manure images are uniformly saved in JPG format.

[0057] Because the initial dataset contains a large number of images with varying quality, it is necessary to filter them and identify defective data that does not meet the requirements. Specifically, defective data refers to images that are partially missing due to factors such as shooting angle or occlusion. For example, images that only capture the edges of feces or are largely obscured by other objects.

[0058] In other words, it is necessary to select samples with clear images, obvious fecal texture and details, and remove samples that are blurry, out of focus, or have poor image quality due to hand tremors.

[0059] S802. Perform data augmentation on the pen manure dataset to obtain the pen manure augmented dataset.

[0060] The data augmentation methods include, but are not limited to, applying single or combined techniques such as rotation, scaling, translation, mirroring, Gaussian blurring, and brightness adjustment to portions of the animal manure dataset. Simultaneously, the images were manually annotated using the source annotation tool LabelImg, with each piece of manure in the images labeled with a bounding box. The resulting YOLO format file was then generated. This yielded the augmented animal manure dataset.

[0061] S803. The initial manure detection model is trained, tested, and validated based on the manure augmentation dataset of the pen to obtain the manure detection model.

[0062] Specifically, the enhanced manure dataset for livestock pens was randomly divided into training, validation, and test sets in a 9:1:1 ratio to train, test, and validate the initial manure detection model.

[0063] The embodiments of the present invention enhance the fecal waste dataset by performing augmentation processing on the fecal waste dataset, thereby providing dataset diversity and enabling a comprehensive evaluation of the generalization ability and robustness of the fecal waste detection model.

[0064] It should be understood that the model training process depends on the loss function, and the selection or construction of the loss function has a significant impact on the performance of the finally trained fecal waste detection model. Therefore, in the specific embodiment of the present invention, the loss function used by the initial fecal waste detection model during training is a weighted sum of the EIOU loss function and the Inner-IOU loss function.

[0065] This invention reduces computational complexity by setting a loss function that includes the EIOU loss function. The EIOU loss function separates the aspect ratio factors of the bounding box and anchor box in the CIOU aspect ratio penalty term, allowing for separate calculations of the length and width of the bounding box and anchor box, respectively. Simultaneously, a Focal mechanism is incorporated, enabling the model to focus more on anchor boxes that significantly impact detection results, thereby improving overall detection performance. Furthermore, the loss function also includes the Inner-IOU loss function. Since the Inner-IOU loss function measures the similarity of the internal structure of samples, it not only focuses on the overall geometric relationship between the anchor box and the bounding box but also deeply compares the feature distribution of the regions within the two boxes. In other words, by setting the loss function as a weighted sum of the EIOU and Inner-IOU loss functions, the accuracy of fecal contamination detection results can be further improved.

[0066] Among them, the EIOU loss function and the Inner-IOU loss function are existing loss functions, and will not be described in detail here.

[0067] Based on the above-mentioned methods for detecting fecal waste in animal pens, such as Figure 9As shown, this embodiment of the invention also provides an intelligent pen cleaning robot 900, including: a camera 910 and a fecal waste detection module 920; Camera 910 is used to acquire images of manure and sludge in the pen; The feces detection module 920 is used to detect feces images in the pen based on the pen feces detection method and obtain the feces detection results in the pen. The method for detecting manure in the pen can be any of the methods described in the above embodiments.

[0068] Since the ultimate goal of the intelligent pen cleaning robot 900 is to clean up the detected fecal matter in the pens, therefore, in some embodiments of the present invention, such as Figure 9 As shown, the intelligent enclosure cleaning robot 900 also includes a decision-making module 930, an execution module 940, and an interaction module 950; The interaction module 950 is used to receive human input actions and generate input instructions based on the human input actions; The decision module 930 is used to generate cleaning instructions based on the results of manure detection in the pen and / or input instructions; The execution module 940 is used to clean the enclosure in response to cleaning instructions.

[0069] The execution module 940 includes a drive motor, a motion control mechanism, and a cleaning mechanism, which enable autonomous movement and efficient cleaning through these multiple structures.

[0070] This invention adds an interactive module, providing users with an intervention window to actively control the cleaning robot. Through a human-machine collaboration mechanism, it significantly improves the robot's fault tolerance and adaptability to complex scenarios. Furthermore, the intelligent pen cleaning robot can autonomously complete pen inspections, manure identification, and cleaning tasks, improving the efficiency of pen hygiene management in large-scale pig farms.

[0071] In specific embodiments of the present invention, such as Figure 10 As shown, the workflow of the intelligent pen cleaning robot is as follows: When starting the intelligent pen cleaning robot, first turn on the battery switch and press the start button to initialize the robot. After initialization, the robot's drive and sensing components activate. The robot then uses a high-precision camera mounted on its end effector to collect real-time video data of the pen environment, identifying fecal targets and calculating their location. This location information is then sent to the decision-making module. The decision-making module generates the optimal cleaning strategy based on the received instructions and sends movement commands to the drive module. The drive module moves the robot to the designated work point and activates the high-pressure nozzles at the end effector for cleaning. During cleaning, the robot monitors the cleaning effect in real time. Once the cleaning is deemed satisfactory, the high-pressure nozzles automatically shut off, and the robot moves to the next cleaning point. This process is repeated until all pen cleaning tasks are completed.

[0072] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.), and the computer program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0073] The above provides a detailed description of the pen manure detection method and intelligent pen manure cleaning robot provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for detecting manure and waste in livestock pens, characterized in that, include: The system receives images of manure and waste in the pen and inputs these images into a manure and waste detection model. The manure and waste detection model includes an initial feature extraction module, a dual-branch feature learning and fusion module, a detection head, and a feature fusion module that includes bidirectional weighted feature pyramid units. The initial features of the manure image in the pen are extracted based on the initial feature extraction module. Based on the dual-branch feature learning and fusion module, the initial features are divided into channel dimensions and dual-channel features are learned and fused to obtain the target features; The initial features and the target features are fused based on the feature fusion module to obtain fused features; The detection head is used to detect the fused features to obtain the detection results of manure in the pen.

2. The method for detecting manure in livestock pens according to claim 1, characterized in that, The dual-branch feature learning and fusion module includes a cascaded first dual-branch feature learning and fusion unit, a first convolutional layer, a second dual-branch feature learning and fusion unit, and a spatial pyramid fast pooling unit; The first dual-branch feature learning and fusion unit is used to perform channel dimension division and dual-channel feature learning and fusion on the initial features to obtain the first preliminary learned features; The first convolutional layer is used to perform a convolution operation on the initially learned features to obtain the first extracted features; The second dual-branch feature learning and fusion unit is used to perform channel dimension division and dual-channel feature learning and fusion on the first extracted features to obtain the second preliminary learned features; The spatial pyramid fast pooling unit is used to perform fast pooling on the second preliminary learned features to obtain the target features.

3. The method for detecting manure in livestock pens according to claim 2, characterized in that, The first dual-branch feature learning and fusion unit includes a segmentation layer, a first branch, a second branch connected in parallel with the first branch, a first concatenation layer, and a second convolutional layer. The first branch includes a third convolutional layer, a fourth convolutional layer, and a third concatenation layer. The second branch includes a multi-head attention mechanism layer, a fourth concatenation layer, a convolutional gated linear unit layer, and a fifth concatenation layer. The segmentation layer is used to segment the initial features along the channel dimension, dividing them into first channel features and second channel features; The third and fourth convolutional layers are used to sequentially perform convolution operations on the first channel features to obtain channel convolutional features; The third splicing layer is used to splice the channel convolutional features and the first channel features to obtain the first branch features; The multi-head attention mechanism layer is used to perform multi-head attention learning on the second channel features to obtain multi-head attention features; The fourth splicing layer is used to splice the multi-head attention features and the second channel features to obtain preliminary splicing features; The convolutional gated linear unit layer is used to perform feature transfer and learning on the preliminary spliced ​​features to obtain transferred features; The fifth splicing layer is used to splice the transmitted features and the preliminary splicing features to obtain the second branch features; The first splicing layer is used to splice the first branch feature and the second branch feature to obtain the channel splicing feature; The second convolutional layer is used to perform convolution processing on the channel splicing features to obtain the first preliminary learned features.

4. The method for detecting manure in livestock pens according to claim 3, characterized in that, The second branch further includes a first normalization layer connected to the input of the multi-head attention mechanism layer, a first path drop-out layer disposed between the multi-head attention mechanism layer and the fourth splicing layer, a second normalization layer connected to the input of the convolutional gated linear unit layer, and a second path drop-out layer disposed between the convolutional gated linear unit layer and the fifth splicing layer.

5. The method for detecting manure in livestock pens according to claim 1, characterized in that, The initial features include a first initial feature, a second initial feature, a third initial feature, and a fourth initial feature with different scales; the feature fusion module includes a first fusion convolutional layer, a second fusion convolutional layer, a third fusion convolutional layer, and a fourth fusion convolutional layer corresponding one-to-one with the first initial feature, the second initial feature, the third initial feature, and the fourth initial feature; a first bidirectional weighted feature pyramid unit that fuses the output features of the third fusion convolutional layer and the fourth fusion convolutional layer; a second bidirectional weighted feature pyramid unit that fuses the output features of the second fusion convolutional layer and the first bidirectional weighted feature pyramid unit; a third bidirectional weighted feature pyramid unit that fuses the output features of the first fusion convolutional layer and the second bidirectional weighted feature pyramid unit; a fourth bidirectional weighted feature pyramid unit that fuses the features of the third fusion convolutional layer, the first bidirectional weighted feature pyramid unit, and the output of the third bidirectional weighted feature pyramid unit; and a fifth bidirectional weighted feature pyramid unit that fuses the features of the fourth bidirectional weighted feature pyramid unit.

6. The method for detecting manure in livestock pens according to claim 1, characterized in that, The detection head includes a cascaded first detection module, a second detection module, and a third detection module; The first detection module includes a cascaded first average pooling layer, a first detection convolutional layer, a first activation function layer, a second activation function layer, and a first detection splicing layer. The first detection splicing layer is used to splice the output of the first average pooling layer and the output of the second activation function layer. The second detection module includes a deformable convolutional layer, a regular convolutional layer, an offset layer, a third activation function layer, and a second detection splicing layer. The offset layer is used to extract offset features from the output of the regular convolutional layer to obtain offset features. The third activation function layer is used to activate the output of the regular convolutional layer to obtain activation features. The second detection splicing layer is used to splice the offset features, the activation features, and the output of the deformable convolutional layer. The third detection module includes a cascaded second average pooling layer, a first fully connected layer, a fourth activation function layer, a second fully connected layer, a detection normalization layer, a fifth activation function layer connected to the output of the second average pooling layer, and a third detection splicing layer connected to the output of the detection normalization layer. The third detection splicing layer is used to splice the spatial feature vectors of the output and input of the detection normalization layer to obtain a spliced ​​vector. The fifth activation function layer is used to activate the spliced ​​vector and the output of the second average pooling layer to obtain the detection result of the manure in the pen.

7. The method for detecting manure in livestock pens according to claim 1, characterized in that, Before receiving images of manure and sludge in the pen, the method further includes: An initial dataset of manure and sludge from the pen is obtained using an image acquisition device, and defective data that does not meet the requirements in the initial dataset of manure and sludge from the pen are removed to generate a dataset of manure and sludge from the pen. Data augmentation is performed on the aforementioned pen manure dataset to obtain an augmented pen manure dataset; The initial fecal waste detection model was trained, tested, and validated based on the enhanced fecal waste dataset of the pen, and the fecal waste detection model was obtained.

8. The method for detecting manure in livestock pens according to claim 7, characterized in that, The initial fecal waste detection model uses a weighted sum of the EIOU loss function and the Inner-IOU loss function during training.

9. A smart pen cleaning robot, characterized in that, include: Camera and sewage detection module; The camera is used to acquire images of manure and sewage in the pen; The fecal waste detection module is used to detect the fecal waste image of the pen based on the pen fecal waste detection method, and obtain the pen fecal waste detection result; The method for detecting manure in the pen is the same as the method for detecting manure in the pen as described in any one of claims 1-8.

10. The intelligent enclosure cleaning robot according to claim 9 further includes a decision-making module, an execution module, and an interaction module; The interaction module is used to receive human input actions and generate input instructions based on the human input actions; The decision module is used to generate a cleaning instruction based on the results of the manure detection in the pen, and / or the input instruction; The execution module is used to clean the enclosure in response to the cleaning command.