An intelligent detection method for the body temperature of animals used in veterinary medicine for livestock

Through video frame processing and neural network segmentation, the relationship between pig's movement status and facial ear root position is analyzed, which solves the problem of detection accuracy when pig ear overlaps, and improves the accuracy of pig body temperature detection.

CN119888798BActive Publication Date: 2025-06-17SHENZHEN CHENGCHENG HIGH-TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510378310.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-06-17
Estimated Expiration
2045-03-28

AI Technical Summary

Technical Problem

The existing pig body temperature detection methods are difficult to accurately determine the pig to which each pig ear belongs when multiple pig ears overlap, resulting in a decrease in the accuracy of intelligent animal body temperature detection.

Method used

By obtaining video frames at each moment when the pigs enter and exit the feeding farm, the pig ear root region and the pig face area are divided using the segmentation neural network. According to the changes in the center of mass coordinates at adjacent moments and the distribution position of continuous moments, the movement status and position relationship between each pig ear root region and each pig face area is determined, thereby determining the final consistency, and the temperature value of each pig face area is obtained based on the temperature value.

Benefits of technology

It improves the accuracy of judging pigs to which pig ears belong, enhances the accuracy of intelligent detection of animal body temperature in animal husbandry, and facilitates subsequent data management and personnel analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888798B_ABST
    Figure CN119888798B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of image data processing, and particularly relates to an intelligent method for detecting the body temperature of animals for veterinary use in animal husbandry, including: obtaining video frames at each moment when the pig herd enters and exits the breeding farm, and determining the consistency of the motion state between each pig ear root region and each pig face region in the video frames at consecutive moments, as well as the consistency of the positional relationship between each pig ear root region and each pig face region in the video frames at each moment, so as to determine the final consistency of each pig ear root region and each pig face region, and then combining the temperature value corresponding to each pixel point in the video frame to determine the temperature value corresponding to each pig face region. By analyzing the movement characteristics of pigs and the positional relationship between the pig face and the ear root, the present invention improves the accuracy of determining the pig to which the pig ear belongs, thereby improving the accuracy of intelligent detection of the body temperature of animals in animal husbandry.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image data processing, and particularly relates to an intelligent animal body temperature detection method for livestock and veterinary medicine. Background Art

[0002] The intelligent animal body temperature detection method for livestock and veterinary medicine is a way to monitor and analyze animal body temperature using modern information technology and biotechnology, which can monitor animal body temperature in real time and detect health problems in a timely manner. For example: in the pig breeding industry, group diseases such as swine fever will cause huge economic losses, and there are often changes in body temperature in the early stage of the disease. Therefore, the pig breeding industry will detect the body temperature of pigs to prevent epidemics and diseases. Currently, the main method for detecting the body temperature of pigs in pig farms is to detect pigs with abnormal temperatures through infrared technology, and determine the pigs with abnormal temperatures according to the abnormal temperature areas on the infrared images.

[0003] Existing problems: Since the ear root part is rich in blood vessels and the blood flow is fast, which can better reflect the animal's body temperature, the body temperature detection often takes the temperature of the pig ear root part as the standard. When multiple pig ears overlap in the infrared image, it may be impossible to accurately judge which pig each pig ear belongs to, thus reducing the accuracy of intelligent animal body temperature detection. Summary of the Invention

[0004] The present invention provides an intelligent animal body temperature detection method for livestock and veterinary medicine to solve the existing problems.

[0005] An intelligent animal body temperature detection method for livestock and veterinary medicine of the present invention adopts the following technical solutions:

[0006] An embodiment of the present invention provides an intelligent animal body temperature detection method for livestock and veterinary medicine, and the method includes the following steps:

[0007] Obtain video frames at each moment when the pig group enters and exits the breeding farm; each pixel point in the video frame corresponds to a temperature value;

[0008] Use a segmentation neural network to segment the pig ear root area and the pig face area in the video frame at each moment; according to the change of the centroid coordinates of the pig ear root area and the centroid coordinates of the pig face area in the video frames at adjacent moments, determine the consistency of the motion state between each pig ear root area and each pig face area at adjacent moments;

[0009] According to the distribution positions of the pig ear root area and the pig face area in the video frames at consecutive moments, determine the consistency of the positional relationship between each pig ear root area and each pig face area in the video frame at each moment;

[0010] Determine the final consistency between each pig ear root region and each pig face region in the video frame at each moment based on the positional relationship consistency between each pig ear root region and each pig face region in the video frame at each moment and the motion state consistency between each pig ear root region and each pig face region between adjacent moments;

[0011] Determine the temperature value corresponding to each pig face region in the video frame at each moment based on the final consistency between each pig ear root region and each pig face region in the video frame at each moment and the temperature value corresponding to each pixel point in the video frame.

[0012] Furthermore, the specific steps for determining the motion state consistency between each pig ear root region and each pig face region between adjacent moments are as follows:

[0013] Take the th pig ear root region in the video frame at the th moment and the th pig face region as the reference pig ear root region and the reference pig face region respectively;

[0014] During the period from the th moment to the th moment, use the target tracking algorithm to obtain the reference pig ear root region and the reference pig face region in the video frame at each moment within this period; where is a preset time threshold;

[0015] In the video frame at each moment, construct a rectangular coordinate system with the vertex at the lower left corner of the video frame as the origin, the horizontal right direction as the x-axis, and the vertical upward direction as the y-axis;

[0016] On the rectangular coordinate system of the video frame at each moment, obtain the centroid coordinates of each pig ear root region and the centroid coordinates of each pig face region in the video frame at each moment;

[0017] Determine the displacement amount consistency between the reference pig ear root region and the reference pig face region between adjacent moments based on the distance between the centroid coordinates of the reference pig ear root region in the video frames of adjacent moments and the distance between the centroid coordinates of the reference pig face region;

[0018] Determine the displacement direction consistency between the reference pig ear root region and the reference pig face region between adjacent moments based on the straight line passing through the centroid coordinates of the reference pig ear root region in the video frames of adjacent moments and the straight line passing through the centroid coordinates of the reference pig face region on the rectangular coordinate system;

[0019] Determine the motion state consistency between the reference pig ear root region and the reference pig face region between adjacent moments based on the displacement amount consistency and the displacement direction consistency between the reference pig ear root region and the reference pig face region between adjacent moments.

[0020] Further, the determination of the displacement amount consistency between the reference pig ear root region and the reference pig face region between adjacent moments includes the following specific steps:

[0021] Calculate the Euclidean distance between the centroid coordinates of the reference pig ear root region in the video frames at the th moment and the th moment as the first distance, calculate the Euclidean distance between the centroid coordinates of the reference pig face region in the video frames at the th moment and the th moment as the second distance, and take the inverse proportional normalization value of the absolute value of the difference between the first distance and the second distance as the displacement amount consistency between the reference pig ear root region and the reference pig face region at the th moment and the th moment.

[0022] Further, the determination of the displacement direction consistency between the reference pig ear root region and the reference pig face region between adjacent moments includes the following specific steps:

[0023] On the rectangular coordinate system, obtain the straight line passing through the centroid coordinates of the reference pig ear root region in the video frames at the th moment and the th moment as the first straight line, obtain the straight line passing through the centroid coordinates of the reference pig face region in the video frames at the th moment and the th moment as the second straight line, and take the normalization value of the minimum included angle value between the first straight line and the second straight line as the displacement direction consistency between the reference pig ear root region and the reference pig face region at the th moment and the th moment.

[0024] Further, the determination of the motion state consistency between the reference pig ear root region and the reference pig face region between adjacent moments includes the following specific steps:

[0025] Multiply the displacement amount consistency and the displacement direction consistency between the reference pig ear root region and the reference pig face region at the th moment and the th moment as the motion state consistency between the reference pig ear root region and the reference pig face region at the th moment and the th moment.

[0026] Further, the determination of the positional relationship consistency between each pig ear root region and each pig face region in the video frame at each moment includes the following specific steps:

[0027] Use the morphological thinning algorithm to obtain the For the skeleton line of the reference pig face area in the video frame at a moment, then use the Hough line detection algorithm to perform line detection on the skeleton line to obtain the line segment corresponding to the skeleton line as the first line segment;

[0028] According to the first line segment in the video frame at the moment and the centroid of the reference pig ear root area, determine the target included angle in the video frame at the moment;

[0029] According to the target included angles in the video frames at consecutive moments, determine the consistency of the positional relationship between the reference pig ear root area and the reference pig face area in the video frame at each moment.

[0030] Further, the determination of the target included angle in the video frame at the moment includes the following specific steps:

[0031] In the video frame at the moment, obtain the line segment from the center point of the first line segment to the centroid of the reference pig ear root area as the second line segment, and record the minimum included angle between the first line segment and the second line segment as the target included angle in the video frame at the moment.

[0032] Further, the determination of the consistency of the positional relationship between the reference pig ear root area and the reference pig face area in the video frame at each moment includes the following specific steps:

[0033] In the video frames at all moments within the time period from the moment to the moment, calculate the inverse proportional normalization value of the difference between the maximum target included angle and the minimum target included angle among the target included angles in the video frames at all moments as the first difference, calculate the inverse proportional normalization value of the variance of all target included angles as the second difference, and take the product of the first difference and the second difference as the consistency of the positional relationship between the reference pig ear root area and the reference pig face area in the video frame at the moment.

[0034] Further, the determination of the final consistency between each pig ear root area and each pig face area in the video frame at each moment includes the following specific steps:

[0035] In the time period from the moment to the moment, calculate the mean value of the consistency of the motion states between the reference pig ear root area and the reference pig face area at all adjacent moments, and calculate the product of the mean value and the consistency of the positional relationship between the reference pig ear root area and the reference pig face area in the video frame at the moment as the The final consistency between the reference pig ear root region and the reference pig face region in the video frame at a moment.

[0036] Further, the step of determining the temperature value corresponding to each pig face region in the video frame at each moment specifically includes the following steps:

[0037] At the moment of the video frame, the pig face region corresponding to the maximum value in the final consistency between the th pig ear root region and all pig face regions is used as the pig face region to which the th pig ear root region belongs. The average value of the temperature values corresponding to the pixel points at the centroid of all pig ear root regions belonging to each pig face region is used as the temperature value corresponding to each pig face region.

[0038] The beneficial effects of the technical solution of the present invention are as follows:

[0039] In the embodiment of the present invention, video frames at each moment when the pig group enters and exits the breeding farm are obtained. According to the changes in the centroid coordinates of the pig ear root regions and the centroid coordinates of the pig face regions in the video frames at adjacent moments, the movement state consistency between each pig ear root region and each pig face region between adjacent moments is determined. Thus, through the movement consistency of the face and ear root of the same pig, preliminary judgment parameters (movement state consistency) are obtained, ensuring the accuracy of subsequent matching of the pig's face and ear root. According to the distribution positions of the pig ear root regions and the pig face regions in the video frames at consecutive moments, the position relationship consistency between each pig ear root region and each pig face region in the video frame at each moment is determined. Thus, through the position relationship between the face and ear root of the same pig, further judgment parameters (position relationship consistency) are obtained, further ensuring the accuracy of matching the pig's face and ear root. Then, according to the movement state consistency and the position relationship consistency, the final consistency between each pig ear root region and each pig face region in the video frame at each moment is obtained, and combined with the temperature value corresponding to each pixel point in the video frame, the temperature value corresponding to each pig face region in the video frame at each moment is determined. So far, the present invention improves the accuracy of determining the pig to which the pig ear belongs by analyzing the movement characteristics of the pig and the position relationship between the pig face and the ear root, thereby improving the accuracy of intelligent detection of the body temperature of livestock animals, which is beneficial to subsequent data management and personnel's analysis of body temperature data, and also beneficial to the intelligentization of animal body temperature detection. Description of the Drawings

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0041] Figure 1 This is the flowchart of the steps of an intelligent animal body temperature detection method for livestock and veterinary medicine according to the present invention;

[0042] Figure 2 This is a schematic front view of a pig in this embodiment;

[0043] Figure 3 This is a schematic diagram of the included angle between the center line of the pig's face and the line connecting the center of the pig's face to the center of the pig's ear root in this embodiment. Detailed implementation manners

[0044] In order to further elaborate on the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following, in combination with the accompanying drawings and preferred embodiments, details a method for intelligent detection of animal body temperature for livestock and veterinary medicine according to the present invention, including its specific implementation manners, structures, features and effects. In the following description, different "one embodiment" or "another embodiment" do not necessarily refer to the same embodiment. In addition, the specific features, structures or characteristics in one or more embodiments can be combined in any suitable form.

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present invention belongs.

[0046] The following specifically describes the specific solution of an intelligent animal body temperature detection method for livestock and veterinary medicine provided by the present invention with reference to the accompanying drawings.

[0047] Please refer to Figure 1 , which shows the flowchart of the steps of an intelligent animal body temperature detection method for livestock and veterinary medicine provided by an embodiment of the present invention. The method includes the following steps:

[0048] Step S001: Obtain video frames at each moment when the pig group enters and exits the breeding farm; each pixel point in the video frame corresponds to a temperature value.

[0049] This embodiment mainly judges the pig body to which the pig ear belongs by analyzing the positional relationship and motion state between the pig's face and the pig's ear root, obtains the corresponding body temperature of the pig, and completes the intelligent detection of the body temperature of livestock animals.

