Method and system for monitoring body temperature of group health-preserving pigs
Through the deep learning object detection algorithm, the identification of the roots of pig ears and the temperature value is extracted, which solves the problem of time-consuming and labor-intensive and low detection accuracy of existing pig body temperature monitoring methods, and realizes high-precision pig body temperature monitoring, which is suitable for large-scale intelligent breeding .
Patent Information
- Application Number
- CN202411346796.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-09-26
AI Technical Summary
The existing pig temperature monitoring methods are time-consuming and labor-intensive, prone to stress responses and cross-infection of diseases. In infrared thermal imaging technology, the detection accuracy of the area of interest is not high, making it difficult to meet the needs of large-scale intelligent breeding.
Deep learning object detection algorithm combined with the dual-spectral video data acquisition system to identify the ear roots of pigs, and extract the temperature value of the ear roots through linear interpolation. The ear roots predicted frame with a small standard deviation is selected as the optimal box, and its statistical characteristics are calculated. Characterizes the body temperature of pigs.
It improves the accuracy and accuracy of pig body temperature detection, meets the needs of temperature monitoring of group health pigs, and reduces the dependence on the software of thermal imager manufacturers.
Smart Images

Figure CN119418365A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of animal husbandry and pig temperature measurement, and specifically relates to a method for monitoring the body temperature of group-raised pigs and a system used therein. Background Art
[0002] With the development of pig farming, large-scale, intensive and intelligent farming methods are widely used in the industry. In the farming process, the health of pigs is very important. The body temperature of pigs is an important indicator of their health status. Timely and accurate monitoring of the body temperature of pigs can effectively prevent diseases and improve farming efficiency and quality. The traditional method of measuring pig temperature is to use a mercury thermometer or an electronic thermometer to measure the rectal temperature of pigs. This method is time-consuming and labor-intensive, and it is easy to cause stress reactions in pigs and cross-infection of diseases. It cannot meet the needs of large-scale intelligent farming methods.
[0003] In recent years, infrared thermal imaging technology, as a non-contact body surface temperature measurement method, has been widely used in the fields of body temperature detection and disease diagnosis of livestock and poultry. This method adopts a combination of deep learning and machine vision. It collects pig images through a camera to build a data set, trains a deep learning model to detect the area of interest for pig temperature measurement, and extracts the thermal image to use the temperature value of the area of interest as the pig body temperature. The temperature of the ear root is the part of the pig's body surface that is most closely related to the rectal temperature. In the study of infrared thermal imaging to detect the body temperature of pigs, the ear root is very suitable as the area of interest for pig temperature measurement. For example, the publication number is CN110200596A "Infrared Rapid Temperature Measurement Device and Temperature Measurement Method for Pig Body Temperature Monitoring", which allows live pigs to enter the door-shaped frame along the main channel, and each rocker arm moves, and the pig's identity information is read through the electronic identity recognition instrument and the reading probe, and the temperature is measured and recorded.
[0004] When using infrared thermal imaging to detect the body temperature of pigs, existing methods mostly use deep learning target detection algorithms to detect the ears or heads of pigs to extract the temperature of the corresponding parts directly as the body temperature of the pigs. The areas of interest detected by these methods contain a large number of background pixels and more noise points, and their temperature measurement accuracy is not as good as directly detecting the base of the ear. In addition, due to the large number of thermal imager brands on the market and the special format of stored thermal images, existing methods mostly require the use of software provided by thermal imager manufacturers to extract the temperature of thermal images, and the software has many limitations, making secondary development difficult. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a body temperature monitoring method and system for group-reared pigs, so as to realize the temperature extraction of the ear base of group-reared pigs and the intelligent monitoring of the body temperature of pigs based on the ear base temperature monitoring system of group-reared pigs.
[0006] In order to solve the above technical problems, the present invention provides a method and system for monitoring the body temperature of group-raised pigs, the specific process of which is as follows:
[0007] S1. The bispectral video data of group-raised pigs are collected through the pig video data collection system. Then, the thermal infrared video data in the bispectral video data is subjected to a time-interval extraction operation. The selected frame images are input into the offline trained pig ear base position recognition model to obtain the predicted image img and the ear base position detection result of each pig, including the left and right ear category information and the ear base position prediction frame;
[0008] S2. Extract the temperature value from the ear root of each pig's predicted image img and construct the temperature matrix Temp() of the left ear root prediction frame L And the temperature matrix Temp() of the right ear root prediction box R ;
[0009] S3, temperature matrix Temp() of the left ear root prediction frame L And the temperature matrix Temp() of the right ear root prediction box R Calculate the statistical characteristic standard deviation σ respectively L , σ R , choose σ L , σ R The ear root prediction box with the smaller standard deviation σ is taken as the optimal box;
[0010] S4. Calculate the maximum value, mode, second largest value and average value of the statistical characteristics through the optimal frame, and use the maximum value of the statistical characteristics as the temperature of the pig's ear root.
[0011] As an improvement of the method for monitoring body temperature of group-reared pigs of the present invention:
[0012] The specific method for extracting the temperature value of the ear root part in step S2 is:
[0013] In the prediction image img, all pixel values within the boundary of the ear root prediction box are extracted as the point set Pixel(), and the corresponding temperature values of all pixel values in the point set Pixel() are calculated using linear interpolation as the temperature matrix Temp(), including the temperature matrix Temp() of the left ear root prediction box L And the temperature matrix Temp() of the right ear root prediction box R .
[0014] As a further improvement of the method for monitoring body temperature of group-reared pigs of the present invention:
[0015] The temperature matrix Temp() of the left ear root prediction frame L And the temperature matrix Temp() of the right ear root prediction boxR The specific calculation method is:
[0016] (1) Create a mask with all pixel values set to 0, and the size is the same as the predicted image img;
[0017] (2) setting the pixel value in the prediction box area of the pig ear root on the mask to 255;
[0018] (3) Perform a bitwise AND operation on the predicted image img and the mask mask, and retain the pixel values in the predicted box area of the pig ear root on the mask mask, and set the pixel values in other areas to 0;
[0019] (4) Obtain the coordinate index value of the non-zero pixel on the mask mask, and extract the pixel value of the corresponding position in the predicted image img according to the coordinate index value; save the extracted pixel value in the form of a list P[] L ,P[] R , is the pixel value in the prediction box of the ear root;
[0020] (5) Based on the thermal infrared video data, the thermal imaging grayscale image corresponding to the frame image selected by the time-interval frame extraction operation is mapped to the temperature value one by one using the linear difference method:
[0021]
[0022] Among them, P max , P min are the maximum and minimum pixel values in the thermal imaging grayscale image, T max 、T min They are the maximum and minimum temperatures in the thermal imaging grayscale image, respectively; T is the temperature prediction value, and P is the grayscale value of each pixel;
[0023] (6) Calculate P[] L ,P[] R The temperature value corresponding to the pixel value in the middle is used to obtain the temperature matrix Temp() of the left ear root prediction box. L And the temperature matrix Temp() of the right ear root prediction box R .
[0024] As a further improvement of the method for monitoring body temperature of group-reared pigs of the present invention:
[0025] The pig ear base part recognition model is a YOLOv8-OBB model.
[0026] As a further improvement of the method for monitoring body temperature of group-reared pigs of the present invention:
[0027] The offline training process of the pig ear root position recognition model is as follows:
[0028] The pig video data acquisition system is used to collect dual-spectrum video data of group-raised pigs during the normal feeding cycle from piglets to fattening pigs, and then frame extraction is performed at intervals to select a set of typical frame images as the data set; the ear base of the pigs in all images in the data set are annotated, and then divided into training set, validation set and test set; the training set and validation set are used to train to obtain the optimal model parameters, and the test set is used to test the performance of the optimal model parameters.
[0029] The present invention also provides a pig video data acquisition system, comprising:
[0030] A dual-spectrum camera is installed on the top of the cultivation room, the dual-spectrum camera is electrically connected to a network hard disk video recorder through a network, and the network hard disk video recorder is electrically connected to a computer through a network;
[0031] The dual-spectrum camera is installed above the drinking trough of the pig pen to shoot the entire pig pen from a bird's-eye view.
[0032] The beneficial effects of the present invention are mainly reflected in:
[0033] The present invention proposes a body temperature monitoring method and system for group-raised pigs. Firstly, a deep learning target detection algorithm is used to identify the ear base of the pig, and the ear base in different directions can be accurately fitted. Then, based on the linear transformation relationship between the pixel value and the temperature value of the thermal image, a linear interpolation method is used to directly extract the temperature value corresponding to the ear base prediction frame. The left and right ear base prediction frames are compared by standard deviation, and the temperature of the optimal prediction frame is selected to characterize the body temperature of the pig. This can improve the accuracy of body temperature extraction, and has very important application value in the fields of ear base target detection of group-raised pigs and infrared thermal imaging temperature measurement of group-raised pigs.
[0034] Compared with the existing method of directly extracting the maximum temperature as the body temperature of the pig after predicting the left and right ear areas, the present invention first identifies the optimal prediction frames of the left and right ear root areas, and then uses correlation analysis to select the statistical features with the largest correlation in the optimal frames of the left and right ear root areas to characterize the body temperature of the pig, thereby improving the accuracy of body temperature detection of group-raised pigs. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings.
[0036] Figure 1 It is a schematic diagram of the pig video data acquisition system of the present invention;
[0037] Figure 2 A schematic diagram of the process of a method for monitoring the body temperature of group-reared pigs according to the present invention;
[0038] Figure 3 This is a schematic diagram of the structure of the pig ear root position identification model of the present invention;
[0039] Figure 4 This is a schematic diagram of the process of temperature extraction of the pig ear root part of the present invention;
[0040] Figure 5 It is a schematic diagram of visualizing the temperature detection at the base of the pig's ear according to the present invention. DETAILED DESCRIPTION
[0041] The present invention is further described below in conjunction with specific embodiments, but the protection scope of the present invention is not limited thereto:
[0042] Embodiment 1,
[0043] Pig video data acquisition system, such as Figure 1 As shown, a dual-spectrum camera is arranged in the cultivation room, the dual-spectrum camera is electrically connected to a network hard disk recorder through a network, and the network hard disk recorder is electrically connected to a computer through a network. The dual-spectrum camera collects real-time dual-spectrum video data of group-raised pigs in the cultivation room in real time, transmits and stores the data to the network hard disk recorder through the network, uses a computer to monitor and view the dual-spectrum video data of the pigs, and uses a group-raised pig body temperature monitoring method of the present invention to perform real-time body temperature detection.
[0044] A method for monitoring body temperature of group-raised pigs, such as Figure 2 As shown, the specific process is as follows:
[0045] I Offline Training of Pig Ear Root Recognition Model
[0046] 1 Data Collection
[0047] Through the pig video data acquisition system, the daily behavior activities of 20 pigs in a pigpen in the breeding room are monitored and filmed, and dual-spectrum video data is collected 24 hours a day. The collection period is 5 to 6 months of the normal feeding cycle of pigs from piglets to fattening pigs. The dual-spectrum camera model is Hikvision temperature measurement dual-spectrum tube camera DS-2TD2636B-13 / P, which is installed above the drinking trough of the pigpen. The horizontal and vertical field of view angles are 28.8° and 21.6°. The pigpen is photographed from a top-down angle to ensure that all pigs in the pigpen are within the field of view; the thermal imaging resolution of the dual-spectrum camera is 384×288, and the visible light resolution is 2688×1520. The network hard disk recorder model is DS-7608N-I3-V3, which stores videos in multiple channels and multiple disk slots, can store multi-spectrum video data, and obtain infrared spectrum and visible spectrum video data of pigs at the same time.
[0048] 2 Dataset creation and division
[0049] The dual-spectral video data collected in step 1 is subjected to time-interval frame extraction, and a set of typical frame images is selected as the data set. The images should contain pigs of different postures and numbers to make the data set contain more information; the open source labeling software ro-labelimg is used to label the ear roots of pigs in all images in the data set. The ear root is the connection between the pig ear and the pig body. When labeling, try to make the labeling box parallel to the ear root line, including the ear root line and its left and right areas; after labeling, generate XML format labels, and according to the needs of the deep learning model, convert the XML labels into txt format recognizable by the YOLOv8-OBB model; finally, divide the data set into training set, validation set and test set in a ratio of 8:1:1.
[0050] 3 Construction of pig ear root location recognition model
[0051] The present invention adopts the YOLOv8-OBB model as a pig ear base part recognition model to recognize the pig ear base part. The pig ear base part recognition model is mainly composed of three modules: Backbone, Neck, and Head. The Backbone part is a backbone network responsible for feature extraction. The CBS module is a combination of convolution, pooling, and activation functions; the C2f module is a basic building block with a residual connection and a bottleneck structure. The Neck part is responsible for multi-scale feature fusion and enhances feature representation capabilities. It includes the following components: the SPPF module is a spatial pyramid pooling module for pooling operations of different scales; the Concat module is to splice feature maps of different scales together; Upsample is to change the size of the feature map by upsampling; the Head part is responsible for the final target detection and classification tasks, and the model outputs three prediction results of different sizes, each of which includes a detection head, a classification head, and an angle head, all of which are composed of two CBS modules and a separate Conv2d convolution layer. The angle head is added by modifying the Head module in the OBB model. It is used to predict the rotation angle of the feature map. It can identify the ear roots of pigs at different angles in the image and generate the corresponding directional rotation prediction box, that is, the ear root prediction box.
[0052] 4. Training and testing of pig ear root location recognition model
[0053] Set up the configuration files of the data set and model structure and the training and prediction script terminal commands to prepare for model training; the model directly predicts the ear base of the pig in the image in an end-to-end mode and generates prediction results; the training set and validation set are used to train to obtain the optimal model parameters, and the test set is used to test the performance of the optimal model parameters.
[0054] The training set and validation set divided in step 2 are used as the input of model training, and hyperparameters such as the number of iterations (epoch) is set to 300, the batch size (batchsize) is set to 16, and the initial learning rate (lr) is set to 0.01; the hyperparameters are optimized through 300 rounds of iterations and back propagation to achieve the best training effect; after training, the optimal weight parameter file (best.pt) is generated, which can be used for subsequent model prediction.
[0055] 5. Pig ear root location recognition model test
[0056] The optimal weight parameter model obtained through training is applied to the test set divided in step 2, and the ear root detection results in each image of the test set are output. The left and right ear category information of the predicted ear root is returned: left_earroot or right_earroot, as well as the coordinate values of the four vertices of the ear root prediction box.
[0057] II. Body temperature monitoring of pigs in group
[0058] When used in an online production environment, first use the method in step 1 to monitor and shoot the daily behavior of group-raised pigs in the pigpen of the breeding room through the pig video data acquisition system to obtain the dual-spectrum video data of the group-raised pigs, and then perform a time-interval frame extraction operation on the thermal infrared video data in the dual-spectrum video data to select typical frame images, such as Figure 5 As shown in (a), the pig ear root position recognition model trained in step 5 is input to obtain the predicted image img and ear root position detection results of each pig, including the left and right ear category information: left_earroot or right_earroot, and the four vertex coordinate values of the ear root position prediction box, and then further processing is performed:
[0059] 6. Temperature extraction of pig ear root
[0060] In a pig group environment, the predicted image img contains multiple pigs. The pig ear root location recognition model predicts the left and right ear roots for each pig, and then extracts the temperature value of the ear root location. The steps for extracting temperature are: first create a mask, then extract the pixels in the ear root location prediction box, then convert the temperature value and display the highest temperature of the ear root location, such as Figure 4 shown.
[0061] In the predicted image img, the four vertex coordinates of the ear root prediction box are used as the specific boundary range of the ear root prediction box, and all pixel values within the boundary range are extracted as the point set Pixel(). The maximum temperature value T in the thermal imaging grayscale image of the typical frame image obtained by extracting the thermal infrared video data is max and minimum temperature T min The maximum pixel value P in the thermal imaging grayscale image maxand the minimum pixel value P min The linear mapping relationship between max and P min Generally, it is 255 and 0. The linear interpolation method is used to calculate the corresponding temperature values of all pixel values in the point set Pixel() as the temperature matrix Temp(), including the temperature matrix Temp() of the left ear root prediction box L And the temperature matrix Temp() of the right ear root prediction box R .
[0062] The detailed implementation method of converting pixel values into temperature values is as follows:
[0063] 6.1 Create a mask with all pixel values as 0 (black), the size is the same as the predicted image img, and both the mask and the predicted image img are single-channel grayscale images;
[0064] 6.2 According to the vertex coordinate values of the prediction box of the pig ear root, the pixel value in the prediction box area of the pig ear root is set to 255 (white) on the mask;
[0065] 6.3 Perform a bitwise AND (&) operation on the predicted image img and the mask mask. The specific operation is: convert each pixel value of the predicted image img and the mask mask into a binary number, and then perform a logical operation on the two images, bitwise AND (&). When the corresponding two binary bits are both 1, the result bit is 1; after the operation, the pixel values in the predicted box area of the pig ear root are retained on the mask mask, and the pixel values in other areas are 0;
[0066] 6.4 Get the coordinate index value of the non-zero pixel on the mask mask, and extract the pixel value of the corresponding position in the predicted image img according to the coordinate index value; save the extracted pixel value in list form as P[] L and P[] R , which is the value of all pixels in the prediction box of the ear root;
[0067] 6.5 Obtaining the maximum and minimum pixel values P in the thermal imaging grayscale image max , P min And the maximum and minimum temperature values T max , T min ; Use the linear interpolation method to map pixel values to temperature values one by one; the specific formula is as follows:
[0068]
[0069] Where, T: temperature prediction value, P: grayscale value of each pixel.
[0070] The existing method of extracting temperature from thermal images usually uses the software provided by the thermal imager manufacturer to extract the temperature of the thermal image. However, due to the large number of thermal imager manufacturers, numerous software, and many software restrictions, secondary development is difficult. Therefore, the present invention adopts a linear transformation relationship between the pixel value and the temperature value of the thermal image, and uses a linear interpolation method to directly extract the temperature value corresponding to the prediction frame of the ear root, thereby breaking away from the limitations of the manufacturer's software, and the method is simpler and more convenient.
[0071] 6.6 Calculation of P[] L ,P[] R The temperature value corresponding to the pixel value in the middle is used to obtain the temperature matrix Temp() of the left ear root prediction box. L And the temperature matrix Temp() of the right ear root prediction box R .
[0072] 7Optimal box selection for ear root prediction box
[0073] Since the temperature of the left and right ear roots of pigs is inconsistent, it is necessary to select the best prediction frame for the left and right ear roots; the temperature matrix Temp() of the left ear root prediction frame in step 6 L And the temperature matrix Temp() of the right ear root prediction box R Calculate the statistical characteristic standard deviation σ respectively L , σ R ; When the position of the ear root prediction box fits the ear root more closely, the temperature value dispersion in the ear root prediction box is smaller, so σ is selected L , σ R The ear root prediction box with the smaller standard deviation σ in is taken as the optimal box.
[0074] In the optimal frame selection method, each ear base prediction frame contains M = 1500 ~ 2000 pixel values, and its temperature matrix Temp() also contains corresponding M = 1500 ~ 2000 temperature values; the selected optimal frame indicates that the ear base prediction frame has better position accuracy, and the temperature value of the ear base is more consistent with the actual temperature of the pig than the temperature value of the other ear base of the pig.
[0075] 8 Temperature Characterization of Pig Ear Root
[0076] The maximum value, mode, second largest value and average value of the statistical characteristics are calculated for the optimal frame of step 7, and these statistical characteristics are used as the predicted values of the statistical characteristics. The maximum value of the statistical characteristics is used as the temperature of the pig's ear root.
[0077] In addition, the pig ear root line is manually extracted from the thermal imaging grayscale image. The reference value described in the temperature characterization part of the pig ear root is manually drawn in the thermal image with a width of 3 pixels. It is the connection between the pig ear and the pig body, and the shape is a line. Then the temperature is extracted as the reference value using the method in step 5. The temperature value of the pig ear root line is calculated using the method in step 5, and its statistical feature maximum value, mode, second largest value and average value are calculated. These statistical features are used as statistical feature reference values; the statistical feature prediction values and statistical feature reference values of N pigs are counted, N is between 50 and 100, and N=75 for this statistics, and the correlation is analyzed. Correlation analysis is to calculate the determination coefficient R between various statistical features (maximum value, mode, second largest value and average value). 2 ; Count the maximum temperature T_pred in the optimal prediction box of the ear root of 75 pigs max And manually draw the maximum temperature T_true on the ear root line max , the coefficient of determination R 2 It is 0.9535, and the effect is ideal. The maximum temperature value in the optimal box of the automatic identification prediction box of the ear base can be used to represent the temperature of the pig's ear base.
[0078] The statistical feature with the largest correlation is used to characterize the temperature of the pig's ear base, and the statistical feature of the ear base prediction box is the predicted value T_pred, and the statistical feature of the pig's ear base line is the reference value T_true.
[0079] 9 Visualization of temperature detection at the base of pig ears
[0080] like Figure 5 As shown, the prediction frame of the ear base and the temperature detection are extracted to visualize the temperature value of the ear base of the pig, wherein (a) is a typical frame image selected by time-interval frame extraction operation from the thermal infrared video data in the dual-spectrum video data, and (b) is an image of the ear base prediction frame and temperature prediction value obtained by a group-raising pig body temperature monitoring method of the present invention.
[0081] Experiment: Comparative experiment on temperature extraction of ear roots
[0082] 1. Data source: In a pig group-raising environment, a dual-spectrum thermal imager was used to shoot pigs from a bird's-eye view, collecting thermal image and visible light image data. The image contained multiple pigs. The thermal image data was used as the data for this experiment, and the thermal image data of 75 pigs were counted;
[0083] 2. Comparison of experimental methods:
[0084] Method a comes from Liu Gang's "Pig Ear Temperature Detection Method Based on Improved YOLO v4":
[0085] The head and ear roots of the pig are detected as the key parts for measuring the temperature of the pig; the temperature is extracted from the thermal image, and then the maximum temperature of the left and right ear roots is used as the pig's body temperature measurement value; the maximum temperature of the ear roots is manually counted as the pig's body temperature baseline value.
[0086] Method b, the method adopted by the present invention:
[0087] The ear roots of pigs are detected as the key parts of pig temperature measurement; the temperature is extracted from the thermal image, and then the statistical features with the largest correlation in the optimal frames of the left and right ear roots are selected through correlation analysis to represent the pig body temperature. After testing, the statistical feature with the largest correlation is the maximum value in the optimal prediction frame, which is used as the pig body temperature measurement value; the maximum value of the temperature at the ear roots is taken as the reference value of the pig body temperature;
[0088] 3. Overview of the experimental process:
[0089] 1) Use Hikvision thermal imager DS-2TD2636B-13 / P to take overhead photos of pigs in a group-raising environment, collect 1200 images, and divide them into training set, validation set and test set in a ratio of 8:1:1;
[0090] 2) Use deep learning models to train and detect the left and right ear roots of pigs;
[0091] 3) extracting the temperature value of the detected ear root in the thermal image;
[0092] Method a:
[0093] Count the temperature values of the two ear root prediction boxes, and select the maximum value of all temperature values as the pig body temperature measurement value;
[0094] Method b:
[0095] The optimal frame is selected for the temperature of the two ear root prediction frames according to the variance and standard deviation, the statistical characteristics of the optimal frame and the manually counted ear root line temperature values are calculated, and the statistical characteristics with the greatest correlation are selected as the pig body temperature measurement value;
[0096] 4) Extract temperature reference value
[0097] The methods for obtaining the reference value of pig body temperature in method a and method b are the same, and the maximum value of the ear root line temperature is manually extracted as the reference value of pig body temperature;
[0098] 6) Calculate the coefficient of determination between the measured temperature and the baseline value of the pig body temperature.
[0099] 4. Result analysis:
[0100] Method a:
[0101] The maximum temperature value of the left and right ear root prediction boxes is taken as the measured value, and the determination coefficient R with the reference value is calculated. 2 is 0.681;
[0102] Method b:
[0103] First, select the optimal prediction frame of the left and right ear roots, then use the maximum temperature value of the optimal prediction frame of the left and right ear roots as the measured value, and then calculate the determination coefficient R with the reference value. 2 is 0.953;
[0104] It can be seen that the determination coefficient R of the method b used in the present invention is 2 The value is better than that of method a, and the temperature measurement values of the optimal prediction frame at the left and right ear roots can be used to represent the body temperature of the pig.
[0105] In summary, compared with the existing method of directly extracting the maximum temperature as the body temperature of pigs after predicting the left and right ear regions, the present invention proposes a method for identifying the optimal prediction frames of the left and right ear root regions, and a method for characterizing the body temperature of pigs by selecting the statistical features with the largest correlation in the optimal frames of the left and right ear root regions through correlation analysis, which improves the accuracy of body temperature detection of group-raised pigs.
[0106] Finally, it should be noted that the above examples are only some specific embodiments of the present invention. Obviously, the present invention is not limited to the above embodiments, and there are many variations. All variations that can be directly derived or associated with the content disclosed by a person skilled in the art should be considered as the protection scope of the present invention.
Claims
1. A method for monitoring body temperature of group-raised pigs, characterized in that: The processes involved are as follows: S1. The bispectral video data of group-raised pigs are collected through the pig video data collection system. Then, the thermal infrared video data in the bispectral video data is subjected to a time-interval extraction operation. The selected frame images are input into the offline trained pig ear base position recognition model to obtain the predicted image img and the ear base position detection result of each pig, including the left and right ear category information and the ear base position prediction frame; S2. Extract the temperature value from the ear root of each pig's predicted image img and construct the temperature matrix Temp() of the left ear root prediction frame L And the temperature matrix Temp() of the right ear root prediction box R ; S3, temperature matrix Temp() of the left ear root prediction frame L And the temperature matrix Temp() of the right ear root prediction box R Calculate the statistical characteristic standard deviation σ respectively L , σ R , choose σ L , σ R The ear root prediction box with the smaller standard deviation σ is taken as the optimal box; S4. Calculate the maximum value, mode, second largest value and average value of the statistical characteristics through the optimal frame, and use the maximum value of the statistical characteristics as the temperature of the pig's ear root.
2. A method for monitoring body temperature of group-reared pigs according to claim 1, characterized in that: The specific method for extracting the temperature value of the ear root part in step S2 is: In the prediction image img, all pixel values within the boundary of the ear root prediction box are extracted as the point set Pixel(), and the corresponding temperature values of all pixel values in the point set Pixel() are calculated using linear interpolation as the temperature matrix Temp(), including the temperature matrix Temp() of the left ear root prediction box L And the temperature matrix Temp() of the right ear root prediction box R .
3. A method for monitoring body temperature of group-reared pigs according to claim 2, characterized in that: The temperature matrix Temp() of the left ear root prediction frame L And the temperature matrix Temp() of the right ear root prediction box R The specific calculation method is: (1) Create a mask with all pixel values set to 0, and the size is the same as the predicted image img; (2) setting the pixel value in the prediction box area of the pig ear root on the mask to 255; (3) Perform a bitwise AND operation on the predicted image img and the mask mask, and retain the pixel values in the predicted box area of the pig ear root on the mask mask, and set the pixel values in other areas to 0; (4) Obtain the coordinate index value of the non-zero pixel on the mask mask, and extract the pixel value of the corresponding position in the predicted image img according to the coordinate index value; save the extracted pixel value in the form of a list P[] L ,P[] R , is the pixel value in the prediction box of the ear root; (5) Based on the thermal infrared video data, the thermal imaging grayscale image corresponding to the frame image selected by the time-interval frame extraction operation is mapped to the temperature value one by one using the linear difference method: Among them, P max , P min are the maximum and minimum pixel values in the thermal imaging grayscale image, T max 、T min They are the maximum and minimum temperatures in the thermal imaging grayscale image, respectively; T is the temperature prediction value, and P is the grayscale value of each pixel; (6) Calculate P[] L ,P[] R The temperature value corresponding to the pixel value in the middle is used to obtain the temperature matrix Temp() of the left ear root prediction box. L And the temperature matrix Temp() of the right ear root prediction box R .
4. A method for monitoring body temperature of group-reared pigs according to claim 3, characterized in that: The pig ear base part recognition model is a YOLOv8-OBB model.
5. A method for monitoring body temperature of group-reared pigs according to claim 4, characterized in that: The offline training process of the pig ear root position recognition model is as follows: The pig video data acquisition system is used to collect dual-spectrum video data of group-raised pigs during the normal feeding cycle from piglets to fattening pigs, and then frame extraction is performed at intervals to select a set of typical frame images as the data set; the ear base of the pigs in all images in the data set are annotated, and then divided into training set, validation set and test set; the training set and validation set are used to train to obtain the optimal model parameters, and the test set is used to test the performance of the optimal model parameters.
6. The pig video data acquisition system used in the method for monitoring the body temperature of group-raised pigs according to any one of claims 1 to 5, characterized in that: It includes a dual-spectrum camera arranged on the top of the cultivation room, the dual-spectrum camera is electrically connected to a network hard disk video recorder through a network, and the network hard disk video recorder is electrically connected to a computer through a network; The dual-spectrum camera is installed above the drinking trough of the pig pen to shoot the entire pig pen from a bird's-eye view.
Citation Information
Patent Citations
Infrared fast temperature measuring device and temperature measuring method for live pig body temperature monitoring
CN110200596A
Pig body temperature detection method in multi-pig scene based on infrared image
CN111145205A
Moving target body surface temperature rapid detection method and system based on thermal infrared video
CN111982296A
Pig group body temperature automatic detection method based on cross-modal feature fusion
CN118115849A
Cited By
Settlement deformation monitoring device and method for road bridge
CN121723435A
A device and method for monitoring settlement deformation of a road bridge
CN121723435B