CN114155216A - Pig temperature detection method and device - Google Patents
Pig temperature detection method and device Download PDFInfo
- Publication number
- CN114155216A CN114155216A CN202111421089.5A CN202111421089A CN114155216A CN 114155216 A CN114155216 A CN 114155216A CN 202111421089 A CN202111421089 A CN 202111421089A CN 114155216 A CN114155216 A CN 114155216A
- Authority
- CN
- China
- Prior art keywords
- temperature
- pig
- target
- value
- head
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 36
- 239000011159 matrix material Substances 0.000 claims abstract description 34
- 241000282887 Suidae Species 0.000 claims abstract description 27
- 230000036541 health Effects 0.000 claims abstract description 12
- 238000000034 method Methods 0.000 claims description 37
- 238000012549 training Methods 0.000 claims description 31
- 238000012360 testing method Methods 0.000 claims description 23
- 238000003860 storage Methods 0.000 claims description 16
- 230000036760 body temperature Effects 0.000 claims description 15
- 230000001419 dependent effect Effects 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 7
- 230000005856 abnormality Effects 0.000 claims description 4
- 210000000664 rectum Anatomy 0.000 claims description 4
- 230000007423 decrease Effects 0.000 claims description 3
- 230000002159 abnormal effect Effects 0.000 abstract description 5
- 238000012545 processing Methods 0.000 abstract description 4
- 241000282898 Sus scrofa Species 0.000 description 134
- 201000010099 disease Diseases 0.000 description 13
- 208000037265 diseases, disorders, signs and symptoms Diseases 0.000 description 13
- 238000009395 breeding Methods 0.000 description 11
- 230000001488 breeding effect Effects 0.000 description 11
- 230000008569 process Effects 0.000 description 10
- 238000005259 measurement Methods 0.000 description 6
- 241001465754 Metazoa Species 0.000 description 5
- 230000006870 function Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- QSHDDOUJBYECFT-UHFFFAOYSA-N mercury Chemical compound [Hg] QSHDDOUJBYECFT-UHFFFAOYSA-N 0.000 description 3
- 229910052753 mercury Inorganic materials 0.000 description 3
- 238000001931 thermography Methods 0.000 description 3
- XEEYBQQBJWHFJM-UHFFFAOYSA-N Iron Chemical compound [Fe] XEEYBQQBJWHFJM-UHFFFAOYSA-N 0.000 description 2
- 230000004913 activation Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 2
- 238000009529 body temperature measurement Methods 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000013527 convolutional neural network Methods 0.000 description 2
- 238000003745 diagnosis Methods 0.000 description 2
- 230000003203 everyday effect Effects 0.000 description 2
- 238000000691 measurement method Methods 0.000 description 2
- 238000011160 research Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 210000000436 anus Anatomy 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 230000007613 environmental effect Effects 0.000 description 1
- 230000003862 health status Effects 0.000 description 1
- 229910052742 iron Inorganic materials 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 230000002265 prevention Effects 0.000 description 1
- 238000011897 real-time detection Methods 0.000 description 1
- 230000007480 spreading Effects 0.000 description 1
- 238000003892 spreading Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000004861 thermometry Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/0002—Inspection of images, e.g. flaw detection
- G06T7/0012—Biomedical image inspection
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01J—MEASUREMENT OF INTENSITY, VELOCITY, SPECTRAL CONTENT, POLARISATION, PHASE OR PULSE CHARACTERISTICS OF INFRARED, VISIBLE OR ULTRAVIOLET LIGHT; COLORIMETRY; RADIATION PYROMETRY
- G01J5/00—Radiation pyrometry, e.g. infrared or optical thermometry
- G01J5/0022—Radiation pyrometry, e.g. infrared or optical thermometry for sensing the radiation of moving bodies
- G01J5/0025—Living bodies
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20081—Training; Learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20092—Interactive image processing based on input by user
- G06T2207/20104—Interactive definition of region of interest [ROI]
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Molecular Biology (AREA)
- Biomedical Technology (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Life Sciences & Earth Sciences (AREA)
- Medical Informatics (AREA)
- Nuclear Medicine, Radiotherapy & Molecular Imaging (AREA)
- Radiology & Medical Imaging (AREA)
- Quality & Reliability (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Spectroscopy & Molecular Physics (AREA)
- Radiation Pyrometers (AREA)
Abstract
The invention provides a pig temperature detection method and a pig temperature detection device, wherein infrared images of a target pig and a temperature matrix file of the infrared images are acquired; inputting the infrared image of the target pig into a pre-trained target recognition model, and outputting the coordinate value of the designated position of the target pig; determining a head maximum temperature value based on the coordinate values and the temperature matrix file; inputting the maximum head temperature value and the indoor temperature value into a regression model for fitting, and drawing a temperature curve according to the fitted temperature value; and judging the health condition of the target pig based on the temperature curve. According to the invention, the infrared images and the temperature matrix files of the pigs are collected, and then the background automatic processing can be carried out to judge whether the temperature of the pigs is abnormal or not, so that the automatic detection of the temperature of the pigs is realized, and a plurality of workers are not required to detect the rectal temperature in a time-consuming and labor-consuming manner, therefore, the required cost is lower, the efficiency is higher, and the detection accuracy is higher.
Description
Technical Field
The application relates to the technical field of computers, in particular to a pig temperature detection method, a pig temperature detection device, computer equipment and a storage medium.
Background
With the progress of Chinese urbanization construction and the requirement of environmental protection, the live pig breeding mode starts to accelerate the evolution from individual decentralized breeding to large-scale breeding, and the live pig breeding industry starts to enter a new trend. The development of the agricultural Internet of things enables the body temperature information of the pigs to be acquired in real time. In a high-density breeding environment with multiple diseases and frequent epidemics, the real-time monitoring of the body temperature of the pigs is beneficial to mastering the health conditions of the pigs at any time, which is very important for preventing and diagnosing the pig diseases. At present, the pig breeding industry in China develops rapidly, and the large-scale and integrated breeding mode brings convenience to pig breeding and increases the difficulty of preventing and controlling pig diseases. The disease generation of pigs is not easy to find in large-scale cultivation, and the transmission probability of the disease is improved due to the characteristic of high density. The body temperature information is helpful for diagnosis and treatment of pig diseases, early detection of diseased animals, understanding of disease degree, determination of disease severity and the like.
In the actual pig raising process, the body temperature of pigs is generally represented by rectal temperature, the body temperature range of healthy pigs is 38-40 ℃, and a plurality of differences exist among different types of pigs. The traditional pig body temperature measuring method is divided into a manual measuring method, an implanted temperature measuring device method, an ear tag temperature measuring device method and the like. The manual measurement method is mainly used in a pig farm, namely, workers lubricate and disinfect a mercury column thermometer, one end of the thermometer is fixed by a wire with the length of about 15 centimeters, and the other end of the thermometer is fixed with a wire clamp. When measuring, the staff inserts the mercury column into the pig anus and clamps the hair above the pigtail with an iron clip for fixation. After 5 minutes the thermometer was removed, the mercury column wiped and the data read.
However, the contact-type manual measurement has several problems to be solved:
(1) the measurement method can cause strong stress to pigs, and the rectal temperature is rapidly increased, so that the measurement data is inaccurate.
(2) The method consumes a large amount of labor force in large-scale live pig breeding production.
(3) During contact measurement, there is a risk of transmission and contact of diseases between humans and animals, and between animals and animals.
Therefore, a temperature detection method capable of being measured remotely is urgently needed in the pig raising industry at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for detecting the temperature of a pig, computer equipment and a storage medium, which are used for solving the problems that the existing contact type artificial temperature measurement of the temperature of the pig has inaccurate measurement data, consumes a large amount of artificial labor force and risks of spreading and contacting diseases between people and animals.
In order to achieve the above object, in a first aspect of embodiments of the present invention, a method for detecting a temperature of a pig is provided, including:
acquiring an infrared image of a target pig and a temperature matrix file of the infrared image;
inputting the infrared image of the target pig into a pre-trained target recognition model, and outputting the coordinate value of the designated position of the target pig;
determining a head maximum temperature value based on the coordinate values and the temperature matrix file;
inputting the maximum head temperature value and the indoor temperature value into a regression model for fitting, and drawing a temperature curve according to the fitted temperature value;
and judging the health condition of the target pig based on the temperature curve.
Optionally, in a possible implementation manner of the first aspect, the inputting the infrared-only image of the target pig into a pre-trained target recognition model, and outputting coordinate values of a designated position of the target pig includes:
pre-collecting a plurality of infrared images of the pig by using a thermal infrared imager as a training sample;
marking the head designated position of each image in the training sample by using a marking tool to form a training set and a testing set;
and taking the images in the training set as sample input data, taking the corresponding prediction box result as sample output data, and carrying out training based on the CSPdark 53 network to obtain a preliminary pig designated part identification model.
Optionally, in a possible implementation manner of the first aspect, after obtaining the preliminary pig specific-only site recognition model, the method includes:
testing the preliminary pig designated part recognition model by using the images in the test set and the corresponding prediction frame results;
adjusting the preliminary pig designated part recognition model according to a test result, and obtaining an optimal pig designated part recognition model until the confidence of a predicted target is greater than a preset threshold;
inputting the preprocessed target pig infrared image into the optimal pig designated part recognition model, and carrying out target detection according to the optimal pig designated part recognition model to obtain a target pig head prediction frame and coordinate values of the head prediction frame.
Optionally, in a possible implementation manner of the first aspect, the determining a head maximum temperature value based on the coordinate value and the temperature matrix file includes:
the temperature matrix file comprises a temperature value of each pixel point in the infrared image;
and reading the temperature matrix file by using a temperature acquisition program, reading temperature values of all pixel points in the coordinate value range of the head prediction frame, and selecting the maximum value of all the temperature values as the maximum head temperature value.
Optionally, in a possible implementation manner of the first aspect, the inputting the head maximum temperature value and the room temperature value into a regression model for fitting includes:
taking the maximum temperature of the head and the indoor temperature as independent variables of a regression model, taking the rectal temperature of a target pig as a dependent variable, and fitting the dependent variable through the two independent variables;
and reducing the error between the fitted temperature value and the rectum temperature by adjusting the polynomial maximum degree of the regression model for multiple times.
Optionally, in a possible implementation manner of the first aspect, the determining the health condition of the target pig based on the temperature curve includes:
taking the fitted temperature value as the body temperature of the pig, and drawing a temperature curve graph;
if the temperature value of the target pig continuously increases or decreases for a plurality of consecutive days or the temperature of the target pig exceeds 39 ℃ on a certain day, the target pig is judged to have only possible abnormality.
In a second aspect of the embodiments of the present invention, there is provided a pig temperature detection device, including:
the acquisition module is used for acquiring an infrared image of a target pig and a temperature matrix file of the infrared image;
the coordinate value output module is used for inputting the infrared image of the target pig to a pre-trained target recognition model and outputting the coordinate value of the designated position of the target pig;
the maximum temperature value determining module is used for determining the maximum temperature value of the head part based on the coordinate value and the temperature matrix file;
the temperature value fitting module is used for inputting the maximum head temperature value and the indoor temperature value into a regression model for fitting and drawing a temperature curve according to the fitted temperature value;
and the judging module is used for judging the health condition of the target pig based on the temperature curve.
Optionally, in a possible implementation manner of the second aspect, the coordinate value output module includes:
the acquisition unit is used for acquiring a plurality of infrared images of the pig in advance through the thermal infrared imager to serve as training samples;
the marking unit is used for marking the head designated position of each image in the training sample by using a marking tool to form a training set and a testing set;
and the first acquisition unit is used for taking the images in the training set as sample input data, taking the corresponding prediction box result as sample output data, carrying out training based on the CSPdarknet53 network, and acquiring a preliminary pig designated part identification model.
Optionally, in a possible implementation manner of the second aspect, the coordinate value output module further includes:
the test unit is used for testing the identification model of the only designated part of the preliminary pig by using the images in the test set and the corresponding prediction frame results;
the second obtaining unit is used for adjusting the preliminary pig designated part identification model according to the test result, and obtaining an optimal pig designated part identification model until the confidence coefficient of the prediction target is greater than a preset threshold value;
and the coordinate value acquisition unit is used for inputting the preprocessed target pig infrared image into the optimal pig designated part recognition model, carrying out target detection according to the optimal pig designated part recognition model, and acquiring a target pig head prediction frame and coordinate values of the head prediction frame.
Optionally, in a possible implementation manner of the second aspect, the maximum temperature value determining module includes:
and the reading unit is used for reading the temperature matrix file by using a temperature acquisition program, reading the temperature values of all pixel points in the coordinate value range of the head prediction frame, selecting the maximum value of all the temperature values as the maximum head temperature value, and the temperature matrix file contains the temperature value of each pixel point in the infrared image.
Optionally, in a possible implementation manner of the second aspect, the temperature value fitting module is further configured to perform the following steps:
taking the maximum temperature of the head and the indoor temperature as independent variables of a regression model, taking the rectal temperature of a target pig as a dependent variable, and fitting the dependent variable through the two independent variables;
and reducing the error between the fitted temperature value and the rectum temperature by adjusting the polynomial maximum degree of the regression model for multiple times.
Optionally, in a possible implementation manner of the second aspect, the determining module includes:
the drawing unit is used for taking the fitted temperature value as the body temperature of the pig and drawing a temperature curve graph;
and the abnormality determining unit is used for determining that the target pig only has the possibility of abnormality if the temperature value of the target pig continuously increases or decreases for a plurality of consecutive days or the temperature of the target pig exceeds 39 ℃ on a certain day.
In a third aspect of the embodiments of the present invention, a computer device is provided, which includes a memory and a processor, where the memory stores a computer program that is executable on the processor, and the processor implements the steps in the above method embodiments when executing the computer program.
A fourth aspect of the embodiments of the present invention provides a readable storage medium, in which a computer program is stored, which, when being executed by a processor, is adapted to carry out the steps of the method according to the first aspect of the present invention and various possible designs of the first aspect of the present invention.
According to the pig temperature detection method, the pig temperature detection device, the computer equipment and the storage medium, the infrared image of the target pig and the temperature matrix file of the infrared image are obtained; inputting the infrared image of the target pig into a pre-trained target recognition model, and outputting the coordinate value of the designated position of the target pig; determining a head maximum temperature value based on the coordinate values and the temperature matrix file; inputting the maximum head temperature value and the indoor temperature value into a regression model for fitting, and drawing a temperature curve according to the fitted temperature value; and judging the health condition of the target pig based on the temperature curve. According to the invention, the infrared images and the temperature matrix files of the pigs are collected, and then the background automatic processing can be carried out to judge whether the temperature of the pigs is abnormal or not, so that the automatic detection of the temperature of the pigs is realized, and a plurality of workers are not required to detect the rectal temperature in a time-consuming and labor-consuming manner, therefore, the required cost is lower, the efficiency is higher, and the detection accuracy is higher.
Drawings
FIG. 1 is a flow chart of a first embodiment of a method for detecting temperature in swine;
fig. 2 is a block diagram of a first embodiment of a pig temperature detection device.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein.
It should be understood that, in various embodiments of the present invention, the sequence numbers of the processes do not mean the execution sequence, and the execution sequence of the processes should be determined by the functions and the internal logic of the processes, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
It should be understood that in the present application, "comprising" and "having" and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that, in the present invention, "a plurality" means two or more. "and/or" is merely an association describing an associated object, meaning that three relationships may exist, for example, and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. "comprises A, B and C" and "comprises A, B, C" means that all three of A, B, C comprise, "comprises A, B or C" means that one of A, B, C comprises, "comprises A, B and/or C" means that any 1 or any 2 or 3 of A, B, C comprises.
It should be understood that in the present invention, "B corresponding to a", "a corresponds to B", or "B corresponds to a" means that B is associated with a, and B can be determined from a. Determining B from a does not mean determining B from a alone, but may be determined from a and/or other information. And the matching of A and B means that the similarity of A and B is greater than or equal to a preset threshold value.
As used herein, "if" may be interpreted as "at … …" or "when … …" or "in response to a determination" or "in response to a detection", depending on the context.
The technical solution of the present invention will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
The invention provides a pig temperature detection method, which is shown in a flow chart of figure 1 and comprises the following steps:
and S110, acquiring an infrared image of the target pig and a temperature matrix file of the infrared image. In the step, the infrared images of the pigs are acquired through an infrared mobile acquisition device, and the infrared mobile acquisition device is made of a thermal infrared imager, a support and a mobile trolley. Before collecting the infrared image of the target pig, a worker needs to firstly place a bracket of the collecting device in front of a pigsty limiting fence and adjust the height of the bracket and the angle of a camera of a thermal infrared imager so as to ensure that the ear root part of the pig can be shot (relevant researches show that the maximum temperature of the ear root part area of the live pig infrared image keeps better correlation with the rectal temperature of the live pig, and the highest temperature of the root part of the pig is the highest temperature of the head part of the pig); and then, running an acquisition program on an infrared thermal imaging QT series temperature measurement system to acquire an infrared image and a temperature matrix file of the pig. Different acquisition frequencies can be set at different stages of live pig breeding to ensure real-time detection of the body temperature of the live pigs, which is beneficial to mastering the health conditions of the pigs at any time and has very important significance for prevention and diagnosis of diseases of the live pigs. For example: in the period of high incidence of diseases, the body temperature of the live pigs needs to be detected for many times every day, and when the breeding scale of the live pigs is small, the body temperature of the live pigs can be detected once every day.
And S120, inputting the infrared image of the target pig into a pre-trained target recognition model, and outputting the coordinate value of the designated position of the target pig.
In step S120, after the infrared image of the target pig is obtained in step S110, the infrared image is input to the yoolov 4 model for head recognition, so as to obtain four coordinate values of the head position, i.e., the upper, lower, left and right coordinate values, thereby obtaining the head prediction frame of the target pig. The YoloV4 model adopted by the method is a real-time and high-precision target detection model, can identify the target of the interested part of an input picture, and is based on the original Yolo architecture, and takes CSPDarknet53 as a main network, so that the aim of enhancing the learning capacity of a CNN convolutional neural network can be fulfilled, the accuracy can be kept while the weight is reduced, the calculation bottleneck can be reduced, and the memory cost can be reduced; the use of the Msih activation function makes the gradient descent more effective. The Msih activation function formula is as follows:
and step S130, determining the maximum head temperature value based on the coordinate values and the temperature matrix file.
In the step, the coordinate values of the head prediction frame obtained by the identification of the target detection model and the temperature matrix file of the infrared image of the target pig are input into a temperature acquisition program to acquire the maximum head temperature value. The temperature matrix file is a txt text, the text contains temperature values of all pixel points in the infrared image, the temperature acquisition program can read the txt text, the temperature values of all the pixel points in the coordinate value range of the head prediction frame are intercepted, the maximum value is selected from the temperature values of all the pixel points to serve as the maximum head temperature value, and the maximum head temperature value is stored in a corresponding field of the database.
Step S140, inputting the head maximum temperature value and the indoor temperature value into a regression model for fitting, and drawing a temperature curve according to the fitted temperature value.
In step S140, the head maximum temperature value, the rectal temperature value, and the indoor temperature value stored in the corresponding fields of the database are derived, the head maximum temperature value and the indoor temperature value are used as two independent variables of the polynomial regression model, the rectal temperature is used as a dependent variable, and the dependent variable rectal temperature value is obtained by jointly fitting the two independent variables. In the fitting process, the error between the fitted temperature value and the rectum temperature is controlled to be 0.3 ℃ as much as possible by continuously adjusting the maximum degree of the polynomial, and then the fitted temperature value is stored in the corresponding field of the database.
And S150, judging the health condition of the target pig based on the temperature curve.
In step S150, the health status of each pig is determined by extracting the fitted temperature value of each pig from the corresponding field of the database, comparing the fitted temperature value with the temperature values of the pigs for a period of time, and drawing a temperature curve. The temperature curve is drawn to be divided into a plurality of temperature change comparison curves in a single day and a plurality of temperature change comparison curves in a single day, the plurality of temperature curves in a single day are displayed as the temperature of all pigs in a certain day, namely when the body temperature of a certain live pig exceeds 39 ℃ or a preset temperature value in a certain day, the live pig is judged to be possibly abnormal, and early warning information is sent to a worker; and (3) the multi-day single temperature curve represents the temperature comparison of a certain pig in the last month, namely when the temperature of the same live pig continuously rises or continuously falls for multiple days, the live pig is judged to be possibly abnormal, and early warning information is sent to workers.
In one embodiment, the inputting the infrared image of the target pig into a pre-trained target recognition model and outputting the coordinate value of the designated position of the target pig includes:
pre-collecting a plurality of infrared images of the pig by using a thermal infrared imager as a training sample;
marking the head designated position of each image in the training sample by using a marking tool to form a training set and a testing set;
and taking the images in the training set as sample input data, taking the corresponding prediction box result as sample output data, carrying out training based on a CSPdarknet53 network, and obtaining a preliminary pig designated part identification model, namely a YoloV4 target detection model.
In this step, the thermal infrared imager used includes, but is not limited to, a QT series full-automatic infrared thermography thermometry system, and the marking tool used includes, but is not limited to, a label img, which functions to mark a specified position of the head in the infrared pictures of the training sample and to generate a corresponding xml file for each picture to represent the position of the target prediction box.
In one embodiment, after obtaining the preliminary pig designated-only site recognition model, the method comprises the following steps:
testing the preliminary pig designated part recognition model by using the images in the test set and the corresponding prediction frame results;
adjusting the preliminary pig designated part recognition model according to a test result, and obtaining an optimal pig designated part recognition model until the confidence of a predicted target is greater than a preset threshold; wherein the predicted target refers to the head designated position of the pig.
Inputting the preprocessed target pig infrared image into the optimal pig designated part recognition model, and carrying out target detection according to the optimal pig designated part recognition model to obtain a target pig head prediction frame and coordinate values of the head prediction frame.
In the step, the preprocessing operation is to adjust the size of the picture, and the size of the picture needs to meet the input requirement of an identification model of the appointed part of the optimal pig; after passing the target detection, a target prediction frame is formed according to four coordinate values of the head designated position, namely, the upper coordinate value, the lower coordinate value, the left coordinate value and the right coordinate value, so that the maximum temperature value can be selected from temperature values of all pixel points in the coordinate value range of the head prediction frame.
The invention provides a pig temperature detection method based on infrared picture data identification. Under normal conditions, the body temperature of the pig suddenly rises to be above 40 ℃, and the pig is judged to be early warning of certain diseases. Relevant researches show that the maximum temperature of the ear root area of the live pig infrared image keeps better correlation with the rectal temperature of the live pig, and the highest temperature of the root of the pig is the highest temperature of the head of the pig. According to the invention, the infrared image and the temperature matrix of the pig are rapidly acquired by using an infrared thermal imaging technology, the target identification of the specific area of the head of the pig is carried out by combining deep learning according to a target detection model based on YoloV4, the maximum temperature of the ear root area is further acquired, and the error between the data fitted by the two through a polynomial regression model and the rectal temperature is controlled within +/-0.3 ℃ by matching with the indoor temperature, so that the measurement accuracy can be comparable to the manual measurement of traditional personnel, and the fitted data can replace the rectal temperature for early warning and judgment. If the temperature is higher than 39 ℃ or a set threshold value, the pig is judged to be sick, and early warning is sent to workers. The automatic detection of the body temperature of the pig is realized, so the required cost is low, the efficiency is high, and the detection accuracy is high.
An embodiment of the present invention further provides a pig temperature detection device, as shown in fig. 2, including:
the acquisition module is used for acquiring an infrared image of a target pig and a temperature matrix file of the infrared image;
the coordinate value output module is used for inputting the infrared image of the target pig to a pre-trained target recognition model and outputting the coordinate value of the designated position of the target pig;
the maximum temperature value determining module is used for determining the maximum temperature value of the head part based on the coordinate value and the temperature matrix file;
the temperature value fitting module is used for inputting the maximum head temperature value and the indoor temperature value into a regression model for fitting and drawing a temperature curve according to the fitted temperature value;
and the judging module is used for judging the health condition of the target pig based on the temperature curve.
In one embodiment, the coordinate value output module includes:
the acquisition unit is used for acquiring a plurality of infrared images of the pig in advance through the thermal infrared imager to serve as training samples;
the marking unit is used for marking the head designated position of each image in the training sample by using a marking tool to form a training set and a testing set;
and the first acquisition unit is used for taking the images in the training set as sample input data, taking the corresponding prediction box result as sample output data, carrying out training based on the CSPdarknet53 network, and acquiring a preliminary pig designated part identification model.
In one embodiment, the coordinate value output module further includes:
the test unit is used for testing the identification model of the only designated part of the preliminary pig by using the images in the test set and the corresponding prediction frame results;
the second obtaining unit is used for adjusting the preliminary pig designated part identification model according to the test result, and obtaining an optimal pig designated part identification model until the confidence coefficient of the prediction target is greater than a preset threshold value;
and the coordinate value acquisition unit is used for inputting the preprocessed target pig infrared image into the optimal pig designated part recognition model, carrying out target detection according to the optimal pig designated part recognition model, and acquiring a target pig head prediction frame and coordinate values of the head prediction frame.
In one embodiment, the maximum temperature value determination module includes:
and the reading unit is used for reading the temperature matrix file by using a temperature acquisition program, reading the temperature values of all pixel points in the coordinate value range of the head prediction frame, selecting the maximum value of all the temperature values as the maximum head temperature value, and the temperature matrix file contains the temperature value of each pixel point in the infrared image.
According to the method and the device for detecting the temperature of the pigs, the head of a specific part is identified according to the infrared images of the pigs shot by the thermal infrared imager, the maximum temperature of the head is obtained according to the temperature matrix, fitting is carried out according to the head and the indoor temperature and the rectal temperature, the parameters of a polynomial regression model are adjusted, the error is controlled within +/-0.3 ℃, and finally a temperature comparison curve is drawn according to the fitted temperature, so that the temperature of the pigs exceeds 39 ℃ or a set threshold value in the day can be clearly seen, or the temperature continuously rises or falls in multiple days, and early warning is given at the moment. Therefore, according to the method for detecting the temperature of the pig, provided by the embodiment of the invention, the main process is that whether the temperature of the pig is abnormal or not can be judged by collecting the infrared image and the temperature matrix file of the pig and then carrying out background automatic processing, so that the automatic detection of the temperature of the pig is realized, a plurality of workers are not required to detect the rectal temperature in a time-consuming and labor-consuming manner, the required cost is lower, the efficiency is higher, and the detection accuracy is higher.
The readable storage medium may be a computer storage medium or a communication medium. Communication media includes any medium that facilitates transfer of a computer program from one place to another. Computer storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, a readable storage medium is coupled to the processor such that the processor can read information from, and write information to, the readable storage medium. Of course, the readable storage medium may also be an integral part of the processor. The processor and the readable storage medium may reside in an Application Specific Integrated Circuits (ASIC). Additionally, the ASIC may reside in user equipment. Of course, the processor and the readable storage medium may also reside as discrete components in a communication device. The readable storage medium may be a read-only memory (ROM), a random-access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The present invention also provides a program product comprising execution instructions stored in a readable storage medium. The at least one processor of the device may read the execution instructions from the readable storage medium, and the execution of the execution instructions by the at least one processor causes the device to implement the methods provided by the various embodiments described above.
In the above embodiments of the terminal or the server, it should be understood that the Processor may be a Central Processing Unit (CPU), other general-purpose processors, a Digital Signal Processor (DSP), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (10)
1. A method for detecting the temperature of a pig is characterized by comprising the following steps:
acquiring an infrared image of a target pig and a temperature matrix file of the infrared image;
inputting the infrared image of the target pig into a pre-trained target recognition model, and outputting the coordinate value of the designated position of the target pig;
determining a head maximum temperature value based on the coordinate values and the temperature matrix file;
inputting the maximum head temperature value and the indoor temperature value into a regression model for fitting, and drawing a temperature curve according to the fitted temperature value;
and judging the health condition of the target pig based on the temperature curve.
2. The method for detecting the temperature of the pig according to claim 1, wherein the inputting the infrared image of the target pig into a pre-trained target recognition model and outputting the coordinate value of the designated position of the target pig comprises:
pre-collecting a plurality of infrared images of the pig by using a thermal infrared imager as a training sample;
marking the head designated position of each image in the training sample by using a marking tool to form a training set and a testing set;
and taking the images in the training set as sample input data, taking the corresponding prediction box result as sample output data, and carrying out training based on the CSPdark 53 network to obtain a preliminary pig designated part identification model.
3. The method for detecting the temperature of the pig according to claim 2, wherein after obtaining the preliminary pig designated part identification model, the method comprises the following steps:
testing the preliminary pig designated part recognition model by using the images in the test set and the corresponding prediction frame results;
adjusting the preliminary pig designated part recognition model according to a test result, and obtaining an optimal pig designated part recognition model until the confidence of a predicted target is greater than a preset threshold;
inputting the preprocessed target pig infrared image into the optimal pig designated part recognition model, and carrying out target detection according to the optimal pig designated part recognition model to obtain a target pig head prediction frame and coordinate values of the head prediction frame.
4. The pig temperature detection method of claim 3, wherein the determining a head maximum temperature value based on the coordinate values and the temperature matrix file comprises:
the temperature matrix file comprises a temperature value of each pixel point in the infrared image;
and reading the temperature matrix file by using a temperature acquisition program, reading temperature values of all pixel points in the coordinate value range of the head prediction frame, and selecting the maximum value of all the temperature values as the maximum head temperature value.
5. The method according to claim 1, wherein the inputting the head maximum temperature value and the indoor temperature value into a regression model for fitting comprises:
taking the maximum temperature of the head and the indoor temperature as independent variables of a regression model, taking the rectal temperature of a target pig as a dependent variable, and fitting the dependent variable through the two independent variables;
and reducing the error between the fitted temperature value and the rectum temperature by adjusting the polynomial maximum degree of the regression model for multiple times.
6. The method for detecting the temperature of the pig according to claim 1, wherein the judging the health condition of the target pig based on the temperature curve comprises:
taking the fitted temperature value as the body temperature of the pig, and drawing a temperature curve graph;
if the temperature value of the target pig continuously increases or decreases for a plurality of consecutive days or the temperature of the target pig exceeds 39 ℃ on a certain day, the target pig is judged to have only possible abnormality.
7. A temperature sensing device for pigs, said device comprising:
the acquisition module is used for acquiring an infrared image of a target pig and a temperature matrix file of the infrared image;
the coordinate value output module is used for inputting the infrared image of the target pig to a pre-trained target recognition model and outputting the coordinate value of the designated position of the target pig;
the maximum temperature value determining module is used for determining the maximum temperature value of the head part based on the coordinate value and the temperature matrix file;
the temperature value fitting module is used for inputting the maximum head temperature value and the indoor temperature value into a regression model for fitting and drawing a temperature curve according to the fitted temperature value;
and the judging module is used for judging the health condition of the target pig based on the temperature curve.
8. The pig temperature detection device of claim 7, wherein the coordinate value output module comprises:
the acquisition unit is used for acquiring a plurality of infrared images of the pig in advance through the thermal infrared imager to serve as training samples;
the marking unit is used for marking the head designated position of each image in the training sample by using a marking tool to form a training set and a testing set;
and the acquisition unit is used for taking the images in the training set as sample input data, taking the corresponding prediction box result as sample output data, carrying out training based on the CSPdarknet53 network, and acquiring a preliminary pig designated part identification model.
9. A computer device comprising a memory and a processor, the memory storing a computer program operable on the processor, wherein the processor implements the steps of the method of any one of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111421089.5A CN114155216A (en) | 2021-11-26 | 2021-11-26 | Pig temperature detection method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111421089.5A CN114155216A (en) | 2021-11-26 | 2021-11-26 | Pig temperature detection method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114155216A true CN114155216A (en) | 2022-03-08 |
Family
ID=80458164
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111421089.5A Pending CN114155216A (en) | 2021-11-26 | 2021-11-26 | Pig temperature detection method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114155216A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114305349A (en) * | 2022-03-14 | 2022-04-12 | 天津大学四川创新研究院 | Temperature detection method and system by using pig temperature-sensing color-changing ear tag |
CN115119766A (en) * | 2022-06-16 | 2022-09-30 | 天津农学院 | Sow oestrus detection method based on deep learning and infrared thermal imaging |
CN115968810A (en) * | 2023-03-21 | 2023-04-18 | 双胞胎(集团)股份有限公司 | Identification method and identification system for sick and epidemic pigs |
-
2021
- 2021-11-26 CN CN202111421089.5A patent/CN114155216A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114305349A (en) * | 2022-03-14 | 2022-04-12 | 天津大学四川创新研究院 | Temperature detection method and system by using pig temperature-sensing color-changing ear tag |
CN114305349B (en) * | 2022-03-14 | 2022-05-27 | 天津大学四川创新研究院 | Temperature detection method and system by using pig temperature-sensing color-changing ear tag |
CN115119766A (en) * | 2022-06-16 | 2022-09-30 | 天津农学院 | Sow oestrus detection method based on deep learning and infrared thermal imaging |
CN115119766B (en) * | 2022-06-16 | 2023-08-18 | 天津农学院 | Sow oestrus detection method based on deep learning and infrared thermal imaging |
CN115968810A (en) * | 2023-03-21 | 2023-04-18 | 双胞胎(集团)股份有限公司 | Identification method and identification system for sick and epidemic pigs |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114155216A (en) | Pig temperature detection method and device | |
CN109141248B (en) | Pig weight measuring and calculating method and system based on image | |
CN107635509B (en) | Improved method for determining body condition score, body weight and fertility status and related device | |
US10687713B2 (en) | Diagnostic apparatus | |
CN109060143B (en) | Pig body temperature monitoring system and method based on thermal infrared technology | |
AU2011218640B2 (en) | Detection apparatus | |
US9955672B2 (en) | Infrared thermography and behaviour information for identification of biologically important states in animals | |
MX2015006775A (en) | Systems and methods for predicting the outcome of a state of a subject. | |
CN110741963B (en) | Object state monitoring and sow oestrus monitoring method, device and system | |
CN111914685B (en) | Sow oestrus detection method and device, electronic equipment and storage medium | |
Lu et al. | An automatic ear base temperature extraction method for top view piglet thermal image | |
CN110456050B (en) | Portable intelligent digital parasite in vitro diagnostic instrument | |
CN115497123B (en) | Method for acquiring state parameters of region of interest | |
JP2021136868A (en) | Estimation system for estimating health condition of animal, estimation method, and learning model generation method | |
CN116019023A (en) | Electronic information management system and management method | |
US11100642B2 (en) | Computer system, and method and program for diagnosing animals | |
CA3230401A1 (en) | Systems and methods for the automated monitoring of animal physiological conditions and for the prediction of animal phenotypes and health outcomes | |
CN117351404A (en) | Milk cow delivery stress degree judging and recognizing method and system | |
CN112528772A (en) | Cow lameness movement characteristic detection method and device based on thermal infrared | |
CN115777560A (en) | Intelligent sow feeding system based on machine vision analysis technology | |
CN115147782A (en) | Dead animal identification method and device | |
CA2854344C (en) | Infrared thermography and behaviour information for identification of biolically important states in animals | |
Sumi et al. | Framework of cow calving monitoring system using video images | |
Yuan et al. | Stress-free detection technologies for pig growth based on welfare farming: A review | |
Zin et al. | Image Technology and Matrix-Geometric Method for Automatic Dairy Cow Body Condition Scoring |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |