Piglet temperature monitoring and early warning method and device based on binocular vision
Through binocular vision technology and image processing algorithms, the problem that piglet temperature monitoring in existing technologies cannot distinguish and locate dead piglets is solved, and accurate monitoring and early warning of piglet temperature are achieved.
Patent Information
- Application Number
- CN202310274041.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-20
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2043-03-20
AI Technical Summary
Existing technologies are unable to effectively distinguish piglets and locate dead piglets, resulting in the failure of temperature monitoring and early warning methods.
A binocular vision-based method is used to obtain visible light images and infrared pseudo-color images of piglets through a binocular camera. Combined with the Mask R-CNN model and image registration model, the piglets are located and the temperature pixel matrix is extracted, and an early warning is issued according to the temperature anomaly classification standards.
It achieves effective differentiation of piglets and accurate location of dead piglets, and improves the accuracy and early warning capability of temperature monitoring.
Smart Images

Figure CN116358707B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of piglet temperature monitoring, and in particular relates to a binocular vision-based piglet temperature monitoring and early warning method and device. Background Art
[0002] Piglets are relatively fragile and prone to mortality for a considerable period of time immediately after birth and before weaning. Studies have shown that the average mortality rate for piglets from birth and nursing to weaning, which is a period of growing up, is around 20%, demonstrating the extreme vulnerability of piglets during the nursing period. Furthermore, pigs infected with influenza can experience a rapid rise in body temperature, and diarrhea can be accompanied by high fever and refusal to eat. If ill pigs are not promptly treated, they can die. Therefore, rapidly detecting abnormal piglet temperatures is crucial for preventing mortality.
[0003] One existing technique involves demarcating connected regions in binary images to distinguish individual pigs. However, piglets often gather in groups to stay warm or to feed on their mother's milk. Using this method, the binary image shows multiple piglets clumped together, forming a large connected region. This makes it impossible to distinguish individual piglets from each other, making it impossible to measure their temperature.
[0004] After a piglet dies, its temperature drops rapidly, with different parts of the body cooling at different rates. This temperature difference causes the pig's overall shape to be incomplete in the infrared image. Another existing technique uses template matching to locate the pig's head in a binary image. However, after a piglet dies, the target piglet's shape in the infrared image is no longer regular and complete, making it impossible to use template matching to locate the pig, and subsequent temperature measurement cannot proceed.
[0005] If a target detection algorithm is used to identify piglets in infrared images alone, when a group of piglets are gathered together, the infrared image will have difficulty distinguishing the outlines of each piglet due to the relatively uniform temperature of the piglets. Therefore, using infrared images alone for target detection is ineffective. Furthermore, after a piglet dies, the infrared image gradually dims as time passes, eventually matching the ambient temperature. This makes it impossible for the target recognition algorithm to detect the dead piglet. Summary of the Invention
[0006] In response to the above-mentioned deficiencies in the prior art, the present invention provides a binocular vision-based piglet temperature monitoring and early warning method and device that solves the problem that the existing piglet temperature monitoring and early warning method cannot effectively distinguish pigs and cannot locate dead pigs.
[0007] In order to achieve the above-mentioned purpose of the invention, the technical solution adopted by the present invention is: a piglet temperature monitoring and early warning method based on binocular vision, comprising the following steps:
[0008] S1, collect piglet visible light image, piglet infrared pseudo-color image and infrared original temperature byte sequence to obtain piglet initial data;
[0009] S2. Establish an image registration model, and obtain a piglet temperature pixel matrix based on the image registration model and the initial piglet data;
[0010] S3. Based on the piglet temperature pixel matrix, the temperature abnormality classification standard is used to obtain temperature abnormality warning information and complete the piglet temperature monitoring and warning.
[0011] The beneficial effects of the present invention are as follows: the present invention fits the registration parameter curves at different distances through a shallow neural network to realize the registration of the visible light image of the piglet and the infrared pseudo-color image of the piglet; the initial piglet data can be combined with the Mask R-CNN model to help locate all target piglets, overcoming the problem that a single infrared camera cannot locate dead piglets, and on this basis, the piglet temperature pixel matrix of all piglets is extracted; according to the extracted piglet temperature pixel matrix, following the piglet temperature abnormality grading standard, according to the growth and development stage of the piglet, the temperature threshold is dynamically selected to determine the temperature status of the pig, and 5 different temperature health warnings are issued according to different health statuses, which solves the problem that the existing piglet temperature monitoring and warning methods cannot effectively distinguish pigs and cannot locate dead pigs.
[0012] Furthermore, the step S1 is specifically as follows:
[0013] S101, using a binocular camera to obtain a piglet visible light image, a piglet infrared pseudo-color image, and an infrared raw temperature byte sequence, respectively, according to the target distance and the ambient temperature;
[0014] S102, compressing the infrared original temperature byte sequence to obtain an infrared temperature matrix;
[0015] S103, obtaining first initial data based on the piglet visible light image, the piglet infrared pseudo-color image, and the infrared temperature matrix;
[0016] S104. According to a preset frame number, the frame number of the first initial data is controlled to obtain the initial data of the piglet.
[0017] The beneficial effects of the above further scheme are: compressing the infrared raw byte sequence to obtain the infrared temperature matrix; controlling the frame number of the transmission process of the piglet infrared pseudo-color image, the piglet visible light image and the infrared raw temperature byte sequence, reducing the data transmission volume to adapt to the limited processing capacity of the platform.
[0018] Furthermore, the step S102 is specifically as follows:
[0019] S1021. Read the infrared raw temperature byte sequence into a numpy matrix to obtain numpy data.
[0020] S1022. Reduce the precision of numpy data to obtain reduced-precision data;
[0021] S1023, amplify the reduced-precision data by 100 times to obtain amplified data;
[0022] S1024. Convert the amplified data into PNG format to obtain an infrared temperature matrix.
[0023] The beneficial effect of the above further solution is: compressing the infrared raw byte sequence reduces the data transmission volume to adapt to the limited processing capacity of the platform.
[0024] Furthermore, the step S104 is specifically as follows:
[0025] S1041. Obtain a frame control interval according to a preset number of frames;
[0026] S1042, obtaining the previous frame and the frame to be extracted of the first initial data;
[0027] S1043, obtaining a frame interval based on the time of the previous frame and the time of the frame to be extracted;
[0028] S1044, determine whether the frame interval is less than the frame control interval, if so, discard the frame to be extracted, otherwise, retain the frame to be extracted and proceed to step S1045;
[0029] S1045. Determine whether the first initial data completes frame number control. If so, obtain the piglet initial data. Otherwise, return to step S1042.
[0030] The beneficial effect of the above further solution is: frame number control is performed on the transmission process of the piglet infrared pseudo-color image, the piglet visible light image and the infrared original byte sequence, thereby reducing the data transmission volume to adapt to the limited processing capacity of the platform.
[0031] Furthermore, the step S2 is specifically as follows:
[0032] S201, collecting visible light images and infrared pseudo-color images of the circular hole at different distances from the circular hole plate to obtain a training data set;
[0033] S202, randomly selecting a number of circular holes from the images of the training data set and marking the center points of the circular holes to obtain a center point coordinate set;
[0034] S203. Perform affine transformation using the RANSAC algorithm based on the center point coordinate group to obtain an affine transformation matrix. The expression of the affine transformation is:
[0035]
[0036]
[0037] Where E is the affine transformation; x' is the horizontal coordinate of the center point of the circular hole on the visible light image of the central point coordinate group; y' is the vertical coordinate of the center point of the circular hole on the visible light image of the central point coordinate group; x is the horizontal coordinate of the center point of the circular hole on the infrared pseudo-color image of the central point coordinate group; y is the vertical coordinate of the center point of the circular hole on the infrared pseudo-color image of the central point coordinate group; M is the affine transformation matrix; m 11 、m 12 、m 13 、m 21 、m 22 and m 23 are all affine transformation matrix parameters;
[0038] S204, using a shallow neural network, taking a mean square error function as a loss function, and using an Adam optimizer to perform optimization to obtain an image registration model;
[0039] S205. Obtain a piglet temperature pixel matrix based on the image registration model and the initial piglet data.
[0040] The beneficial effects of the above further scheme are: fitting the registration parameter curves at different distances through a shallow neural network to achieve the registration of the piglet visible light image and the piglet infrared pseudo-color image; and using the initial piglet data combined with the Mask R-CNN model to help locate all target piglets, overcoming the problem that a single infrared camera cannot locate dead piglets, and solving the problem that the existing piglet temperature monitoring and early warning methods cannot effectively distinguish pigs and cannot locate dead pigs.
[0041] Furthermore, the step S205 is specifically as follows:
[0042] S2051. Obtain the piglet target distance and obtain the piglet registration parameters according to the image registration model;
[0043] S2052. Performing an affine transformation on the piglet visible light image in the initial piglet data according to the piglet registration parameters to obtain a transformed piglet visible light image;
[0044] S2053. Based on the transformed piglet visible light image, use the Mask R-CNN instance segmentation network to obtain the head mask and body mask;
[0045] S2054. Obtain a piglet temperature pixel matrix based on the head mask, the body mask, and the infrared temperature matrix in the initial piglet data.
[0046] The beneficial effect of the above further solution is: using the initial piglet data combined with the Mask R-CNN model to help locate all target piglets, overcoming the problem that a single infrared camera cannot locate dead piglets, and solving the problem that the existing piglet temperature monitoring and early warning method cannot effectively distinguish pigs and cannot locate dead pigs.
[0047] Furthermore, the step S3 is specifically as follows:
[0048] S301. Construct a temperature health function based on the piglet stage threshold:
[0049]
[0050]
[0051] Where F is the temperature health function; n is the total number of pixels of the target part in the piglet temperature pixel matrix; x i is the pixel temperature; i is the pixel temperature number; p i is the frequency of pixel temperature; f(x i ) is the pixel temperature score; bias is the active peak bias; T1 is the lower limit of normal temperature; T2 is the upper limit of normal temperature;
[0052] S302, obtaining the head temperature health score and body temperature health score of the target pig according to the piglet temperature pixel matrix and the temperature health function;
[0053] S303. Obtain a temperature health score based on the head temperature health score and the body temperature health score:
[0054] H=u*F head +v*F body
[0055] Among them, H is the temperature health score; u is the weight of the head health score in the temperature health score; v is the weight of the body health score in the temperature health score; F head F is the head temperature health score; body is the body temperature health score;
[0056] S304. According to the temperature health score and the piglet temperature abnormality grading standard, temperature abnormality warning information is obtained to complete the piglet temperature monitoring and warning.
[0057] The beneficial effects of the above further solution are as follows: According to the growth and development stage of piglets, the piglet stage threshold is dynamically selected. Based on the registered image, the area where the piglets are located is accurately segmented. The overall temperature of the piglets is obtained using the piglet temperature pixel matrix, and the temperature health status of the pigs is represented by the score obtained through the temperature scoring function. The temperature status of the pigs is determined, and five different temperature health warnings are issued according to different health statuses, solving the problems that the existing piglet temperature monitoring and warning methods cannot effectively distinguish pigs and cannot locate dead pigs.
[0058] Furthermore, in step S301, the piglet stage threshold is divided into five stages:
[0059] The first stage is just born: 34.4 °C < T < 35.6 °C;
[0060] The second stage is one hour after birth: 32.8 °C < T < 34.4 °C;
[0061] The third stage is twelve hours after birth: 33.2 °C < T < 34.8 °C;
[0062] The fourth stage is 24 hours after birth: 33.6 °C < T < 35.6 °C;
[0063] The fifth stage is from suckling piglets to weaning: 33.4 °C < T < 36.6 °C;
[0064] Among them, T is the normal temperature.
[0065] The beneficial effects of the above further solution are as follows: According to the growth and development stage of piglets, the piglet stage threshold is dynamically selected, reducing the misjudgment rate of piglet temperature warnings.
[0066] Furthermore, in step S304, the piglet temperature abnormality grading standard is divided into five levels:
[0067] The first level is ultra-low temperature:
[0068] H < -2.4
[0069] The second level is slightly low temperature:
[0070] -2.4 < H ≤ 0.5
[0071] The third level is normal temperature:
[0072] -0.5 < H < 0.5
[0073] The fourth level is slightly feverish:
[0074] 0.5 < H ≤ 2.5
[0075] The fifth level is overheating:
[0076] H>2.5
[0077] The beneficial effect of the above further scheme is: issuing 5 different temperature health warnings according to different health statuses, solving the problem that the existing piglet temperature monitoring and warning methods cannot effectively distinguish pigs and cannot locate dead pigs.
[0078] The present invention provides a binocular vision-based piglet temperature monitoring and early warning device, comprising a dual-mode camera and a microcomputer;
[0079] The infrared camera is used to obtain infrared pseudo-color images and infrared original temperature byte sequences of piglets;
[0080] The color camera is used to obtain visible light images of piglets;
[0081] The microcomputer is used to calculate temperature abnormality warning information based on the piglet visible light image, the piglet infrared pseudo-color image and the infrared original temperature byte sequence, and based on the image registration model to complete the piglet temperature monitoring and warning.
[0082] The beneficial effects of the present invention are: through the dual-modal camera acquiring the piglet visible light image, the piglet infrared pseudo-color image and the infrared original temperature byte sequence, and the microcomputer processing the data, the piglet temperature warning information is issued, thereby realizing the intelligentization of the piglet temperature warning. BRIEF DESCRIPTION OF THE DRAWINGS
[0083] Figure 1 Flow chart of the method of the present invention.
[0084] Figure 2 Schematic diagram of the calibration process of visible light images and infrared pseudo-color images in the present invention.
[0085] Figure 3 This is a structural diagram of the shallow neural network used in the present invention.
[0086] Figure 4 Schematic diagram of the device deployment of the present invention.
[0087] Figure 5 Detailed view of the dual-modal camera of the present invention.
[0088] Among them, 1 is a microcomputer; 2 is a dual-mode camera; 3 is a color camera; 4 is a mold; 5 is a mold screw; 6 is an infrared camera; and 7 is a camera screw. DETAILED DESCRIPTION
[0089] The specific embodiments of the present invention are described below to facilitate understanding of the present invention by those skilled in the art. However, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations utilizing the concepts of the present invention are protected.
[0090] Example 1
[0091] like Figure 1 As shown, in one embodiment of the present invention, a piglet temperature monitoring and early warning method based on binocular vision includes the following steps:
[0092] S1, collect piglet visible light image, piglet infrared pseudo-color image and infrared original temperature byte sequence to obtain piglet initial data;
[0093] S2. Establish an image registration model, and obtain a piglet temperature pixel matrix based on the image registration model and the initial piglet data;
[0094] S3. Based on the piglet temperature pixel matrix, the temperature abnormality classification standard is used to obtain temperature abnormality warning information and complete the piglet temperature monitoring and warning.
[0095] The step S1 is specifically as follows:
[0096] S101, using a binocular camera to obtain a piglet visible light image, a piglet infrared pseudo-color image, and an infrared raw temperature byte sequence, respectively, according to the target distance and the ambient temperature;
[0097] S102, compressing the infrared original temperature byte sequence to obtain an infrared temperature matrix;
[0098] S103, obtaining first initial data based on the piglet visible light image, the piglet infrared pseudo-color image, and the infrared temperature matrix;
[0099] S104. According to a preset frame number, the frame number of the first initial data is controlled to obtain the initial data of the piglet.
[0100] The step S102 is specifically as follows:
[0101] S1021. Read the infrared raw temperature byte sequence into a numpy matrix to obtain numpy data.
[0102] S1022. Reduce the precision of numpy data to obtain reduced-precision data;
[0103] S1023, amplify the reduced-precision data by 100 times to obtain amplified data;
[0104] S1024. Convert the amplified data into PNG format to obtain an infrared temperature matrix.
[0105] The step S104 is specifically as follows:
[0106] S1041. Obtain a frame control interval according to a preset number of frames;
[0107] S1042, obtaining the previous frame and the frame to be extracted of the first initial data;
[0108] S1043, obtaining a frame interval based on the time of the previous frame and the time of the frame to be extracted;
[0109] S1044, determine whether the frame interval is less than the frame control interval, if so, discard the frame to be extracted, otherwise, retain the frame to be extracted and proceed to step S1045;
[0110] S1045. Determine whether the first initial data completes frame number control. If so, obtain the piglet initial data. Otherwise, return to step S1042.
[0111] In this example, the infrared pseudo-color image captured by the infrared camera in the binocular camera has an image size of 192×256. The original infrared raw temperature byte sequence is a floating-point byte file with a total size of 48M bytes, which is a very large amount of raw data. The infrared raw temperature byte sequence is first read into a NumPy matrix, then the data precision is reduced, the data is amplified 100 times, and finally the amplified data is converted to PNG format to obtain the infrared temperature matrix. The compressed data size is approximately 6M, significantly reducing the amount of data required for transmission.
[0112] In this embodiment, the visible light color image P1, infrared pseudo-color image P2, and infrared temperature matrix P3 of a collected data frame are first Base64-encoded to obtain B1, B2, and B3 respectively. Then B1, B2, and B3 are added to the list L respectively. Finally, the list L is converted into a JSON string, and the data of one frame is uploaded to the service through the MQTT protocol.
[0113] In this embodiment, the frame rate of the infrared camera and color camera used in the present invention is as high as more than 20 frames. Due to the computing power of the edge device and the limited network bandwidth, frame rate control must be performed to adapt to the processing capacity of the platform.
[0114] The step S2 is specifically as follows:
[0115] S201, collecting visible light images and infrared pseudo-color images of the circular hole at different distances from the circular hole plate to obtain a training data set;
[0116] S202, randomly selecting a number of circular holes from the images of the training data set and marking the center points of the circular holes to obtain a center point coordinate set;
[0117] S203. Perform affine transformation using the RANSAC algorithm based on the center point coordinate group to obtain an affine transformation matrix. The expression of the affine transformation is:
[0118]
[0119]
[0120] Where E is the affine transformation; x' is the horizontal coordinate of the center point of the circular hole on the visible light image of the central point coordinate group; y' is the vertical coordinate of the center point of the circular hole on the visible light image of the central point coordinate group; x is the horizontal coordinate of the center point of the circular hole on the infrared pseudo-color image of the central point coordinate group; y is the vertical coordinate of the center point of the circular hole on the infrared pseudo-color image of the central point coordinate group; M is the affine transformation matrix; m 11 、m 12 、m 13 、m 21 、m 22 and m 23 are all affine transformation matrix parameters;
[0121] S204, using a shallow neural network, taking a mean square error function as a loss function, and using an Adam optimizer to perform optimization to obtain an image registration model;
[0122] S205. Obtain a piglet temperature pixel matrix based on the image registration model and the initial piglet data.
[0123] The step S205 is specifically as follows:
[0124] S2051. Obtain the piglet target distance and obtain the piglet registration parameters according to the image registration model;
[0125] S2052. Performing an affine transformation on the piglet visible light image in the initial piglet data according to the piglet registration parameters to obtain a transformed piglet visible light image;
[0126] S2053. Based on the transformed piglet visible light image, use the Mask R-CNN instance segmentation network to obtain the head mask and body mask;
[0127] S2054. Obtain a piglet temperature pixel matrix based on the head mask, the body mask, and the infrared temperature matrix in the initial piglet data.
[0128] In this embodiment, the circular hole plate is photographed at a distance of 0.5 meters to 3 meters, and a group of circular hole visible light images and circular hole infrared pseudo-color images are taken every 10 cm. The corresponding points of the circular hole plate on each group of images are marked, and the center point of the circular hole plate on the circular hole visible light image and the circular hole infrared pseudo-color image are marked, such as Figure 2 As shown in the figure. To reduce measurement errors, points were selected randomly and dispersed as much as possible. A total of eight points were selected for annotation, recording the coordinates of the center of the circular hole. This process was repeated for images captured at 26 distances ranging from 0.5 to 3.0 meters, resulting in a registration parameter matrix for a total of 26 different distances.
[0129] In this embodiment, the specific structure of the shallow neural network is as follows: the input layer consists of 1 neuron, the hidden layer 1 consists of 32 neurons, the hidden layer 2 consists of 16 neurons, the hidden layer 3 consists of 8 neurons, and the output layer consists of 6 neurons. After each hidden layer, it passes through the batch normalization (BatchNorm) layer, and then passes through the Tanh activation function before entering the next layer. The input of the network is the distance of the target plane recorded by the camera, and the output of the network is the 6 parameters of the affine transformation matrix. The structure of the network is as follows Figure 3 As shown in the figure, the mean square error function is used as the loss function, the Adam optimizer is selected as the optimizer, and the registration parameter fitting network is trained.
[0130] The step S3 is specifically as follows:
[0131] S301. Construct a temperature health function based on the piglet stage threshold:
[0132]
[0133]
[0134] Where F is the temperature health function; n is the total number of pixels of the target part in the piglet temperature pixel matrix; x i is the pixel temperature; i is the pixel temperature number; p i is the frequency of pixel temperature; f(x i ) is the pixel temperature score; bias is the active peak bias; T1 is the lower limit of normal temperature; T2 is the upper limit of normal temperature;
[0135] S302, obtaining the head temperature health score and body temperature health score of the target pig according to the piglet temperature pixel matrix and the temperature health function;
[0136] S303. Obtain a temperature health score based on the head temperature health score and the body temperature health score:
[0137] H=u*F head +v*Fbody
[0138] Among them, H is the temperature health score; u is the weight of the head health score in the temperature health score; v is the weight of the body health score in the temperature health score; F head is the head temperature health score; F body is the body temperature health score;
[0139] S304. According to the temperature health score and the piglet temperature abnormality grading standard, obtain the temperature abnormality warning information to complete the piglet temperature monitoring and warning.
[0140] In this embodiment, the Mask R-CNN instance segmentation network is used to perform instance segmentation and object detection on the target piglets in the visible light image of the piglets to find all target piglets, including healthy normal pigs, healthy abnormal pigs and dead pigs. After segmenting the target piglets, the target piglets are further segmented into the head and body of the pig, forming two masks F head and F body . Specifically, during the implementation process, 2000 images of piglets in the nursery are collected in advance for training the Mask R-CNN network. After manual annotation, a Mask R-CNN dataset is constructed and the data is divided into a training set, a validation set, and a test set, with a division ratio of 8:1:1. The obtained visible light image is input into the Mask R-CNN network, and the network will output a mask image. In this mask image, all the targets of the piglets can be found. Applying the masks F head and F body to the piglet temperature pixel matrix can obtain the temperature conditions of all target piglets.
[0141] In step S301, the piglet stage thresholds are divided into 5 stages:
[0142] The first stage is just born: 34.4 °C < T < 35.6 °C;
[0143] The second stage is one hour after birth: 32.8 °C < T < 34.4 °C;
[0144] The third stage is 12 hours after birth: 33.2 °C < T < 34.8 °C;
[0145] The fourth stage is 24 hours after birth: 33.6 °C < T < 35.6 °C;
[0146] The fifth stage is from suckling piglets to weaning: 33.4 °C < T < 36.6 °C;
[0147] Among them, T is the normal temperature.
[0148] The piglet temperature abnormality classification standard in step S304 is divided into 5 levels:
[0149] The first stage is ultra-low temperature:
[0150] H<-2.4
[0151] The second level is mild hypothermia:
[0152] -2.4<H≤0.5
[0153] The third level is normal temperature:
[0154] -0.5<H<0.5
[0155] Level 4 is mild fever:
[0156] 0.5<H≤2.5
[0157] Level 5 is excessive fever:
[0158] H>2.5
[0159] In this embodiment, the infrared camera measures the body surface temperature of the piglets. The ambient temperature of the pig farm is set at 25 degrees Celsius. The body surface temperature of the piglets is approximately 33.4 degrees Celsius to 36.6 degrees Celsius. The temperature health status of the piglets is classified as follows:
[0160] Ultra-low temperature: When H<-2.4, the piglets are considered to be in an ultra-low temperature state;
[0161] Mild hypothermia: When -2.4<H≤0.5, the piglets are considered to be in a state of mild hypothermia;
[0162] Normal temperature: When -0.5<H<0.5, the temperature of the piglet is considered normal;
[0163] Mild fever: When 0.5<H≤2.5, the pig is considered to have a mild fever;
[0164] Hyperthermia: When H>2.5, it is considered hyperthermia;
[0165] If the temperature health function reaches the ultra-low temperature threshold, the pig is considered dead.
[0166] A temperature scoring function is applied to the temperature in the area surrounding each target piglet. Different thresholds are selected for each piglet's growth and development stage, and their temperature health status is output, forming a temperature status label. The temperature status of each target piglet is then added as a label above each target in the piglet's visible light image. Technicians can observe each piglet's temperature based on the temperature label on the piglet's visible light image.
[0167] Example 2
[0168] The present invention provides a piglet temperature monitoring and early warning device based on binocular vision, comprising a dual-mode camera and a microcomputer;
[0169] The infrared camera is used to obtain infrared pseudo-color images and infrared original temperature byte sequences of piglets;
[0170] The color camera is used to obtain visible light images of piglets;
[0171] The microcomputer is used to calculate temperature abnormality warning information based on the piglet visible light image, the piglet infrared pseudo-color image and the infrared original temperature byte sequence, and based on the image registration model to complete the piglet temperature monitoring and warning.
[0172] In this embodiment, the piglet temperature monitoring and early warning device includes a dual-mode camera for collecting visible light images, infrared pseudo-color images and infrared raw temperature byte sequences, and a Raspberry Pi microcomputer for data processing and transmission; specifically, the dual-mode camera is separated from the microcomputer, and the camera is connected to the microcomputer via a USB data cable. The camera is fixedly installed on the beam above the pig farm nursery house, and its deployment diagram is shown in the figure below. Figure 4 As shown in Figure 1, the optimal distance between the camera and the ground is set to 1.5 meters to 2.5 meters, where 1 is a microcomputer and 2 is a dual-mode camera, which is connected via a USB cable. The details of the dual-mode camera are as follows: Figure 5 As shown, 6 is the infrared camera, fixed to the mold via the camera screw at 7, 3 is the color camera, embedded in the mold, and 4 is the mold. During deployment, the mold is fixed to the upper beam of the nursery via the mold screw at 5, allowing for a direct view from above. More specifically, the distance between the center point of the infrared camera lens and the center point of the color camera lens is 11.12mm along the x-axis and 29.90mm along the y-axis. The infrared camera uses the AutoNavi intelligent temperature module, and the color camera uses the Shengyue WX151 color camera module.
Claims
1. A piglet temperature monitoring and early warning method based on binocular vision, characterized in that: The following steps are involved: S1, collect piglet visible light image, piglet infrared pseudo-color image and infrared original temperature byte sequence to obtain piglet initial data; S2. Establish an image registration model, and obtain a piglet temperature pixel matrix based on the image registration model and the initial piglet data; S3, according to the piglet temperature pixel matrix, using the piglet temperature abnormality classification standard to obtain temperature abnormality warning information, and complete the piglet temperature monitoring and early warning; the step S3 is specifically as follows: S301. Construct a temperature health function based on the piglet stage threshold: in, is the temperature health function; is the total number of pixels of the target area in the piglet temperature pixel matrix; is the pixel temperature; i The temperature number of the pixel; is the frequency of pixel temperature; Score pixel temperature; bias for active peak bias; It is the lower limit of normal temperature; The upper limit of normal temperature; S302, obtaining the head temperature health score and body temperature health score of the target pig according to the piglet temperature pixel matrix and the temperature health function; S303. Obtain a temperature health score based on the head temperature health score and the body temperature health score: in, Score temperature health; u The weight of the head health score over the temperature health score; v is the weight of the body health score in the temperature health score; is the head temperature health score; is the body temperature health score; S304. According to the temperature health score and the piglet temperature abnormality grading standard, temperature abnormality warning information is obtained to complete the piglet temperature monitoring and warning.
2. The binocular vision-based piglet temperature monitoring and early warning method according to claim 1, characterized in that: The step S1 is specifically as follows: S101, using a binocular camera to obtain a piglet visible light image, a piglet infrared pseudo-color image, and an infrared raw temperature byte sequence, respectively, according to the target distance and the ambient temperature; S102, compressing the infrared original temperature byte sequence to obtain an infrared temperature matrix; S103, obtaining first initial data based on the piglet visible light image, the piglet infrared pseudo-color image, and the infrared temperature matrix; S104. According to a preset frame number, the frame number of the first initial data is controlled to obtain the initial data of the piglet.
3. The piglet temperature monitoring and early warning method based on binocular vision according to claim 2 is characterized in that: The step S102 is specifically as follows: S1021. Read the infrared raw temperature byte sequence into a numpy matrix to obtain numpy data. S1022. Reduce the precision of numpy data to obtain reduced-precision data; S1023, amplify the reduced-precision data by 100 times to obtain amplified data; S1024. Convert the amplified data into PNG format to obtain an infrared temperature matrix.
4. The binocular vision-based piglet temperature monitoring and early warning method according to claim 3, characterized in that: The step S104 is specifically as follows: S1041. Obtain a frame control interval according to a preset number of frames; S1042, obtaining the previous frame and the frame to be extracted of the first initial data; S1043, obtaining a frame interval based on the time of the previous frame and the time of the frame to be extracted; S1044, determine whether the frame interval is less than the frame control interval, if so, discard the frame to be extracted, otherwise, retain the frame to be extracted and proceed to step S1045; S1045. Determine whether the first initial data completes frame number control. If so, obtain the piglet initial data. Otherwise, return to step S1042.
5. The binocular vision-based piglet temperature monitoring and early warning method according to claim 1, characterized in that: The step S2 is specifically as follows: S201, collecting visible light images and infrared pseudo-color images of the circular hole at different distances from the circular hole plate to obtain a training data set; S202, randomly selecting a number of circular holes from the images of the training data set and marking the center points of the circular holes to obtain a center point coordinate set; S203. Perform affine transformation using the RANSAC algorithm based on the center point coordinate group to obtain an affine transformation matrix. The expression of the affine transformation is: in, is an affine transformation; is the horizontal coordinate of the center point of the circular hole on the visible light image of the circular hole in the center point coordinate group; is the ordinate of the center point of the circular hole on the visible light image of the circular hole in the center point coordinate group; is the horizontal coordinate of the center point of the circular hole on the infrared pseudo-color image of the circular hole in the center point coordinate group; is the ordinate of the center point of the circular hole on the infrared pseudo-color image of the circular hole in the center point coordinate group; is the affine transformation matrix; 、 、 、 、 and are all affine transformation matrix parameters; S204, using a shallow neural network, taking a mean square error function as a loss function, and using an Adam optimizer to perform optimization to obtain an image registration model; S205. Obtain a piglet temperature pixel matrix based on the image registration model and the initial piglet data.
6. The binocular vision-based piglet temperature monitoring and early warning method according to claim 5, characterized in that: The step S205 is specifically as follows: S2051. Obtain the piglet target distance and obtain the piglet registration parameters according to the image registration model; S2052. Performing an affine transformation on the piglet visible light image in the initial piglet data according to the piglet registration parameters to obtain a transformed piglet visible light image; S2053. Based on the transformed piglet visible light image, use the Mask R-CNN instance segmentation network to obtain the head mask and body mask; S2054. Obtain a piglet temperature pixel matrix based on the head mask, the body mask, and the infrared temperature matrix in the initial piglet data.
7. The binocular vision-based piglet temperature monitoring and early warning method according to claim 1, characterized in that: The piglet stage threshold in step S301 is divided into 5 stages: The first stage is just after birth: ; The second stage is one hour after birth: ; The third stage is 12 hours after birth: ; The fourth stage is 24 hours after birth: ; The fifth stage is from suckling piglets to weaning: ; Where T is the normal temperature.
8. The binocular vision-based piglet temperature monitoring and early warning method according to claim 1, characterized in that: The piglet temperature abnormality classification standard in step S304 is divided into 5 levels: The first stage is ultra-low temperature: The second level is mild hypothermia: The third level is normal temperature: Level 4 is mild fever: Level 5 is excessive fever:
9. The piglet temperature monitoring and early warning device according to any one of claims 1 to 8, characterized in that: The piglet temperature monitoring and early warning device based on binocular vision includes a dual-mode camera and a microcomputer; the dual-mode camera includes an infrared camera and a color camera; The infrared camera is used to obtain infrared pseudo-color images and infrared original temperature byte sequences of piglets; The color camera is used to obtain visible light images of piglets; The microcomputer is used to calculate temperature abnormality warning information based on the piglet visible light image, the piglet infrared pseudo-color image and the infrared original temperature byte sequence, and based on the image registration model to complete the piglet temperature monitoring and warning.
Citation Information
Patent Citations
Poultry body temperature detection method and device based on image fusion and medium
CN113223033A
Method and apparatus for merging infrared image and visible light image
WO2018076732A1