AI-based pig abnormal behavior monitoring and early warning method and system

Through AI-based pig abnormal behavior monitoring and early warning methods, the YOLO-v8, EfficientNetV2 and ResNet-101 models are used, combined with the multiple regression model, and the problem of abnormal behavior monitoring of pigs in large-scale breeding environments is solved, real-time and accurate behavior monitoring and Early warning reduces the risk of disease transmission and improves breeding efficiency.

CN118658209BActive Publication Date: 2024-12-17XIANGJIANG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411110180.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-14
Publication Date
2024-12-17
Estimated Expiration
2044-08-14

AI Technical Summary

Technical Problem

The prior art is difficult to effectively monitor and identify abnormal behaviors of live pigs, especially in large-scale breeding environments, resulting in increased disease transmission and breeding costs.

Method used

Using AI-based pig abnormal behavior monitoring and early warning methods, real-time monitoring and warning of pig behavior and early warning of abnormal behavior are achieved through data collection, behavior classification and recognition, infrared image processing, and multiple regression models. The specific steps include constructing a pig behavior dataset, using YOLO-v8 and EfficientNetV2 models for behavior detection and identification, using ResNet-101 to extract the pig temperature matrix, and establishing a multivariate regression model for monitoring based on the ambient temperature and humidity.

Benefits of technology

Real-time and accurate monitoring of pig behavior is achieved, the accuracy and robustness of abnormal behavior detection is improved, the risk of disease transmission is reduced, and breeding efficiency and animal welfare is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118658209B_ABST
    Figure CN118658209B_ABST
Patent Text Reader

Abstract

The present invention provides an AI-based pig abnormal behavior monitoring and early warning method and system, which relates to the field of animal husbandry phenotype recognition and detection technology. The method includes: collecting data on abnormal pig behavior to build a pig behavior data set; building a pig behavior monitoring model, obtaining the center position of the pig in the pig behavior data set, and classifying and identifying the pig behavior according to the center position of the pig; analyzing the monitored pig behavior to obtain the pig behavior analysis result; according to the pig behavior analysis result, collecting pig infrared images with prominent features to obtain pig thermal infrared images. The present invention realizes real-time monitoring of pig behavior.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of animal husbandry phenotype recognition and detection technology, and in particular to an AI-based abnormal behavior monitoring and early warning method and system for pigs. Background Art

[0002] At present, there is a lack of research on monitoring pig behavior and body temperature. Scholars usually only focus on analyzing the body temperature or a specific behavior of pigs. However, pigs often show a combination of abnormal behaviors when they are sick. In real breeding bases, due to the large number of pigs raised and the limited number of professional breeding personnel, behavioral health monitoring of each pig is time-consuming and difficult to achieve full monitoring of the behavioral status of pigs. This situation makes it difficult to isolate potential sick pigs in a timely manner, which may lead to the spread of the disease and increase breeding costs.

[0003] In actual farming environments, there are a large number of pigs in a pen, and overlap between pigs is common, which seriously affects the accuracy of tracking. Traditional detection and tracking algorithms usually require continuous monitoring of target behaviors and a large number of continuous annotations of a certain behavior. However, this method may have unstable performance problems on new sample data sets. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide an AI-based pig abnormal behavior monitoring and early warning method, thereby realizing real-time monitoring of pig behavior.

[0005] In order to solve the above technical problems, the technical solution of the present invention is as follows:

[0006] In the first aspect, a method for monitoring and early warning abnormal behavior of pigs based on AI, the method comprises:

[0007] Collect data on abnormal behaviors of pigs to build a pig behavior dataset;

[0008] Build a pig behavior monitoring model, obtain the center position of the pigs in the pig behavior dataset, and classify and identify the pigs' behaviors based on their center positions; build a pig behavior monitoring model through the yolo-v8 target detection network and the EfficientNetV2 classification network;

[0009] Analyze the monitored pig behaviors to obtain pig behavior analysis results;