[0050] At the exit of the breeding farm, a dual-spectrum camera facing the inside of the breeding farm is installed. At the entrance of the breeding farm, a dual-spectrum camera facing the outside of the breeding farm is installed. When animals enter and exit the breeding farm, in order to capture their front views when the animals pass by, video frames at each moment when the pig group enters and exits the breeding farm are obtained. That is, when the pig group enters the breeding farm, the dual-spectrum camera facing the outside of the breeding farm is used to collect video frames. When the pig group exits the breeding farm, the dual-spectrum camera facing the inside of the breeding farm is used to collect video frames. A schematic front view of a pig is shown as Figure 2 shown.

[0051] It should be noted that: A dual-spectrum camera is usually equipped with two sensors, one for capturing visible light images and the other for capturing infrared images. In this embodiment, the video frame is a visible light image, and the pixel points in the visible light image and the infrared image at the same moment correspond one by one. According to the temperature value corresponding to each pixel point in the infrared image, the temperature value corresponding to each pixel point in the video frame can be known, and the video frame is collected once per second to obtain multiple consecutive video frames. The subsequent analysis is for the consecutive video frames collected by a dual-spectrum camera.

[0052] Step S002: Use a segmentation neural network to segment the pig ear root region and the pig face region in the video frame at each moment; according to the changes in the centroid coordinates of the pig ear root region and the centroid coordinates of the pig face region in the video frames at adjacent moments, determine the motion state consistency between each pig ear root region and each pig face region between adjacent moments.

[0053] In the video frame, for pigs with overlapping ears, since there is a consistency in the displacement of the ears and the body of the pig, and in the video frame, the ears of the pig in the more forward position should be more visible visually. Therefore, the pig to which the pig ear belongs can be determined by obtaining the movement direction of the pig in the video frame and the positional relationship of the pigs.

[0054] Preferably, in an embodiment of the present invention, the method for obtaining the motion state consistency between each pig ear root region and each pig face region between adjacent moments includes:

[0055] In the embodiment of the present invention, a segmentation neural network is used to identify and segment the pig ear root region and the pig face region in the video frame, where the pig face region does not include the ears.

[0056] The relevant content of the segmentation neural network is as follows:

[0057] The segmentation neural network used in this embodiment is the Mask R-CNN neural network; the dataset used is the video frame dataset. Among them, Mask R-CNN is a well-known technology, and the specific method will not be introduced here. The Chinese full name of Mask R-CNN is "Mask Region-based Convolutional Neural Network", and the English full name is "Mask Region-based Convolutional Neural Network".

[0058] The pixel points to be segmented are divided into 2 categories. That is, the label annotation process for the training set corresponding label is: for the single-channel semantic label, the pixel points at the corresponding positions labeled as 0 belong to the pig ear root region, and those labeled as 1 belong to the pig face region.

[0059] The task of the network is classification, so the loss function used is the cross-entropy loss function.

[0060] The pig ear root area and the pig face area in the video frame are obtained by splitting the neural network. This process is a well-known technology, and the specific method will not be introduced here.

[0061] At the th moment of the video frame, the th pig ear root area and the th pig face area are respectively used as the reference pig ear root area and the reference pig face area. During the time period from the th moment to the th moment, the target tracking algorithm is used to obtain the reference pig ear root area and the reference pig face area in the video frame at each moment during this time period.

[0062] It should be noted that: among them, , and are positive integers and can take any values. The preset time threshold in this embodiment is taken as an example for description. The target tracking algorithm is a well-known technology, and the specific method will not be introduced here. If there is no reference pig ear root area in the video frame at a certain moment during the time period from the th moment to the th moment, that is, the reference pig ear root area moves out of the video monitoring range over time, then the th pig ear root area in the video frame at the th moment will not be analyzed. According to the continuity of the video frame, the th pig ear root area in the video frame at the th moment will be analyzed in a certain video frame before the th moment, so it will not cause a situation where a certain pig ear root area is not analyzed below.

[0063] It should be further noted that: the movement of the ear root and the face of the same pig is consistent. If there is no reference pig face area in the video frame at a certain moment during the time period from the th moment to the th moment, it means that the reference pig face area and the pig ear root area do not belong to the same pig. Therefore, in this embodiment, only the reference pig face area that exists in the video frame at each moment during the time period from the th moment to the th moment is used for the matching analysis of the reference pig ear root area.

[0064] During the movement of the pig in and out of the breeding farm, the movement trends of the pig ear and the pig face are consistent. Therefore, the stronger the consistency of the movement trends of the pig ear and the pig face, the greater the possibility that the detected pig ear root area belongs to the pig.

[0065] In each video frame at a given moment, a rectangular coordinate system is constructed with the vertex at the lower left corner of the video frame as the origin, the horizontal direction to the right as the x-axis, and the vertical direction upwards as the y-axis.

[0066] On the rectangular coordinate system of each video frame at a given moment, the centroid coordinates of each pig ear root region and each pig face region in the video frame at each moment are obtained.

[0067] Among them, the changes in the centroid coordinates of the pig ear root region and the pig face region over time are the displacement routes of the pig ear root and the pig face.

[0068] For the reference pig ear root region and the reference pig face region, the more consistent the displacement amounts in the video frames at adjacent moments, the stronger the consistency of the displacement amounts between the pig ear root and the pig face. And the stronger the consistency of the displacement amounts, the stronger the corresponding relationship between the pig ear root and the pig face.

[0069] Calculate the Euclidean distance between the centroid coordinates of the reference pig ear root region in the video frames at the moment and the moment as the first distance, calculate the Euclidean distance between the centroid coordinates of the reference pig face region in the video frames at the moment and the moment as the second distance, and take the inverse proportional normalization value of the absolute value of the difference between the first distance and the second distance as the displacement amount consistency between the reference pig ear root region and the reference pig face region at the

[0070] It should be noted that: Denote the absolute value of the difference between the first distance and the second distance as , then use as the inverse proportional normalization value of , where is the exponential function with the natural constant as the base. In this embodiment, is used to present 's inverse proportional relationship and normalization process. Implementers can set the inverse proportional function and normalization function according to the actual situation. When is smaller, it indicates that the displacement amounts between the reference pig ear root region and the reference pig face region at the moment and the moment are more consistent.

[0071] For the reference pig ear root region and the reference pig face region, the more consistent the displacement directions in the video frames at adjacent moments, the stronger the consistency of the displacement directions between the pig ear root and the pig face. And the stronger the consistency of the displacement directions, the stronger the corresponding relationship between the pig ear root and the pig face.

[0072] On the rectangular coordinate system, obtain the The straight line passing through the centroid coordinates of the reference pig ear root region in the video frame at the moment and the moment is used as the first straight line. Obtain the straight line passing through the centroid coordinates of the reference pig face region in the video frame at the moment and the moment as the second straight line. Take the normalized value of the minimum included angle between the first straight line and the second straight line as the displacement direction consistency between the reference pig ear root region and the reference pig face region at the moment and the

[0073] It should be noted that: the normalized value of the minimum included angle value uses the linear normalization function to normalize the minimum included angle value to between 0 and 1.

[0074] Take the product of the displacement amount consistency and the displacement direction consistency between the reference pig ear root region and the reference pig face region at the moment and the moment as the motion state consistency between the reference pig ear root region and the reference pig face region at the moment and the moment.

[0075] Among them, the greater the motion state consistency, the more likely the th pig ear root region in the video frame at the moment belongs to the th pig face region.

[0076] Step S003: Determine the positional relationship consistency between each pig ear root region and each pig face region in the video frame at each moment according to the distribution positions of the pig ear root regions and the pig face regions in the video frames at consecutive moments.

[0077] For a pig ear root and its corresponding pig face, there is a certain positional relationship. At the same time, not all pig faces or ear roots can be completely recognized in the video frame at each moment. Therefore, in practice, it is necessary to match the recognized face with the corresponding ear root part to realize the automatic detection of the pig's body temperature.

[0078] Preferably, in an embodiment of the present invention, the method for obtaining the positional relationship consistency between each pig ear root region and each pig face region in the video frame at each moment includes:

[0079] Use the morphological thinning algorithm to obtain the skeleton line of the reference pig face region in the video frame at the moment, and then use the Hough line detection algorithm to perform line detection on the skeleton line to obtain the line segment corresponding to the skeleton line as the first line segment. The endpoints of the line segment are located on the boundary of the reference pig face region.

[0080] In the video frame at the moment, obtain the line segment from the center point of the first straight line segment to the centroid of the reference pig ear root area as the second straight line segment, and denote the minimum angle between the first straight line segment and the second straight line segment as the target angle in the video frame at the moment.

