Real-time pig health monitoring method for complex environment
Through YOLOv8 and pig sound state recognition model combined with hierarchical analysis method, the robustness and real-time problems of pig behavior recognition in complex environments are solved, and high-accurate pig health monitoring is achieved, and accurate diagnosis and timely intervention of the farm are supported.
Patent Information
- Application Number
- CN202510416726.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-07-11
AI Technical Summary
The existing pig behavior recognition technology is not robust enough in the dynamic context, and has poor lighting robustness and real-time performance, making it difficult to meet the accurate identification needs in complex breeding scenarios.
Using the pig behavior recognition model based on YOLOv8, combined with the pig sound state recognition classification model and hierarchical analysis method, a pig health evaluation system is established through a multi-level deep learning model to achieve accurate assessment of the pig health status.
Highly accurate micro behavior recognition and health status assessment are achieved in complex environments, the ability to detect cough sounds is improved, and an accurate pig health assessment system is provided to support accurate diagnosis and timely intervention.
Smart Images

Figure CN120299066A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of livestock health monitoring, and particularly to a real-time health monitoring method for pigs facing complex environments. Background Art
[0002] In the field of pig breeding, behavior recognition technology is of great significance for monitoring the health status of pigs and optimizing feeding management. At present, pig behavior recognition methods based on computer vision mainly include traditional rule-based methods and advanced methods based on machine learning and deep learning.
[0003] In the prior art, traditional machine learning-based solutions (such as decision trees and support vector machines) extract geometric features through mean shift segmentation and morphological processing to achieve pose classification, but they lack robustness in dynamic backgrounds; methods based on object tracking (such as the fusion of multi-feature Camshift and Kalman filtering) can achieve real-time tracking of multiple targets, but are easily interfered by complex lighting conditions; while the improved Mask R-CNN algorithm based on deep learning improves the recognition accuracy of drinking behavior through refined segmentation, but its high computational complexity limits its application in low-computing-power scenarios. In summary, the current methods have significant defects in dynamic background adaptability, light robustness, and real-time performance, and are difficult to meet the accurate recognition requirements in complex breeding scenarios.
[0004] Therefore, in the related art, there is an urgent need for a way to recognize pig behavior and monitor health that can balance algorithm efficiency, environmental adaptability, and recognition accuracy. Summary of the Invention
[0005] Based on this, in view of the above technical problems, it is necessary to provide a real-time health monitoring method for pigs facing complex environments that can balance algorithm efficiency, environmental adaptability, and recognition accuracy.
[0006] In a first aspect, the present application provides a real-time health monitoring method for pigs facing complex environments. The method includes:
[0007] Construct a pig behavior recognition model based on YOLOv8 to obtain pig action behavior feature data;
[0008] Establish a pig sound state recognition and classification model to obtain pig sound feature data;
[0009] Establish a pig health evaluation system based on the analytic hierarchy process, and evaluate the health status of pigs based on the pig action behavior feature data and pig sound feature data in combination with the pig health evaluation system.
[0010] Optionally, in an embodiment of the present application, the constructing a pig behavior recognition model based on YOLOv8 includes:
[0011] Enhance the deformable convolutional network module using the channel-spatial attention mechanism module to obtain a deformable convolution and channel-spatial attention mechanism module;
[0012] Improve the backbone structure of YOLOv8 based on the deformable convolution and channel-spatial attention mechanism module;
[0013] The neck network adopts the path aggregation network PAN and the feature pyramid network, and improves the detection head network based on the WIOU loss function.
[0014] Optionally, in an embodiment of the present application, the establishing a pig sound state recognition and classification model and obtaining pig sound feature data includes:
[0015] Collect pig sound signals and perform frame preprocessing using a Hamming window;
[0016] Describe the characteristics of the pig sound signals after frame preprocessing to obtain combined features;
[0017] Based on the combined features, perform local feature extraction and global feature extraction respectively to obtain pig sound feature data.
[0018] Optionally, in an embodiment of the present application, the performing local feature extraction and global feature extraction respectively based on the combined features to obtain pig sound feature data includes:
[0019] Construct a CNN and Transformer dual-stream parallel network to perform local feature extraction and global feature extraction on the combined features, directly splice the extracted local features and global features by dimension to obtain a high-dimensional feature signal, and input it into a linear layer for linear transformation and dimension adjustment to obtain pig sound feature data.
[0020] Optionally, in an embodiment of the present application, the establishing a pig health evaluation system based on the analytic hierarchy process includes:
[0021] Hierarchically classify the health status evaluation objectives into first-level indicators and second-level indicators. The first-level indicators include pig behavior and pig sound, and the second-level indicators include the number of behavior occurrences per hour and the frequency of sound occurrences per hour;
[0022] Construct a judgment matrix, use the judgment matrix to compare each index pairwise, and calculate the index weight distribution.
[0023] Optionally, in an embodiment of the present application, after constructing the judgment matrix, it further includes:
[0024] Check the consistency of the judgment matrix.
[0025] Optionally, in an embodiment of the present application, the evaluation of the health status of pigs by combining the pig action behavior characteristic data and the pig sound characteristic data with the pig health evaluation system includes:
[0026] Determine the factor set and the comment set based on the pig health evaluation system;
[0027] Establish a membership function to map pig behavior and sound indicators to the health status evaluation level;
[0028] Use the fuzzy synthesis method to calculate the membership degree of the health status comment based on the factor set, the comment set and the membership function, and determine the health status of the pig based on the membership degree.
[0029] In a second aspect, the present application also provides a real-time health monitoring device for pigs in a complex environment. The device includes:
[0030] An action behavior characteristic acquisition module, configured to construct a pig behavior recognition model based on YOLOv8 and acquire pig action behavior characteristic data;
[0031] A sound characteristic acquisition module, configured to establish a pig sound state recognition and classification model and acquire pig sound characteristic data;
[0032] A health status evaluation module, configured to establish a pig health evaluation system based on the analytic hierarchy process, and evaluate the health status of pigs by combining the pig action behavior characteristic data and the pig sound characteristic data with the pig health evaluation system.
[0033] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the steps of the methods in the above respective embodiments.
[0034] In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the methods in the above respective embodiments are implemented.
[0035] The above real-time pig health monitoring method for complex environments first constructs a pig behavior recognition model based on YOLOv8 to obtain pig action behavior feature data. Then, a pig sound state recognition and classification model is established to obtain pig sound feature data. Finally, a pig health evaluation system is established based on the analytic hierarchy process, and the health status of pigs is evaluated based on the pig action behavior feature data and pig sound feature data in combination with the pig health evaluation system. That is to say, aiming at the needs of micro-behavior recognition and real-time monitoring in complex breeding environments, a behavior classification method based on a multi-level deep learning model is proposed, and a high-accuracy micro-behavior recognition effect is obtained even in high-density group breeding and occluded environments. Aiming at the problem of noise interference in pigsty environments, a joint recognition model based on a deep convolutional neural network and noise suppression technology is proposed, effectively improving the detection ability of cough sounds and enabling it to accurately identify the health status of pigs even in complex pigsty noise environments. Aiming at the problem of pig health assessment based on multi-modal data fusion, a health assessment model based on multi-dimensional index fusion and hierarchical ranking is proposed to obtain accurate and operable pig health status assessment results, providing an accurate and comprehensive pig health assessment system for farms and helping with precise diagnosis and timely intervention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 FIG. is an application environment diagram of a real-time pig health monitoring method for complex environments in an embodiment;
[0037] Figure 2 FIG. is a schematic flowchart of a real-time pig health monitoring method for complex environments in an embodiment;
[0038] Figure 3 FIG. is a schematic structural diagram of a pig behavior recognition model in an embodiment;
[0039] Figure 4 FIG. is a schematic structural diagram of a global feature extraction network in an embodiment;
[0040] Figure 5 FIG. is a schematic diagram of a pig health evaluation system in an embodiment;
[0041] Figure 6 FIG. is a structural block diagram of a real-time pig health monitoring device for complex environments in an embodiment;
[0042] Figure 7 FIG. is an internal structural diagram of a computer device in an embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0043] To make the objectives, technical solutions and advantages of this application more clear and understandable, the following further details this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely used to explain this application and are not used to limit this application.
[0044] A real-time pig health monitoring method for complex environments provided by an embodiment of this application can be applied to an application environment as Figure 1 shown. Among them, the terminal communicates with the server through the network. The data storage system can store the data that the server needs to process. The data storage system can be integrated on the server, or placed in the cloud or other network servers. Among them, the terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, Internet of Things devices, and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented by an independent server or a server cluster composed of multiple servers.
[0045] In one embodiment, as Figure 2 shown, a real-time pig health monitoring method for complex environments is provided. Taking the method applied to the Figure 1 server as an example, it includes the following steps:
[0046] S201: Build a pig behavior recognition model based on YOLOv8 to obtain pig action behavior feature data.
[0047] In the embodiment of this application, first, in the face of the complex situations of livestock and poultry mutual occlusion, high-density group breeding, insufficient light in the livestock and poultry breeding environment, breeding environment, etc. in the real application scenario, a DACN-YOLO model that can accurately identify pig behavior in complex scenarios is built based on YOLOv8 to obtain the frequency information of the daily action behavior of pigs. The goal of object detection is to locate the position of the pig (i.e., the bounding box) in the image through the output of the model. For the pig behavior recognition model, assuming that the size of the input image is H×W, the output prediction obtained after model processing is: the coordinates (x, y, w, h) of the bounding box, where (x, y) is the center coordinate of the bounding box, w and h are the width and height of the bounding box respectively, the confidence p represents the probability that the prediction box contains a pig, and the class probability C represents the probability that the box belongs to a certain pig behavior (such as normal, abnormal).
[0048] The model calculates the confidence of each prediction box through the following formula:
[0049]
[0050] where σ is the activation function, is the predicted probability, I true is the ground truth annotation (1 if the bounding box contains pig behavior markers, 0 otherwise), is the predicted error probability.
[0051] Specifically, in an embodiment of the present application, the pig behavior recognition model constructed based on YOLOv8 includes:
[0052] S301: Use the channel-spatial attention mechanism module to enhance the deformable convolution network module to obtain a deformable convolution and channel-spatial attention mechanism module.
[0053] S303: Improve the backbone structure of YOLOv8 based on the deformable convolution and channel-spatial attention mechanism module.
[0054] S305: The neck network adopts the Path Aggregation Network (PAN) and Feature Pyramid Network (FPN), and improves the detection head network based on the WIOU loss function.
[0055] In an embodiment of the present application, as Figure 3 shown, it is a schematic structural diagram of the pig behavior recognition model. In order to better adapt to the dynamic changes of pig behavior in complex backgrounds, the deformable convolution network module (Deformable Convolution Networks, DCN) and the channel-spatial attention mechanism module (Channel and Position-wise Attention, CPCA) are introduced. The CPCA is used to enhance the DCN module to form a deformable convolution and channel-spatial attention (DCN-CPCA) module. Among them, the formula of the deformable convolution network module (DCN) is:
[0056]
[0057] where N is the receptive field of the convolution kernel, p is the position of the input image, Δp is the offset, representing the dynamic change of the convolution kernel, and w(p,Δp) is the weight of the convolution kernel.
[0058] The formula of the channel-spatial attention mechanism module (CPCA) is:
[0059] A = Sigmoid(Wc·Fc·Ws)
[0060] where Wc and Ws are the attention weight matrices of the channel and space respectively, and Fc is the channel information of the input feature, representing the features of different pig behaviors.
[0061] Improve the backbone structure of YOLOv8 based on deformable convolution and channel-spatial attention mechanism modules. Specifically, use deformable convolution and channel-spatial attention mechanism modules at the back of the backbone network for the original C2f layer, replace the traditional convolution operation with the optimized DCN-CPCA, and form a new DC-C2f module with the backbone network. Through the DC-C2f module, the feature map F will be extracted and enhanced to form a high-order representation of the behavior. Set the feature map F as:
[0062] F = DC-C2f(I)
[0063] where I is the input image and F is the output feature map. After multi-scale feature fusion, it can adapt to pig behaviors of different sizes.
[0064] Based on these feature maps, a fully connected layer can be used to classify the behaviors. Assume the output class probability P behave is:
[0065] P behave = Softmax(W behave ·F)
[0066] where W behave is the weight matrix for behavior classification, and the Softmax function converts the output into a probability distribution, representing the probability that the pig behavior belongs to normal or abnormal.
[0067] The neck network adopts the Path Aggregation Network (PAN) and the Feature Pyramid Network (FPN), and improves the detection head network based on the WIOU loss function. Specifically, the loss function in object detection is used to optimize the prediction of the bounding boxes. The detection head network is improved based on the WIOU loss function to adjust the loss weights according to the change frequencies and importance of different pig behaviors.
[0068] The WIoU loss function is defined as:
[0069]
[0070] where N is the number of target boxes, B i and are the ground truth bounding box and the predicted bounding box respectively, is the intersection over union (IoU) of the target box and the predicted box, and γ is a tuning parameter.
[0071] After combining the DC-C2f module and the WIoU loss function with YOLOv8, the DACN-YOLO model is obtained. The final loss function of the model can be expressed as:
[0072]
[0073] where is the confidence loss in object detection, is the WIoU loss, which is used to improve the accuracy of bounding boxes, is the loss function for behavior classification, which is used to identify the abnormal behaviors of pigs. λ1 and λ2 are adjustment parameters that control the weights of different loss terms.
[0074] Finally, through the classification of pig behaviors and the localization of bounding boxes, it is possible to identify whether a pig exhibits abnormal behaviors. For example, by calculating the class probability P behave [abnormal], and setting a threshold T,
[0075] P abnormal = P behave [abnormal]
[0076] If P abnormal > T, it is determined as an abnormal behavior, and an abnormal behavior alarm is triggered.
[0077] S203: Establish a recognition and classification model for pig sound states, and obtain pig sound feature data.
[0078] In the embodiment of the present application, in order to accurately identify pig sound signals and classify the sound signals into cheerful calls, angry calls, struggling calls, coughing sounds, etc., a recognition and classification model for pig sound states is established. By learning the characteristic patterns of different types of sounds, the input sound signal is compared with the learned patterns, and the probabilities of different classes are output.
[0079] Specifically, in an embodiment of the present application, the establishment of the recognition and classification model for pig sound states and the obtaining of pig sound feature data include:
[0080] S401: Collect pig sound signals and perform frame preprocessing using a Hamming window.
[0081] S403: Describe the characteristics of the pig sound signals after frame preprocessing to obtain combined features.
[0082] S405: Based on the combined features, perform local feature extraction and global feature extraction respectively to obtain pig sound feature data.
[0083] In an embodiment of the present application, first, in order to reduce the influence of environmental noise on the recognition accuracy, the sound signal is framed using a Hamming window, and the continuity of the signal is ensured by overlapping frames. The frame formula is:
[0084]
[0085] Wherein, N is the length of the sound signal, overlap is the length of the overlapping part, inc is the frame shift length, and wlen is the short-time frame length.
[0086] Formula for the frame start position:
[0087] startindex = (0:(fn - 1)) * inc + 1
[0088] Hamming Window function:
[0089]
[0090] After that, to more comprehensively collect the sound characteristics of pigs and better capture the complex information in the sound signal, the characteristics of the sound signal are described from different perspectives. Extract the number Mel spectrogram (LM), Mel-frequency cepstral coefficients (MFCC), chroma feature (Chroma), spectral contrast (Spectral Contrast), and Tonnetz of the sound. MFCC and CST (collectively referred to as chroma, spectral contrast, and tonnetz) are aggregated into MC, LM and CST are combined to form LMC, and finally MC and LMC are combined into MLMC.
[0091] Finally, local feature extraction and global feature extraction are respectively performed based on the combined features to obtain pig sound feature data.
[0092] Specifically, in an embodiment of the present application, the local feature extraction and global feature extraction are respectively performed based on the combined features to obtain pig sound feature data, including:
[0093] Construct a CNN and Transformer dual-stream parallel network to perform local feature extraction and global feature extraction on the combined features, directly splice the extracted local features and global features according to the dimension to obtain a high-dimensional feature signal, and input it into a linear layer for linear transformation and dimension adjustment to obtain pig sound feature data.
[0094] In an embodiment of the present application, to obtain a feature signal containing richer information and improve the accuracy of pig sound classification, use a CNN module and a Transformer module to perform high-dimensional feature extraction on MLMC (145×55), directly splice the 2×145-dimensional data and 2×512-dimensional features of the high-dimensional feature data extracted by the two modules according to the dimension, and reorganize them into a new high-dimensional vector to form a new feature signal. Input the merged high-dimensional feature signal into a linear layer, map it to a suitable dimensional space after linear transformation and dimension adjustment, and finally obtain 657×2-dimensional features.
[0095] Specifically, a CNN (Convolutional Neural Networks) module is introduced to extract the local features of pig sound signals. A convolutional neural network with 4 convolutional layers is used, and each convolutional layer uses a 3x3 convolutional kernel. The convolutional operation is as follows:
[0096]
[0097] Among them, W m,n is the convolutional kernel weight, and b is the bias term.
[0098] The specific structure is as follows:
[0099] Taking the combined feature MLMC as the input for local feature extraction, and adding the ReLU activation function to solve the gradient vanishing problem. The output of the convolutional layer is:
[0100] Con(x) = ReLU(BatchNorm(Conv2d(X)))
[0101] As Figure 4 shown, the encoder part of the Transformer is used. A Transformer encoder is constructed by stacking 2 encoder layers. Each layer contains a multi-head attention mechanism and a feed-forward neural network. The multi-head attention mechanism is:
[0102] Mulihead(Q,K,V) = Concat(head1,head2,…,head h )W o
[0103] Among them, head i =(QWi i Q ,KW i K ,VW i V ),W i Q ,W i K ,W i V .
[0104] After inputting the MLMC vector data, in order to capture richer pig call speech features, weights are assigned to each single head of the multi-head attention mechanism:
[0105]
[0106] Among them, Q, K, and V are the query, key, and value matrices respectively, and dk is the dimension of the key vector.
[0107] S205: Establish a pig health evaluation system based on the Analytic Hierarchy Process (AHP). Evaluate the health status of pigs based on the pig action behavior characteristic data and pig sound characteristic data in combination with the pig health evaluation system.
[0108] In the embodiments of the present application, after extracting the action behavior data and sound characteristic data of pigs, to achieve the comprehensive quantification and scientific evaluation of the health status of pigs, starting from the two core dimensions of behavior and sound, through constructing a hierarchical index system and optimizing the weight allocation algorithm, the health status of pigs is intelligently monitored.
[0109] Specifically, in an embodiment of the present application, the establishment of the pig health evaluation system based on the Analytic Hierarchy Process (AHP) includes:
[0110] S501: Hierarchically classify the health status evaluation target into first-level indicators and second-level indicators. The first-level indicators include pig behavior and pig sound, and the second-level indicators include the number of behavior occurrences per hour and the frequency of sound occurrences per hour.
[0111] S503: Construct a judgment matrix, use the judgment matrix to compare each pair of indicators, and calculate the index weight allocation.
[0112] In an embodiment of the present application, aiming at the problems of fuzzy and single evaluation indicators for the health status of pigs, a multi-dimensional evaluation index system is constructed using the Analytic Hierarchy Process (AHP). First, hierarchically classify the health status evaluation target. The target layer is "the health status of pigs", and the upper layer is the evaluation criteria, including two first-level indicators: behavior performance and sound performance. Each first-level indicator is further decomposed into multiple second-level indicators. As Figure 5 shown, the first-level indicators include pig behavior (such as lying prone, lying on the side, standing, sitting like a dog, etc.) and pig sound (such as happy barking, angry barking, struggling barking, coughing sound, etc.), and the second-level indicators include the number of behavior occurrences per hour (such as the duration of lying prone behavior per hour, the duration of standing behavior per hour, etc.) and the frequency of sound occurrences per hour (such as the number of happy barking per hour, the number of coughing sound per hour, etc.).
[0113] Construct a judgment matrix, assign corresponding weights to the lower-layer elements x1, x2,..., x n dominated by the criterion a according to the importance degree between each pair, and accurately allocate the weights of each element. And use the judgment matrix to compare each pair of indicators, and calculate the index weight allocation. When allocating weights, define a ij as the relative importance degree of any two elements x i and x j under the criterion a, and summarize the relative importance degrees between each element. As shown in Table 1 below, it is the judgment matrix scale comparison table.
[0114]
[0115] Table 1
[0116] In order to obtain the relative importance of each element, it is necessary to calculate the eigenvector of the judgment matrix. The commonly used method is the geometric mean method, and the specific calculation formula is:
[0117]
[0118] In an embodiment of the present application, after constructing the judgment matrix, it further includes:
[0119] Checking the consistency of the judgment matrix.
[0120] In an embodiment of the present application, the accuracy of the judgment matrix is crucial for the evaluation result. Therefore, it is necessary to check the consistency of the matrix. By calculating the maximum eigenvalue λ max and performing the test of the consistency index (C.I.) to ensure the consistency of the expert scores. The specific formula is:
[0121]
[0122] If the C.I. value is less than 0.1, it means that the consistency of the judgment matrix is good, and the subsequent calculations can be continued.
[0123] In an embodiment of the present application, the evaluation of the pig's health status based on the pig's action behavior characteristics data and the pig's sound characteristics data in combination with the pig's health evaluation system includes:
[0124] S601: Determining the factor set and the comment set based on the pig's health evaluation system.
[0125] S603: Establishing a membership function to map the pig's behavior and sound indicators to the health status evaluation levels.
[0126] S605: Using the fuzzy synthesis method to calculate the membership degree of the health status comment based on the factor set, the comment set and the membership function, and determining the pig's health status based on the membership degree.
[0127] In an embodiment of the present application, in order to comprehensively evaluate the pig's health status, it is necessary to first construct the factor set and the comment set. According to the established pig's health status evaluation index system, the factor set for the pig's health status evaluation can be obtained. The factor set includes two categories: the pig's behavior (such as lying down, standing, etc.) and the sound (such as cheerful calls, angry calls, etc.). The comment set is used to represent different levels of the pig's health status, including "normal state" and "abnormal state", etc.
[0128] After that, membership functions are established and used to map pig behaviors and sound indicators to the evaluation grades of health status. Optionally, trapezoidal functions and semi-trapezoidal functions are used as the membership functions for the fuzzy comprehensive evaluation of pig health status. The hypotenuses of the trapezoidal functions and semi-trapezoidal functions are used to characterize the fuzzy boundaries between elements of the evaluation set, eliminating the sudden changes in indicator values between different states. When establishing the membership functions, trapezoidal functions or semi-trapezoidal functions are selected according to different health statuses.
[0129] The specific membership functions can be expressed as:
[0130]
[0131] After establishing the factor set, evaluation set, and membership functions, the fuzzy synthesis method in fuzzy mathematics is used to quantitatively evaluate the health status of pigs. The result of the fuzzy synthesis calculation gives the membership degree of each health status evaluation. Through this membership degree, the health status of pigs can be finally judged.
[0132] Each row of the judgment matrix R represents the membership degree of the element of the corresponding factor set in the final evaluation fuzzy set B. The judgment matrix contains various evaluation factors of the pig health status, such as the behavior data and sound characteristics of pigs. The fuzzy weight vector A reflects the importance of each factor in the final health status evaluation, and the weights are obtained from the analytic hierarchy process. By performing a fuzzy synthesis operation on the judgment matrix R and the fuzzy weight vector A, the final fuzzy evaluation vector B is obtained, and the formula is expressed as:
[0133] B = A · R
[0134] Among them, A is the fuzzy weight vector, R is the judgment matrix, and the operation result B represents the final fuzzy evaluation result.
[0135] The fuzzy evaluation vector B is a two-dimensional vector [b1, b2]. Among them, b1 is the membership degree of the evaluation result belonging to the normal state in this evaluation, and b2 is the membership degree of the evaluation result belonging to the abnormal state. After obtaining the fuzzy evaluation vector B, the final health status evaluation result is determined by selecting the larger one of b1 and b2. If b1 > b2, the pig health status is rated as "normal state"; if b2 > b1, it is rated as "abnormal state".
[0136] In the above-mentioned real-time pig health monitoring method for complex environments, first, a pig behavior recognition model is constructed based on YOLOv8 to obtain pig action behavior characteristic data; then, a pig sound state recognition and classification model is established to obtain pig sound characteristic data; finally, a pig health evaluation system is established based on the analytic hierarchy process, and the pig health state is evaluated based on the pig action behavior characteristic data and the pig sound characteristic data in combination with the pig health evaluation system. That is to say, in response to the needs of micro-behavior recognition and real-time monitoring in complex breeding environments, a behavior classification method based on a multi-level deep learning model is proposed, and a micro-behavior recognition effect with high accuracy is obtained even in high-density group breeding and occlusion environments. In response to the problem of noise interference in pigsty environments, a joint recognition model based on a deep convolutional neural network and noise suppression technology is proposed, effectively improving the detection ability of cough sounds, enabling it to accurately identify the health state of pigs even in environments with complex pigsty noises. In response to the problem of pig health assessment based on multi-modal data fusion, a health assessment model based on multi-dimensional index fusion and hierarchical ranking is proposed, obtaining an accurate and operable pig health state assessment result, providing an accurate and comprehensive pig health assessment system for farms, and contributing to precise diagnosis and timely intervention.
[0137] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown sequentially according to the arrows, these steps do not necessarily have to be executed in the order indicated by the arrows. Unless there is a clear indication in this article, there is no strict order limit for the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages do not necessarily have to be executed at the same time, but can be executed at different times. The execution order of these steps or stages does not necessarily have to be sequential, but can be executed alternately or in turn with at least some of the steps or stages in other steps or other steps.
[0138] Based on the same inventive concept, an embodiment of the present application also provides a real-time pig health monitoring device for complex environments for implementing the above-mentioned real-time pig health monitoring method for complex environments. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the real-time pig health monitoring device for complex environments provided below can refer to the limitations for the real-time pig health monitoring method for complex environments in the above text, and will not be repeated here.
[0139] In one embodiment, as Figure 6As shown in the figure, a real-time pig health monitoring device 600 for complex environments is provided, including: an action behavior feature acquisition module 601, a sound feature acquisition module 603, and a health status evaluation module 605, where:
[0140] The action behavior feature acquisition module 601 is used to build a pig behavior recognition model based on YOLOv8 and obtain pig action behavior feature data.
[0141] The sound feature acquisition module 603 is used to establish a pig sound state recognition and classification model and obtain pig sound feature data.
[0142] The health status evaluation module 605 is used to establish a pig health evaluation system based on the analytic hierarchy process, and evaluate the pig health status based on the pig action behavior feature data and pig sound feature data in combination with the pig health evaluation system.
[0143] In an embodiment of the present application, the action behavior feature acquisition module is further used for:
[0144] Use a channel-spatial attention mechanism module to enhance the deformable convolutional network module to obtain a deformable convolution and a channel-spatial attention mechanism module;
[0145] Improve the backbone structure of YOLOv8 based on the deformable convolution and the channel-spatial attention mechanism module;
[0146] The neck network adopts a path aggregation network PAN and a feature pyramid network, and improves the detection head network based on the WIOU loss function.
[0147] In an embodiment of the present application, the sound feature acquisition module is further used for:
[0148] Collect pig sound signals and perform frame-by-frame preprocessing using a Hamming window;
[0149] Describe the characteristics of the pig sound signals after frame-by-frame preprocessing to obtain combined features;
[0150] Based on the combined features, perform local feature extraction and global feature extraction respectively to obtain pig sound feature data.
[0151] In an embodiment of the present application, the sound feature acquisition module is further used for:
[0152] Construct a CNN and Transformer dual-stream parallel network to perform local feature extraction and global feature extraction on the combined features, directly splice the extracted local features and global features by dimension to obtain a high-dimensional feature signal, and input it into a linear layer for linear transformation and dimension adjustment to obtain pig sound feature data.
[0153] In one embodiment of the present application, the health status evaluation module is further configured to:
[0154] Hierarchically classify the health status evaluation objectives into primary indicators and secondary indicators. The primary indicators include pig behavior and pig sound, and the secondary indicators include the number of behavior occurrences per hour and the frequency of sound occurrences per hour.
[0155] Construct a judgment matrix, compare each pair of indicators using the judgment matrix, and calculate the index weight distribution.
[0156] In one embodiment of the present application, the health status evaluation module is further configured to:
[0157] Check the consistency of the judgment matrix.
[0158] In one embodiment of the present application, the health status evaluation module is further configured to:
[0159] Determine a factor set and a comment set based on the pig health evaluation system.
[0160] Establish a membership function to map pig behavior and sound indicators to health status evaluation levels.
[0161] Use the fuzzy synthesis method to calculate the membership degree of the health status comment based on the factor set, comment set, and membership function, and determine the pig health status based on the membership degree.
[0162] Each module in the above-mentioned pig real-time health monitoring device for complex environments can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
[0163] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 7As shown in the figure. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used to communicate with external terminals in a wired or wireless manner, and the wireless manner can be achieved through WIFI, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a real-time health monitoring method for pigs in a complex environment. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, trackball, or touchpad provided on the outer shell of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0164] Those skilled in the art can understand that Figure 7 the structure shown in the figure is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0165] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, it implements the steps in the above method embodiments.
[0166] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, it implements the steps in the above method embodiments.
[0167] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, it implements the steps in the above method embodiments.
[0168] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0169] Those of ordinary skill in the art can understand that all or part of the processes in the above-described embodiment methods can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.
[0170] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0171] The above-described embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A real-time health monitoring method for pigs in complex environments, characterized in that, The method includes: Constructing a pig behavior recognition model based on YOLOv8 to obtain pig action behavior feature data; Establishing a pig sound state recognition and classification model to obtain pig sound feature data; Establishing a pig health evaluation system based on the analytic hierarchy process, and evaluating the pig health state based on the pig action behavior feature data and pig sound feature data in combination with the pig health evaluation system.
2. The real-time pig health monitoring method for complex environments according to claim 1, characterized in that, The constructing a pig behavior recognition model based on YOLOv8 includes: Using a channel-spatial attention mechanism module to enhance the deformable convolutional network module to obtain a deformable convolution and a channel-spatial attention mechanism module; Improving the backbone structure of YOLOv8 based on the deformable convolution and the channel-spatial attention mechanism module; The neck network adopts a path aggregation network PAN and a feature pyramid network, and improves the detection head network based on the WIOU loss function.
3. A real-time pig health monitoring method for complex environments according to claim 1, characterized in that The establishing a pig sound state recognition and classification model to obtain pig sound feature data includes: Collecting pig sound signals and performing framed preprocessing using a Hamming window; Describing the characteristics of the pig sound signals after framed preprocessing to obtain combined features; Performing local feature extraction and global feature extraction respectively based on the combined features to obtain pig sound feature data.
4. The real-time pig health monitoring method for complex environments according to claim 3, characterized in that, The performing local feature extraction and global feature extraction respectively based on the combined features to obtain pig sound feature data includes: Constructing a CNN and Transformer dual-stream parallel network to perform local feature extraction and global feature extraction on the combined features, directly splicing the extracted local features and global features by dimension to obtain a high-dimensional feature signal, and inputting it into a linear layer for linear transformation and dimension adjustment to obtain pig sound feature data.
5. The real-time pig health monitoring method for complex environments according to claim 1, wherein The establishing a pig health evaluation system based on the analytic hierarchy process includes: Hierarchically classifying the health state evaluation objectives into first-level indicators and second-level indicators, where the first-level indicators include pig behavior and pig sound, and the second-level indicators include the number of behavior occurrences per hour and the frequency of sound occurrences per hour; Constructing a judgment matrix, comparing each indicator pairwise using the judgment matrix, and calculating the index weight distribution.
6. The real-time health monitoring method for pigs facing complex environments according to claim 5, characterized in that, After constructing the judgment matrix, it further includes: Checking the consistency of the judgment matrix.
7. A real-time pig health monitoring method for complex environments according to claim 1, characterized in that The evaluating the pig health state based on the pig action behavior feature data and pig sound feature data in combination with the pig health evaluation system includes: Determining a factor set and a comment set based on the pig health evaluation system; Establishing a membership function to map pig behavior and sound indicators to health state evaluation grades; Using a fuzzy synthesis method to calculate the membership degree of the health state comment based on the factor set, the comment set and the membership function, and determining the pig health state based on the membership degree.
8. A real-time pig health monitoring device for complex environments, characterized in that, The device includes: An action behavior feature acquisition module for constructing a pig behavior recognition model based on YOLOv8 to obtain pig action behavior feature data; A sound feature acquisition module for establishing a pig sound state recognition and classification model to obtain pig sound feature data; A health status evaluation module is used to establish a pig health evaluation system based on the analytic hierarchy process, and evaluate the health status of pigs by combining the pig health evaluation system with the pig action behavior characteristic data and the pig sound characteristic data.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Bird whistling classification and identification method and device
CN115762533A
Power field operation specification detection method based on improved YOLOv8 algorithm
CN118736307A
Underground overhead man-riding device identification model training method and device and storage medium
CN119445333A
Cited By
Method for evaluating health status of free-range poultry
CN121128628A
Anti-interference sound analysis system and method for pig farm
CN121438844A
Early duck disease monitoring system and method based on sound spectrum characteristics
CN122474084A