[0010] According to the results of pig behavior analysis, infrared images of pigs with prominent features are collected to obtain thermal infrared images of pigs;

[0011] The thermal infrared image of pigs is ResNet -101 convolutional neural network extracts pig temperature to obtain pig temperature matrix;

[0012] Based on the pig temperature matrix, a multivariate regression model was established to complete the pig abnormal behavior monitoring center.

[0013] Furthermore, data on abnormal pig behaviors are collected to construct a pig behavior dataset, including:

[0014] Monitor piggery behavior from the side using infrared thermal imagers and video cameras to obtain video data and black thermal images of pigs;

[0015] The video data and black-hot images of pigs were processed to construct a pig behavior dataset.

[0016] Furthermore, a pig behavior monitoring model is constructed to obtain the center position of the pig in the pig behavior dataset, and the pig behavior is classified and identified according to the center position of the pig, including:

[0017] Based on pig behavior data, Calculate the center position of the pig, where ( x 1, y 1) and ( x 2, y 2) are the coordinates of the upper left corner and lower right corner of the rectangular box of the pig;

[0018] According to the central position of the pig, the rectangular frame corresponding to each pig is classified into the center.

[0019] Furthermore, the monitored pig behaviors are analyzed to obtain pig behavior analysis results, including:

[0020] The distance threshold is set according to the average distance between pigs, pig size, and activity range to obtain the distance threshold;

[0021] According to the distance threshold, the pig behavior monitoring model is optimized to obtain an optimized pig behavior monitoring model;

[0022] According to the optimized pig behavior monitoring model, the pig behavior is analyzed to obtain the pig behavior analysis results.

[0023] Furthermore, according to the results of pig behavior analysis, infrared images of pigs with prominent features are collected to obtain thermal infrared images of pigs, including:

[0024] According to the results of pig behavior analysis, each pig is assigned a different color mask to obtain a pig image with a color mask;

[0025] The pig image with color mask is processed by color space method and morphological operation, and the pig infrared image with prominent features is collected to obtain the pig thermal infrared image.

[0026] Furthermore, the pig thermal infrared image is ResNet -101 Convolutional neural network extracts pig temperature to obtain pig temperature matrix, including:

[0027] Build and train ResNet -101 model to get ResNet -101 Convolutional Neural Networks;

[0028] The thermal infrared image of pigs is ResNet -101 Forward propagation of the convolutional neural network to extract the feature map related to temperature to obtain the image temperature feature map;

[0029] The image temperature feature map is sampled, average-pooled, and converted into a temperature matrix to obtain the pig temperature matrix.

[0030] Furthermore, a multivariate regression model was established based on the pig temperature matrix to complete the monitoring of abnormal pig behavior, including:

[0031] The temperature data of the pigs were combined with the ambient temperature and humidity to establish a multiple linear regression model to obtain a multiple regression model;

[0032] The parameters of the multivariate regression model are adjusted through an iterative optimization algorithm, and the multivariate regression model is deployed and monitored in real time to complete the monitoring of abnormal pig behavior.

[0033] Second, the AI-based pig abnormal behavior monitoring and early warning system includes:

[0034] The acquisition module is used to collect data on abnormal pig behaviors to construct a pig behavior dataset; YOLO - v 8. Target detection network, obtain the center position of the pigs in the pig behavior dataset, and calculate the distance between the centers of the pigs to achieve pig tracking and positioning; build EfficientNetV 2. Classification network to identify the behavior of the located pigs;

[0035] The processing module is used to analyze the monitored pig behavior to obtain the pig behavior analysis results; according to the pig behavior analysis results, the infrared images of the pigs with prominent features are collected to obtain the pig thermal infrared images; the pig thermal infrared images are processed by ResNet-101 The convolutional neural network extracts the pig temperature to obtain the pig temperature matrix. Based on the pig temperature matrix, a multivariate regression model is established to complete the abnormal behavior monitoring of live pigs.

[0036] According to a third aspect, a computing device includes:

[0037] one or more processors;

[0038] The storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method described.