[0081] It should be noted that: The morphological thinning algorithm and the Hough line detection algorithm are both well-known technologies, and the specific methods will not be introduced here. Since the structure of the pig's head is bilaterally symmetric, this means that from the front end to the back end of the head, draw a line through the midpoint between the eyes, and this line will evenly divide the head into two mirror-symmetrical left and right parts. Therefore, when thinning the pig's head to extract the skeleton line, this line often runs along the center of the head, forming a symmetry line. A schematic diagram of the angle between the pig's facial center line and the line connecting the center of the pig's face to the center of the pig's ear root is shown in Figure 3 as shown, Figure 3 the vertical line in represents the first straight line segment, and the upper right line represents the second straight line segment, representing the target angle.

[0082] According to the above method, obtain the target angle in the video frame at each moment during the period from the moment to the moment.

[0083] It should be noted that: During the process of each pig moving towards the exit direction, most of the time it will keep its face forward, that is, the target angles in most video frames are reliable. When the reference pig face area in a certain video frame during the period from the moment to the moment is not facing forward, this video frame will not be considered in subsequent analysis. In this embodiment, a deep neural network is used to identify whether the reference pig face area in the video frame is facing forward. Among them, the deep neural network used is the DeepLabV3 neural network, and the dataset used is the pig face area dataset in the video frame. The labeling process for the training set corresponding labels is: The pig face area facing forward is labeled as 0, and the pig face area not facing forward is labeled as 1. Since the task of the network is classification, the loss function used is the cross-entropy loss function.

[0084] Since the angle between the pig's facial center line and the line connecting the center of the pig's face to the center of the pig's ear root is relatively fixed, the more stable the angle between the pig's facial center line and the line connecting the center of the pig's face to the center of the pig's ear root in consecutive video frames, the greater the possibility that the detected pig ear root area belongs to this pig.

[0085] During the period from the moment to the Among the target angles in the video frames at all times within the time period of a moment, calculate the inverse proportional normalization value of the difference between the maximum target angle and the minimum target angle as the first difference, calculate the inverse proportional normalization value of the variance of all target angles as the second difference, and take the product of the first difference and the second difference as the Consistency of the positional relationship between the reference pig ear root region and the reference pig face region in the video frame at the moment.

[0086] It should be noted that: Denote the difference between the maximum target angle and the minimum target angle as and denote the variance of all target angles as Then use and as the inverse proportional normalization values of and respectively. Among them, The smaller it is, and The smaller it is, it indicates that the change in the target angle in the connected video frame is smaller, the positional relationship between the reference pig ear root region and the reference pig face region is more consistent, and then the The th pig ear root region in the video frame at the moment is more likely to belong to the th pig face region.

[0087] Step S004: Determine the final consistency between each pig ear root region and each pig face region in the video frame at each moment according to the positional relationship consistency between each pig ear root region and each pig face region in the video frame at each moment and the motion state consistency between each pig ear root region and each pig face region between adjacent moments.

[0088] Preferably, in an embodiment of the present invention, the method for obtaining the final consistency between each pig ear root region and each pig face region in the video frame at each moment includes:

[0089] In the time period from the th moment to the th moment, calculate the mean value of the motion state consistency between the reference pig ear root region and the reference pig face region at all adjacent moments, and calculate the product of this mean value and the positional relationship consistency between the reference pig ear root region and the reference pig face region in the video frame at the th moment as the final consistency between the reference pig ear root region and the reference pig face region in the video frame at the th moment.

[0090] Among them, the greater the final consistency, the The th pig ear root region in the video frame at the moment is more likely to belong to the th pig face region.

[0091] Step S005: Determine the temperature value corresponding to each pig face region in the video frame at each moment according to the final consistency between each pig ear root region and each pig face region in the video frame at each moment and the temperature value corresponding to each pixel point in the video frame.

[0092] Preferably, in an embodiment of the present invention, the method for obtaining the temperature value corresponding to each pig face region in the video frame at each moment includes:

[0093] In the above manner, in the video frame at the th moment, obtain the final consistency between the th pig ear root region and each pig face region, and use the pig face region corresponding to the maximum value among the final consistencies between the th pig ear root region and all pig face regions as the pig face region to which the th pig ear root region belongs.

[0094] It should be noted that: when there are multiple maximum values among the final consistencies between the th pig ear root region and all pig face regions, it indicates that the pig ears overlap severely at the th moment in the video frame at the th pig ear root region, and the th pig ear root region does not match. The matching result of the th pig ear root region in the video frame before or after the th moment can be used for body temperature detection. Since a pig has two ears, the matching result of the other ear can be used to complete the body temperature detection.