[0039] In a fourth aspect, a computer-readable storage medium stores a program, and when the program is executed by a processor, the method described is implemented.

[0040] The above solution of the present invention includes at least the following beneficial effects:

[0041] The experimental samples were obtained by analyzing the pixel differences between adjacent frames of the image, and then the pig target detection dataset and pig behavior recognition dataset were constructed by artificial interception.

[0042] YOLO-V 8 neural networks to establish a multi-pig detection model to detect the location and number of pigs, and use

[0043] EfficientNetV 2. The network establishes a pig behavior recognition model to classify and identify pig behaviors. The behavior of group-raised pigs is detected through behavior monitoring methods to achieve real-time monitoring and classification of pig behaviors. The monitoring model is optimized to improve the accuracy and robustness of pig behavior monitoring.

[0044] ResNet-101 The instance segmentation network processes the input thermal infrared images of live pigs, accurately identifies individual pigs and assigns different color masks to each pig one by one, which facilitates the segmentation of the corresponding areas of the pigs. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is a flow chart of the AI-based pig abnormal behavior monitoring and early warning method provided in an embodiment of the present invention.

[0046] Figure 2 It is a schematic diagram of a system information processing system based on power data provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0048] like Figure 1 As shown, an embodiment of the present invention proposes an AI-based abnormal behavior monitoring and early warning method for pigs, and the method includes the following steps:

[0049] Step 11, collecting data on abnormal behaviors of pigs to construct a pig behavior data set;

[0050] Step 12, construct a pig behavior monitoring model, obtain the center position of the pigs in the pig behavior data set, calculate the distance between the centers of the pigs, and classify and identify the behaviors of the located pigs;

[0051] Step 13, analyzing the monitored pig behavior to obtain pig behavior analysis results;

[0052] Step 14, based on the pig behavior analysis results, collecting infrared images of pigs with prominent features to obtain thermal infrared images of pigs;

[0053] Step 15: Transmit the pig thermal infrared image through ResNet -101 convolutional neural network extracts pig temperature to obtain pig temperature matrix;

[0054] Step 16, based on the pig temperature matrix, a multivariate regression model is established to complete the abnormal behavior monitoring of live pigs.

[0055] In an embodiment of the present invention, collecting data on abnormal behavior of pigs can greatly enrich the pig behavior data set. Through the monitoring model, the behavior of pigs can be monitored in real time, abnormalities can be discovered in time, and early warnings can be provided to breeders, which is helpful to prevent diseases and reduce pig mortality rates. Through accurate classification and identification of pig behavior, breeders can manage pig herds more effectively and improve breeding efficiency. The introduction of a distance threshold error judgment mechanism can improve the accuracy of pig behavior analysis and reduce the misjudgment rate, thereby more accurately evaluating the health status and behavior patterns of pigs. Infrared imaging technology can realize non-contact pig body temperature monitoring, reduce interference with pigs, and put them in a more natural state. Using deep learning technology, the body temperature information of pigs can be extracted with high precision. Through a multivariate regression model, the abnormal behavior of pigs can be predicted, so that timely intervention can be made to prevent potential health problems.

[0056] In a preferred embodiment of the present invention, the above step 11 may include:

[0057] Step 111, monitoring the pig house behavior from the side using an infrared thermal imager and a video camera to obtain video data and black thermal images of the pigs;

[0058] Step 112, processing the video data and black hot images of the pigs to construct a pig behavior dataset.

[0059] In the embodiment of the present invention, in the closed management environment of the experimental pig farm, the pig house is monitored from the side, at a height of 2.4 meters from the ground. The monitoring equipment records in a 24-hour uninterrupted manner, and uses a camera and an infrared thermal imager to monitor the body surface temperature of the pigs from the side. The camera can obtain pictures, and the infrared thermal imager can obtain the thermal image data of the pigs, thereby obtaining image data; the image covers the pigs' lying, standing and other behaviors. Considering samples of different time periods, different environmental cleanliness levels, and different pig body cleanliness levels, 1,200 images were selected from the collected black hot images as a data set.

[0060] Open source software is used in this phase Labelimg The selected images were manually annotated. In some annotated images, there may be situations where pigs block each other or the pigs have insufficient vision. When pigs are blocked or partially visible, only the visible part is retained. On the basis of effective sample screening, samples of pigs lying down and standing up were made by manual interception to establish a pig behavior recognition model. In order to avoid deformation of the main target of pigs caused by image rotation, scaling, translation and other operations, loss of some reference information in the background, and reduction of the generalization ability of the model, image enhancement is mainly performed by image noise addition, blurring and other methods, and samples are expanded to enhance the diversity of samples while meeting data balance. After expansion, more than 1,000 images of pigs standing and lying down were used for model training.

[0061] In the present invention, infrared thermal imagers and cameras are used for real-time monitoring, and the behavior of pigs can be observed around the clock and uninterruptedly. Through video data and black thermal images, the behavior patterns of pigs, such as eating, activities, resting, etc., can be deeply analyzed. Infrared thermal imaging technology can detect abnormal body temperature of pigs and promptly discover sick or sub-healthy pigs. Through accurate monitoring and data analysis of pig behavior, farmers can more scientifically allocate feed and optimize the breeding environment.

[0062] In a preferred embodiment of the present invention, the above step 12 includes:

[0063] Step 121, pass yolo - v 8 Object Detection Network and EfficientNetV 2. Classification network to establish pig behavior monitoring model;

[0064] Step 122, based on the pig behavior data, Calculate the center position of the pig, where ( x 1, y 1) and ( x 2, y 2) are the coordinates of the upper left corner and lower right corner of the rectangular box of the pig;

[0065] Step 123, classify the rectangular frame corresponding to each pig according to the central position of the pig.

[0066] In an embodiment of the present invention, YOLO-V 8 Network and EfficientNetV 2 networks are combined to perform pig detection to monitor the pigs’ behaviors such as lying down and standing. The video data is transmitted frame by frame to the pig behavior monitoring model for processing, and the rectangular box corresponding to the pig in each frame is stored. Using the formula The center position of each pig is calculated, and the rectangular frame corresponding to each pig is classified. The frame rate of the video acquisition device is 25 frames per second. The center of the pig changes very little between adjacent frames. Therefore, a rectangular frame that matches the minimum Euclidean distance of each pig can be found in the next frame. The center is calculated by the position of the pig's rectangular frame, and then the distance between the centers of the pigs is calculated; a classified rectangular frame is obtained through a minimum distance matching method based on motion distance: the video data and the classified rectangular frame file are passed into the behavior recognition model for behavior recognition. If the recognition result is a lying or standing state, the lying and standing behaviors will be accumulated and the next frame will be recognized.

[0067] In the present invention, through automated monitoring, the efficiency of pig behavior monitoring can be greatly improved, and the workload of manual observation and recording can be reduced. By using advanced deep learning models, the behavior of pigs can be more accurately identified and classified to avoid human errors. The system can monitor the behavior of pigs in real time and promptly detect abnormal situations, such as illness, fighting, etc., so as to take measures quickly. Through accurate monitoring and analysis of pig behavior, farmers can more effectively manage the breeding environment of pigs, improve the health level and production efficiency of pigs, better monitoring can promptly detect discomfort or stress of pigs, thereby adjusting breeding conditions and improving animal welfare, and long-term data collection and analysis can provide a scientific basis for breeding decisions, such as feed ratio and breeding density.

[0068] In a preferred embodiment of the present invention, the above step 13 includes:

[0069] Step 131, setting a distance threshold according to the average distance between pigs, the size of the pigs, and the activity range to obtain a distance threshold;

[0070] Step 132, optimizing the pig behavior monitoring model according to the distance threshold to obtain an optimized pig behavior monitoring model;

[0071] Step 133, analyzing the pig's behavior according to the optimized pig behavior monitoring model to obtain pig behavior analysis results.