[0095] In the video frame at the th moment, take the average value of the temperature values corresponding to the pixel points at the centroids of all pig ear root regions belonging to each pig face region as the temperature value corresponding to each pig face region.

[0096] In the above manner, the temperature value corresponding to each pig face region in the video frame at each moment can be obtained, that is, the body temperature of each pig in the video frame at each moment is obtained, thereby completing the detection of the pig body temperature.

[0097] So far, the present invention is completed.

[0098] In summary, in the embodiments of the present invention, video frames at each moment when pigs enter and leave the breeding farm are obtained. According to the changes in the centroid coordinates of the pig ear root regions and the centroid coordinates of the pig face regions in adjacent video frames, the consistency of the movement states between each pig ear root region and each pig face region is determined. According to the distribution positions of the pig ear root regions and the pig face regions in the video frames at consecutive moments, the consistency of the positional relationships between each pig ear root region and each pig face region in the video frames at each moment is determined, so as to determine the final consistency between each pig ear root region and each pig face region in the video frames at each moment. Then, in combination with the temperature value corresponding to each pixel point in the video frame, the temperature value corresponding to each pig face region in the video frames at each moment is determined. By analyzing the movement characteristics of pigs and the positional relationship between the pig face and the ear root, the present invention improves the accuracy of determining the pig to which a pig ear belongs, thereby improving the accuracy of intelligent temperature detection of livestock animals.

[0099] The foregoing are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. An intelligent method for detecting animal body temperature for animal husbandry and veterinary medicine, characterized in that: The method comprises the following steps: Obtain video frames at every moment when the pigs enter and leave the farm; each pixel in the video frame corresponds to a temperature value; Use a segmentation neural network to segment the pig ear root area and the pig face area in the video frame at each moment; According to the changes of the centroid coordinates of the pig ear root area and the centroid coordinates of the pig face area in the video frames at adjacent moments, determining the consistency of the motion state of each pig ear root area and each pig face area at adjacent moments includes: The first video frame at time The pig ear root area and pig facial regions, respectively, as the reference pig ear root region and the reference pig facial region; in the Time to During a time period of time, a target tracking algorithm is used to obtain a reference pig ear root area and a reference pig face area in a video frame at each time in the time period; wherein, is a preset time threshold; in the video frame at each moment, a rectangular coordinate system is constructed with the vertex at the lower left corner of the video frame as the origin, the horizontal rightward as the horizontal axis, and the vertical upward as the vertical axis; on the rectangular coordinate system of the video frame at each moment, the centroid coordinates of each pig ear root area and the centroid coordinates of each pig facial area in the video frame at each moment are obtained; according to the distance between the centroid coordinates of the reference pig ear root area in the video frames at adjacent moments and the distance between the centroid coordinates of the reference pig facial area, the displacement consistency of the reference pig ear root area and the reference pig facial area between adjacent moments is determined; according to the straight line passing through the centroid coordinates of the reference pig ear root area in the video frames at adjacent moments and the straight line passing through the centroid coordinates of the reference pig facial area on the rectangular coordinate system, the displacement direction consistency of the reference pig ear root area and the reference pig facial area between adjacent moments is determined; according to the displacement consistency and displacement direction consistency of the reference pig ear root area and the reference pig facial area between adjacent moments, the motion state consistency of the reference pig ear root area and the reference pig facial area between adjacent moments is determined; According to the distribution positions of the pig ear root regions and the pig facial regions in the video frames at consecutive moments, determining the consistency of the positional relationship between each pig ear root region and each pig facial region in the video frames at each moment; According to the consistency of the positional relationship between each pig ear root region and each pig facial region in the video frame at each moment and the consistency of the motion state between each pig ear root region and each pig facial region at adjacent moments, the final consistency between each pig ear root region and each pig facial region in the video frame at each moment is determined; According to the final consistency between each pig ear root area and each pig facial area in the video frame at each moment and the temperature value corresponding to each pixel point in the video frame, the temperature value corresponding to each pig facial area in the video frame at each moment is determined.

2. The method for intelligently detecting animal body temperature for animal husbandry and veterinary medicine according to claim 1, characterized in that: The specific steps of determining the consistency of the displacement between the reference pig ear root region and the reference pig face region at adjacent moments are as follows: Calculate the Moment and The Euclidean distance between the centroid coordinates of the reference pig ear root area in the video frame at time t is taken as the first distance, and the second distance is calculated. Moment and The Euclidean distance between the centroid coordinates of the reference pig face region in the video frame at time t is used as the second distance, and the inverse proportional normalized value of the absolute value of the difference between the first distance and the second distance is used as the distance between the reference pig ear root region and the reference pig face region at time t Moment and The consistency of displacement between moments.