[0072] In an embodiment of the present invention, the distance data between pigs, the size data of pigs, and the data of their activity range in the pig house are collected over a period of time, and statistical analysis is performed on these data to calculate the average distance between pigs. At the same time, the size and activity range of the pigs are considered to determine a suitable distance threshold. This threshold should be able to reflect the normal social distance between pigs and set a reasonable distance threshold. This threshold will be used in the subsequent behavior monitoring model, and an error detection mechanism is designed according to the set distance threshold. When the distance between the monitored pigs exceeds or falls below this threshold, the error detection mechanism will be triggered. In order to enhance the adaptability of the model to identifying error frames and skip these error frames, an error detection mechanism is added to the model according to the distance threshold for optimization. According to the experimental pig behavior analysis results, the actual distance between the centers of adjacent frames of pigs is repeatedly obtained. It is found that the pixel distance between the centers of the upper and lower sampling frames is less than 150. Therefore, when the pixel distance is greater than 150, it jumps directly to the next frame for detection. In the experiment, a pig pen with a total of four pigs was selected. When the four rectangular frames were not returned, it jumped directly to the next frame for detection to obtain the pig behavior analysis results of the pigs;

[0073] In the present invention, by setting a reasonable distance threshold and error judgment mechanism, the social behavior and activity patterns between pigs can be monitored more accurately, reducing misjudgments and missed judgments. The optimized model can promptly detect abnormal distances between pigs, thereby helping farmers to quickly respond to and deal with potential problems, such as fighting between pigs, disease transmission, etc. By deeply analyzing the behavior patterns of pigs, farmers can more accurately understand the needs and status of the pig herd, thereby adjusting breeding conditions such as feed feeding and pig house environment, and improving breeding efficiency. Accurate monitoring and timely behavior analysis help to ensure the health and welfare of pigs, reduce the occurrence and spread of diseases, and improve the quality of life of pigs. Long-term data collection and analysis can provide a scientific basis for breeding management, help farmers make more informed decisions, and improve the overall benefits of the breeding industry.

[0074] In a preferred embodiment of the present invention, the above step 14 includes:

[0075] Step 141, assigning a different color mask to each pig according to the pig behavior analysis result to obtain a pig image with a color mask;

[0076] Step 142, segmenting and processing the color-masked pig image by color space methods and morphological operations, collecting pig infrared images with prominent features, and obtaining pig thermal infrared images.

[0077] In the embodiment of the present invention, using ResNet-101 instance segmentation network is used to process the input thermal infrared image of live pigs. This network can accurately identify individual pigs and assign a different color mask to each pig for subsequent region segmentation. Through this stage, the live pig image with color mask is obtained. In the second stage of processing, the mask image output in the previous stage will be operated: first, we use the color space method to extract the corresponding pig areas one by one, and then, we use morphological operations such as corrosion and dilation to process the output mask image to weaken the blurred edges of the pig area and fill the small area holes inside after binarization, while eliminating the overlapping errors between some masks to obtain the thermal infrared image of live pigs.

[0078] In the present invention, by assigning a different color mask to each pig, the recognition accuracy of the pigs in the image can be greatly improved. The color mask not only improves the recognition accuracy, but also enhances the visualization effect of the image. The thermal infrared image of the live pig can provide information about the body temperature distribution of the pig, which is very valuable for studying the physiological state, health status and behavior patterns of the pigs. By regularly collecting and analyzing the thermal infrared images of the live pigs, abnormal body temperature can be discovered in time, thereby assisting in the early monitoring and prevention of diseases. Accurate behavior analysis and timely health monitoring can help farmers manage the pig herd more effectively and adjust feeding strategies, thereby improving breeding efficiency and economic benefits.

[0079] In a preferred embodiment of the present invention, the above step 15 includes:

[0080] Step 151, build and train ResNet -101 model to get ResNet -101 Convolutional Neural Networks;

[0081] Step 152: The pig thermal infrared image is transmitted through ResNet- 101 Forward propagation of the convolutional neural network to extract the feature map related to temperature to obtain the image temperature feature map;

[0082] Step 153, sampling and average pooling the image temperature feature map, and converting it into a temperature matrix to obtain a pig temperature matrix.

[0083] In an embodiment of the present invention, ResNet -101 is a deep convolutional neural network with residual connections. You can choose to use pre-trained ResNet-101 model, pre-trained model can be obtained from the open source deep learning library, using the collected pig temperature data set to train the network. During the training process, the temperature data is used as input and the body temperature of the pig is used as the target output. Through the back propagation algorithm and optimization method, the network parameters are adjusted to minimize the difference between the predicted value and the actual body temperature, and the trained model is evaluated using the test set. The accuracy, precision, recall rate and other indicators of the model can be calculated to evaluate the model performance, and the image is globally averaged and pooled. The temperature matrix is ​​initialized to store the average temperature value of each grid, and the average temperature value of each grid is filled into the corresponding temperature matrix position. Data smoothing is performed, and the temperature matrix is ​​finally output.

[0084] In a specific embodiment, ResNet -101 model input layer size is 224x224x3 RGB When the image is processed, the first layer is a 7×7 convolution layer with 64 convolution kernels and a step size of 2. padding is 3, and the activation function is ReLU ; Second layer: 3x3 maximum pooling layer with a step size of 2; Third layer: 4 residual blocks, each residual block contains 3 residual blocks, for a total of 12 residual blocks; Fourth layer: 4 residual blocks, each residual block contains 23 residual blocks, for a total of 92 residual blocks; Fifth layer: 4 residual blocks, each residual block contains 3 residual blocks, for a total of 12 residual blocks; Global average pooling layer: average pool the feature map output by the last layer to obtain a feature vector.

[0085] In a preferred embodiment of the present invention, the above step 16 includes:

[0086] Step 162, combining the temperature data of the pigs with the ambient temperature and humidity to establish a multiple linear regression model to obtain a multiple regression model;

[0087] Step 163, adjusting the multivariate regression model parameters through an iterative optimization algorithm, and deploying and real-time monitoring of the multivariate regression model to complete abnormal behavior monitoring of live pigs.

[0088] In an embodiment of the present invention, the temperature matrix is ​​traversed to find the maximum value therein, and the maximum temperature value is recorded, which represents the current body temperature data of a certain pig. In addition to the body temperature data of the pig, it is also necessary to collect the environmental temperature and humidity data of the same period, clean and organize the collected data, use statistical software or a machine learning library in a programming language, take the body temperature of the pig as the dependent variable, and take the environmental temperature and humidity as independent variables, establish a multivariate linear regression model, adjust the parameters of the multivariate regression model through an iterative optimization algorithm to improve the prediction accuracy of the model, deploy the optimized model to the monitoring system of the pig farm, continuously collect real-time pig body temperature and environmental temperature and humidity data, input them into the model, and monitor the body temperature of the pig in real time. The body temperature predicted by the model is compared with the actual measured body temperature. If the difference between the two is significant, it may indicate abnormal behavior or health problems of the pig.

[0089] At this time, the alarm system can be triggered to notify the breeding staff to conduct inspection and treatment in time; in a specific embodiment, assuming that the temperature matrix of the initial infrared image is M , the input image is finalI , the actual temperature set of each pig is bodyT , then the extraction process of the pig's body surface temperature is as follows: traverse the binary image finalI Each pixel in ( x , y ); When the pixel point ( x , y ) is 1, the temperature of this point is added to the actual temperature set of the pig bodyT When the pixel point ( x , y) is 0, the temperature of that point is discarded; through this process, we can extract the temperature information of the pigs from the original infrared image for subsequent analysis and processing. This method can reduce the noise in the temperature data and extract the highest temperature value of the pig's body surface for temperature analysis and monitoring; the multivariate linear regression model is usually used to study the relationship between a dependent variable and multiple independent variables. If the relationship between the two can be described in linear form, a multivariate linear regression model can be established for analysis. Studies have shown that the body temperature of pigs is greatly affected by the ambient temperature and humidity; when pigs are in a low-temperature, low-humidity environment, the pigs will accelerate the conversion of food chemical energy into thermal energy; when pigs are in a high-temperature, high-humidity environment, the pigs will slow down the conversion of food chemical energy into thermal energy and maintain their own body temperature within a certain range. Therefore, in order to further improve the accuracy and practicality of the body temperature monitoring model and reduce the interference caused by environmental factors and the hair on the pig's body surface, the experiment will use a handheld veterinary thermometer to measure the temperature of the pig's ear root, back, and tail every 30 minutes, record stable data, select the part with the highest correlation coefficient with the temperature value measured by the body temperature monitoring model, and establish a multivariate linear regression model to monitor the pig's body temperature in combination with the ambient temperature and humidity;