3. The method for intelligently detecting animal body temperature for animal husbandry and veterinary medicine according to claim 1, characterized in that: The specific steps of determining the consistency of the displacement directions of the reference pig ear root region and the reference pig face region at adjacent moments are as follows: In the rectangular coordinate system, obtain the Moment and The straight line of the reference pig ear root area mass center coordinates in the video frame at time t is taken as the first straight line, and the straight line passing through the Moment and The straight line of the center of mass coordinates of the reference pig face region in the video frame at time t is used as the second straight line, and the normalized value of the minimum angle between the first straight line and the second straight line is used as the angle between the reference pig ear root region and the reference pig face region at time t Moment and The consistency of displacement direction between moments.

4. The intelligent animal body temperature detection method for animal husbandry and veterinary medicine according to claim 1, characterized in that: The determination of the consistency of the motion states of the reference pig ear root region and the reference pig face region at adjacent moments includes the following specific steps: The reference pig ear root area and the reference pig face area were Moment and The product of the consistency of displacement amount and the consistency of displacement direction between the reference pig ear root area and the reference pig face area at the first Moment and The consistency of motion state between moments.

5. The intelligent animal body temperature detection method for animal husbandry and veterinary medicine according to claim 1, characterized in that: The specific steps of determining the consistency of the positional relationship between each pig ear root region and each pig facial region in the video frame at each moment are as follows: Use the morphological thinning algorithm to obtain the Referring to the skeleton line of the pig's facial area in the video frame at the time, performing straight line detection on the skeleton line using the Hough straight line detection algorithm, and obtaining a straight line segment corresponding to the skeleton line as the first straight line segment; According to The first straight line segment in the video frame at the time and the centroid of the reference pig ear root area are determined The target angle in the video frame at time ; According to the target angles in the video frames at consecutive moments, the consistency of the positional relationship between the reference pig ear root region and the reference pig face region in the video frames at each moment is determined.

6. The intelligent animal body temperature detection method for animal husbandry and veterinary medicine according to claim 5, characterized in that: The determination The target angle in the video frame at the moment includes the following specific steps: In the In the video frame at time , the straight line segment from the center point of the first straight line segment to the centroid of the reference pig ear root area is obtained as the second straight line segment, and the minimum angle between the first straight line segment and the second straight line segment is recorded as The target angle in the video frame at time.

7. The intelligent animal body temperature detection method for animal husbandry and veterinary medicine according to claim 5, characterized in that: The specific steps of determining the consistency of the positional relationship between the reference pig ear root region and the reference pig face region in the video frame at each moment are as follows: In the Time to The inverse normalized value of the difference between the maximum target angle and the minimum target angle is calculated as the first difference, the inverse normalized value of the variance of all target angles is calculated as the second difference, and the product of the first difference and the second difference is calculated as the second difference. The consistency of the positional relationship between the reference pig ear base area and the reference pig face area in the video frame at the moment.

8. The intelligent animal body temperature detection method for animal husbandry and veterinary medicine according to claim 1, characterized in that: The specific steps of determining the final consistency between each pig ear root region and each pig face region in the video frame at each moment are as follows: In the Time to In the period of time, the mean of the consistency of the motion state between the reference pig ear root area and the reference pig face area at all adjacent moments is calculated, and the mean and the consistency of the motion state between the reference pig ear root area and the reference pig face area are calculated. The product of the consistency of the positional relationship between the reference pig ear root area and the reference pig face area in the video frame at time t is taken as the The final consistency between the reference pig ear root area and the reference pig face area in the video frame at the moment.

9. The intelligent animal body temperature detection method for animal husbandry and veterinary medicine according to claim 1, characterized in that: The specific steps of determining the temperature value corresponding to each pig facial area in the video frame at each moment are as follows: In the In the video frame at time The pig face region corresponding to the maximum value of the final consistency between the pig ear root region and all pig face regions is taken as the first The pig facial area to which the pig ear root area belongs is the average of the temperature values ​​corresponding to the pixel points at the centroid of all the pig ear root areas to which each pig facial area belongs, as the temperature value corresponding to each pig facial area.

Citation Information

Patent Citations

  • Livestock body temperature monitoring method and device, electronic equipment and storage medium

    CN114885853A

  • Cow abnormal behavior detection method based on remote monitoring

    CN117831136A