[0090] In the present invention, the prediction accuracy of the model can be improved by adjusting the parameters of the multivariate regression model through an iterative optimization algorithm. The optimized model can be deployed for real-time monitoring. Once abnormal changes in the body temperature of pigs or the temperature and humidity of the environment are found, the system can immediately issue an early warning. This helps to timely discover and deal with abnormal behaviors or health problems of pigs. The real-time monitoring and early warning system can help farmers respond quickly to abnormal situations, reduce the occurrence and spread of diseases, thereby improving the survival rate and breeding efficiency of pigs. By timely discovering and dealing with abnormal behaviors of pigs, the risks in the breeding process can be reduced. This helps to protect the economic interests of farmers and the welfare of pigs.

[0091] like Figure 2 As shown, the embodiment of the present invention also provides an AI-based pig abnormal behavior monitoring and early warning system 20, including:

[0092] The acquisition module 21 is used to collect data on abnormal behaviors of pigs to construct a pig behavior data set; YOLO-v 8. Target detection network, obtain the center position of the pigs in the pig behavior dataset, and calculate the distance between the centers of the pigs to achieve pig tracking and positioning; build EfficientNetV 2. Classification network to identify the behavior of the located pigs;

[0093] The processing module 22 is used to analyze the monitored pig behavior to obtain the pig behavior analysis results; based on the pig behavior analysis results, collect the pig infrared images with prominent features to obtain the pig thermal infrared images; ResNet-101 convolutional neural network is used to extract pig temperature to obtain the pig temperature matrix; based on the pig temperature matrix, a multivariate regression model is established to complete the abnormal behavior monitoring of live pigs.

[0094] It should be noted that the system is a system corresponding to the above method, and all implementation methods in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.

[0095] The embodiment of the present invention further provides a computing device, comprising: a processor, a memory storing a computer program, wherein when the computer program is executed by the processor, the method described above is executed. All implementations in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.

[0096] The embodiment of the present invention also provides a computer-readable storage medium storing instructions, which, when executed on a computer, enable the computer to execute the method described above. All implementations in the above method embodiment are applicable to this embodiment and can achieve the same technical effect.

[0097] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0098] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

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

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

[0101] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0102] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.

[0103] In addition, it should be pointed out that in the apparatus and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. Moreover, the steps of performing the above series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order, and some steps can be performed in parallel or independently of each other. For those of ordinary skill in the art, it can be understood that all or any steps or components of the method and apparatus of the present invention can be implemented in hardware, firmware, software or a combination thereof in any computing device (including processors, storage media, etc.) or a network of computing devices, which can be achieved by those of ordinary skill in the art using basic programming skills after reading the description of the present invention.

[0104] Therefore, the purpose of the present invention can also be achieved by running a program or a group of programs on any computing device. The computing device can be a well-known general device. Therefore, the purpose of the present invention can also be achieved by simply providing a program product containing a program code that implements the method or device. That is to say, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any well-known storage medium or any storage medium developed in the future. It should also be pointed out that in the device and method of the present invention, it is obvious that each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent schemes of the present invention. In addition, the steps of performing the above-mentioned series of processing can naturally be performed in chronological order according to the order of description, but it is not necessary to perform them in chronological order. Some steps can be performed in parallel or independently of each other.

[0105] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. The AI-based pig abnormal behavior monitoring and early warning method is characterized by: The method comprises: Collect data on abnormal behaviors of pigs to build a pig behavior dataset; Build a pig behavior monitoring model, obtain the center position of the pigs in the pig behavior dataset, and classify and identify the pigs' behaviors based on their center positions; Analyze the monitored pig behaviors to obtain pig behavior analysis results; According to the results of pig behavior analysis, infrared images of pigs with prominent features are collected to obtain thermal infrared images of pigs; The thermal infrared image of pigs is ResNet -101 convolutional neural network extracts pig temperature to obtain pig temperature matrix; Based on the pig temperature matrix, a multivariate regression model is established to complete the abnormal behavior monitoring of live pigs; the pigs are classified and identified according to their central position, including: pass yolo - v 8 Object Detection Network and EfficientNetV 2. The classification network establishes a pig behavior monitoring model, and the video data obtained by the camera monitoring the pig house from the side is transmitted frame by frame to the pig behavior monitoring model for processing, and the rectangular frame corresponding to the pig in each frame image is stored; Using the formula Calculate the center position of the pig, where ( x 1, y 1) and ( x 2, y 2) are the coordinates of the upper left corner and lower right corner of the rectangular box of the pig; According to the central position of the pig, the rectangular frame corresponding to each pig is classified; the monitored pig behavior is analyzed to obtain the pig behavior analysis results, including: The distance threshold is set according to the average distance between pigs, pig size, and activity range. The distance threshold reflects the normal social distance between pigs. According to the distance threshold, the pig behavior monitoring model is optimized to obtain an optimized pig behavior monitoring model; According to the optimized pig behavior monitoring model, the pig behavior is analyzed to obtain the pig behavior analysis results; according to the pig behavior analysis results, the pig infrared images with prominent features are collected to obtain the pig thermal infrared images, including: According to the results of pig behavior analysis, each pig is assigned a different color mask to obtain a pig image with a color mask; The pig image with color mask is segmented and processed by color space method and morphological operation, and the pig infrared image with prominent features is collected to obtain the pig thermal infrared image; the pig thermal infrared image is ResNet -101 Convolutional neural network extracts pig temperature to obtain pig temperature matrix, including: Build and train ResNet -101 model to get ResNet -101 Convolutional Neural Networks; The thermal infrared image of pigs is ResNet -101 Forward propagation of the convolutional neural network to extract the feature map related to temperature to obtain the image temperature feature map; The image temperature feature map is sampled, averaged and pooled, and converted into a temperature matrix to obtain the pig temperature matrix. Based on the pig temperature matrix, a multivariate regression model is established to complete the abnormal behavior monitoring of live pigs, including: The temperature data of the pigs were combined with the ambient temperature and humidity to establish a multiple linear regression model to obtain a multiple regression model; The parameters of the multivariate regression model are adjusted through an iterative optimization algorithm, and the multivariate regression model is deployed and monitored in real time to complete the monitoring of abnormal pig behavior.

2. An AI-based pig abnormal behavior monitoring and early warning processing system using the method of claim 1, characterized in that: include: An acquisition module is used to collect data on abnormal behaviors of pigs to construct a pig behavior data set; Build YOLO - v 8. Target detection network, obtain the center position of the pigs in the pig behavior dataset, and calculate the distance between the centers of the pigs to achieve pig tracking and positioning; build EfficientNetV 2. Classification network to identify the behavior of the located pigs; The processing module is used to analyze the behavior of the monitored pigs to obtain the pig behavior analysis results; based on the pig behavior analysis results, infrared images of pigs with prominent features are collected to obtain thermal infrared images of pigs; The thermal infrared image of pigs is ResNet -101 convolutional neural network is used to extract pig temperature to obtain the pig temperature matrix; based on the pig temperature matrix, a multivariate regression model is established to complete the abnormal behavior monitoring of live pigs.