CN112734731B - A livestock temperature detection method, device, equipment and storage medium - Google Patents

A livestock temperature detection method, device, equipment and storage medium Download PDF

Info

Publication number
CN112734731B
CN112734731B CN202110033020.9A CN202110033020A CN112734731B CN 112734731 B CN112734731 B CN 112734731B CN 202110033020 A CN202110033020 A CN 202110033020A CN 112734731 B CN112734731 B CN 112734731B
Authority
CN
China
Prior art keywords
livestock
temperature
infrared
image
super
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.)
Active
Application number
CN202110033020.9A
Other languages
Chinese (zh)
Other versions
CN112734731A (en
Inventor
张玉良
问雪
刘兴宇
李攀鹏
凌飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Muyuan Foods Co Ltd
Original Assignee
Muyuan Foods Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Muyuan Foods Co Ltd filed Critical Muyuan Foods Co Ltd
Priority to CN202110033020.9A priority Critical patent/CN112734731B/en
Publication of CN112734731A publication Critical patent/CN112734731A/en
Application granted granted Critical
Publication of CN112734731B publication Critical patent/CN112734731B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4053Scaling of whole images or parts thereof, e.g. expanding or contracting based on super-resolution, i.e. the output image resolution being higher than the sensor resolution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10048Infrared image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A40/00Adaptation technologies in agriculture, forestry, livestock or agroalimentary production
    • Y02A40/70Adaptation technologies in agriculture, forestry, livestock or agroalimentary production in livestock or poultry

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Biophysics (AREA)
  • Biomedical Technology (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Quality & Reliability (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Radiation Pyrometers (AREA)
  • Studio Devices (AREA)
  • Image Processing (AREA)

Abstract

The application discloses a livestock temperature detection method, which comprises the steps of acquiring an infrared photographing instruction, and acquiring infrared images of livestock by using an infrared photographing device; processing the infrared image by using a super-resolution model to obtain a super-resolution image; detecting target livestock in the super-resolution image, and detecting coordinates of temperature detection key points of the target livestock; and detecting the temperature of the temperature detection key point, and alarming when the temperature is higher than a preset threshold value. The method can realize all-weather automatic patrol on the premise of ensuring the precision, provides important guarantee for monitoring the body temperature of livestock, reduces the calculated amount, reduces the hardware pressure, saves the cost and prevents the spread of livestock diseases. The invention also discloses a livestock temperature detection device, equipment and a storage medium.

Description

一种牲畜温度检测方法、装置、设备和存储介质A livestock temperature detection method, device, equipment and storage medium

技术领域technical field

本发明属于畜牧养殖技术领域,特别是涉及一种牲畜温度检测方法、装置、设备和存储介质。The invention belongs to the technical field of animal husbandry, and in particular relates to a livestock temperature detection method, device, equipment and storage medium.

背景技术Background technique

牲畜养殖行业是劳动密集型行业,现有技术中,当需要对牲畜温度进行检测时,一种是人工方式,比较费时费力,依赖于操作人员的个人素质,而且由于受到各种因素的影响,也不容易将所有温度异常的牲畜都找出来,还有一种是依赖于自动化技术检测牲畜的温度,其采用的目标检测方法包含两种,一种是通过传统opencv进行边缘检测获取目标轮廓,但是该方法较难适应复杂场景目标检测的需求,另外一种是深度学习的方法,但其主要针对的是行人和车辆等照片,准确率较低,也不适合应用在牲畜温度检测领域中。The livestock breeding industry is a labor-intensive industry. In the existing technology, when it is necessary to detect the temperature of livestock, one is the manual method, which is time-consuming and laborious, and depends on the personal quality of the operator, and is affected by various factors. It is also not easy to find all livestock with abnormal temperature. Another method is to rely on automatic technology to detect the temperature of livestock. It uses two target detection methods. One is to obtain the target outline through traditional opencv edge detection, but This method is difficult to adapt to the needs of target detection in complex scenes. The other method is deep learning, but it is mainly aimed at photos of pedestrians and vehicles, and its accuracy is low. It is not suitable for application in the field of livestock temperature detection.

发明内容Contents of the invention

为解决上述问题,本发明提供了一种牲畜温度检测方法、装置、设备和存储介质,能够在保证精度的前提下实现全天候自动巡栏,为牲畜体温监测提供重要保障,而且能够减少计算量,降低硬件压力,节约成本,防止牲畜疾病的传播。In order to solve the above problems, the present invention provides a livestock temperature detection method, device, equipment and storage medium, which can realize all-weather automatic fence patrol under the premise of ensuring accuracy, provide an important guarantee for livestock body temperature monitoring, and can reduce the amount of calculation, Reduce hardware pressure, save costs, and prevent the spread of livestock diseases.

本发明提供的一种牲畜温度检测方法,包括:A livestock temperature detection method provided by the invention comprises:

获取红外拍照指令,利用红外拍照装置采集牲畜的红外图像;Obtain infrared camera instructions, and use infrared camera devices to collect infrared images of livestock;

利用超分辨模型对所述红外图像处理,得到超分辨图像;Using a super-resolution model to process the infrared image to obtain a super-resolution image;

对所述超分辨图像中的目标牲畜进行检测,并检测出所述目标牲畜的温度检测关键点的坐标;Detecting the target livestock in the super-resolution image, and detecting the coordinates of the temperature detection key points of the target livestock;

检测所述温度检测关键点的温度,当所述温度高于预设阈值时报警。Detect the temperature of the temperature detection key point, and alarm when the temperature is higher than a preset threshold.

优选的,在上述牲畜温度检测方法中,在所述对所述超分辨图像中的目标牲畜进行检测之前,还包括对检测模型进行训练,包括:Preferably, in the above livestock temperature detection method, before the detection of the target livestock in the super-resolution image, it also includes training the detection model, including:

使用数据标注工具对所述红外图像进行标注,获得初始训练集;Using a data labeling tool to label the infrared image to obtain an initial training set;

利用数据增强方式获得多样化数据集;Use data augmentation methods to obtain diverse data sets;

使用深度学习目标检测模型进行训练得到初始模型;Use the deep learning target detection model to train to get the initial model;

对所述初始模型进行推理,利用温度矩阵对所述多样化数据集进行数据清洗,判断单张所述红外图像中是否存在待检测温度区间内的物体,若存在则使用所述深度学习目标检测模型进行推理,得到红外图像中的预测结果BBox;Perform reasoning on the initial model, use the temperature matrix to perform data cleaning on the diverse data set, determine whether there is an object within the temperature range to be detected in the single infrared image, and use the deep learning target detection method if it exists The model performs inference and obtains the prediction result BBox in the infrared image;

通过设定BBox的阈值过滤掉一部分目标,得到最终的牲畜目标检测结果。By setting the threshold of BBox to filter out some targets, the final livestock target detection result is obtained.

优选的,在上述牲畜温度检测方法中,所述利用红外拍照装置采集牲畜的红外图像为:Preferably, in the above livestock temperature detection method, the infrared image collected by the infrared camera device is:

利用安装在养殖场过道上方轨道的车上的红外热像仪采集牲畜的红外图像。Infrared images of livestock are collected using a thermal imaging camera mounted on a vehicle on the track above the aisle at the farm.

优选的,在上述牲畜温度检测方法中,所述数据增强方式包括mixup、翻转、平移、随机裁剪、添加随机噪音、GAN方式。Preferably, in the above livestock temperature detection method, the data enhancement methods include mixup, flipping, translation, random cropping, adding random noise, and GAN methods.

优选的,在上述牲畜温度检测方法中,通过yolov4模型得到红外图像中的预测结果BBox。Preferably, in the above livestock temperature detection method, the prediction result BBox in the infrared image is obtained through the yolov4 model.

本发明提供的一种牲畜温度检测装置包括:A livestock temperature detection device provided by the invention comprises:

红外拍照部件,用于获取红外拍照指令,采集牲畜的红外图像;An infrared photographing component is used to obtain infrared photographing instructions and collect infrared images of livestock;

图像处理部件,用于利用超分辨模型对所述红外图像处理,得到超分辨图像;An image processing component, configured to process the infrared image using a super-resolution model to obtain a super-resolution image;

温度检测关键点坐标确定部件,用于对所述超分辨图像中的目标牲畜进行检测,并检测出所述目标牲畜的温度检测关键点的坐标;The temperature detection key point coordinate determining component is used to detect the target livestock in the super-resolution image, and detect the coordinates of the target livestock's temperature detection key point;

报警部件,用于检测所述温度检测关键点的温度,当所述温度高于预设阈值时报警。The alarm component is used to detect the temperature of the temperature detection key point, and alarm when the temperature is higher than the preset threshold.

优选的,在上述牲畜温度检测装置中,还包括检测模型训练部件,用于使用数据标注工具对所述红外图像进行标注,获得初始训练集;利用数据增强方式获得多样化数据集;使用深度学习目标检测模型进行训练得到初始模型;对所述初始模型进行推理,利用温度矩阵对所述多样化数据集进行数据清洗,判断单张所述红外图像中是否存在待检测温度区间内的物体,若存在则使用所述深度学习目标检测模型进行推理,得到红外图像中的预测结果BBox;通过设定BBox的阈值过滤掉一部分目标,得到最终的牲畜目标检测结果。Preferably, in the above-mentioned livestock temperature detection device, a detection model training component is also included, which is used to use a data labeling tool to label the infrared image to obtain an initial training set; use data enhancement to obtain a diverse data set; use deep learning The target detection model is trained to obtain an initial model; the initial model is reasoned, and the temperature matrix is used to perform data cleaning on the diverse data set, and it is judged whether there is an object within the temperature range to be detected in the single infrared image, if If it exists, use the deep learning target detection model to perform inference to obtain the prediction result BBox in the infrared image; filter out some targets by setting the threshold of the BBox to obtain the final livestock target detection result.

优选的,在上述牲畜温度检测装置中,所述红外拍照部件具体用于利用安装在养殖场过道上方轨道的车上的红外热像仪采集牲畜的红外图像。Preferably, in the above livestock temperature detection device, the infrared photographing component is specifically used to collect infrared images of livestock by means of an infrared thermal imager installed on the vehicle on the track above the aisle of the farm.

本发明提供的一种计算机设备包括:A kind of computer equipment provided by the invention comprises:

存储器,用于存储计算机程序;memory for storing computer programs;

处理器,用于执行所述计算机程序时实现如上面任一种牲畜温度检测方法的步骤。A processor, configured to implement the steps of any one of the above livestock temperature detection methods when executing the computer program.

本发明提供的一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上面任一种牲畜温度检测方法的步骤。The present invention provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any one of the methods for detecting the temperature of livestock above are implemented.

通过上述描述可知,本发明提供的上述牲畜温度检测方法,由于包括先获取红外拍照指令,利用红外拍照装置采集牲畜的红外图像;然后利用超分辨模型对所述红外图像处理,得到超分辨图像;再对所述超分辨图像中的目标牲畜进行检测,并检测出所述目标牲畜的温度检测关键点的坐标;最后检测所述温度检测关键点的温度,当所述温度高于预设阈值时报警,可见该方法无需人工参与,能够在保证精度的前提下实现全天候自动巡栏,为牲畜体温监测提供重要保障,而且能够减少计算量,降低硬件压力,节约成本,防止牲畜疾病的传播。本发明提供的牲畜温度检测装置、设备和存储介质具有与上述方法同样的优点。It can be seen from the above description that the above-mentioned livestock temperature detection method provided by the present invention includes first obtaining an infrared photographing instruction, using an infrared photographing device to collect an infrared image of a livestock; then using a super-resolution model to process the infrared image to obtain a super-resolution image; Then detect the target livestock in the super-resolution image, and detect the coordinates of the temperature detection key points of the target livestock; finally detect the temperature of the temperature detection key points, when the temperature is higher than the preset threshold It can be seen that this method does not require manual participation, and can realize all-weather automatic fence patrol under the premise of ensuring accuracy, providing an important guarantee for livestock body temperature monitoring, and can reduce the amount of calculation, reduce hardware pressure, save costs, and prevent the spread of livestock diseases. The livestock temperature detection device, equipment and storage medium provided by the present invention have the same advantages as the above method.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。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 that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.

图1为本发明提供的一种牲畜温度检测方法的实施例的示意图;Fig. 1 is the schematic diagram of the embodiment of a kind of livestock temperature detection method provided by the present invention;

图2为本发明提供的一种牲畜温度检测装置的实施例的示意图;Fig. 2 is the schematic diagram of the embodiment of a kind of livestock temperature detection device provided by the present invention;

图3为本发明提供的一种计算机设备的实施例的示意图。Fig. 3 is a schematic diagram of an embodiment of a computer device provided by the present invention.

具体实施方式Detailed ways

本发明的核心是提供一种牲畜温度检测方法、装置、设备和存储介质,能够在保证精度的前提下实现全天候自动巡栏,为牲畜体温监测提供重要保障,而且能够减少计算量,降低硬件压力,节约成本,防止牲畜疾病的传播。The core of the present invention is to provide a livestock temperature detection method, device, equipment and storage medium, which can realize all-weather automatic fence patrol under the premise of ensuring accuracy, provide an important guarantee for livestock body temperature monitoring, and can reduce the amount of calculation and hardware pressure , save costs and prevent the spread of livestock diseases.

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本发明提供的一种牲畜温度检测方法的实施例如图1所示,图1为本发明提供的一种牲畜温度检测方法的实施例的示意图,该方法包括如下步骤:An embodiment of a livestock temperature detection method provided by the present invention is shown in Figure 1, and Figure 1 is a schematic diagram of an embodiment of a livestock temperature detection method provided by the present invention, the method includes the following steps:

S1:获取红外拍照指令,利用红外拍照装置采集牲畜的红外图像;S1: Obtain an infrared camera instruction, and use an infrared camera device to collect infrared images of livestock;

具体的,该红外拍照装置可以但不限于为红外热像仪,红外热像仪是将物体发射出的不可见的红外能量转变为可见的热图像,因此任何温度高于0°的物体都能成像,而牲畜温度明显高于环境温度因此不受光线影响可全天候观测牲畜的状态,结合目标检测技术捕获牲畜目标后可以方便进行体温监控。而且可以利用安装在养殖场过道上方轨道的车上的红外热像仪采集牲畜的红外图像,而不再采用现有的手持测温枪、人眼通过热像仪画面观测温度为主的方式。这个方法中,可以将RFID卡贴在每个栏位正中心的位置,用于实现定位,利用巡检小车定点停靠,结合小车上的红外热像仪,采集牲畜的红外热图数据,对采集到的数据进行初步清洗,挑选角度正常、栏内有牲畜的数据作为初始样本集,判断温度矩阵中的温度最大值是否超出设定的阈值,例如当前阈值为45摄氏度,超过45摄氏度的数据就被判定为异常数据,不参与后续模型的推理。Specifically, the infrared camera device can be, but not limited to, an infrared thermal imager. An infrared thermal imager converts invisible infrared energy emitted by an object into a visible thermal image, so any object with a temperature higher than 0° can Imaging, and the temperature of livestock is significantly higher than the ambient temperature, so it is not affected by light, and the status of livestock can be observed around the clock. Combining target detection technology to capture livestock targets can facilitate body temperature monitoring. Moreover, the infrared thermal imaging camera installed on the vehicle on the track above the aisle of the farm can be used to collect infrared images of livestock, instead of using the existing hand-held temperature measuring gun and human eyes to observe the temperature through the thermal imager screen. In this method, the RFID card can be pasted at the center of each column for positioning, and the patrol car can be used to stop at fixed points, combined with the infrared thermal imager on the car, to collect the infrared heat map data of livestock, and to collect Preliminary cleaning of the received data, selecting the data with normal angles and livestock in the pen as the initial sample set, and judging whether the maximum temperature in the temperature matrix exceeds the set threshold, for example, the current threshold is 45 degrees Celsius, and the data exceeding 45 degrees Celsius is It is judged as abnormal data and does not participate in the reasoning of subsequent models.

S2:利用超分辨模型对红外图像处理,得到超分辨图像;S2: Using the super-resolution model to process the infrared image to obtain a super-resolution image;

需要说明的是,该步骤使用的单图片超分辨率(SISR)算法通过交叉尺度非局部(CS-NL)注意力模块,整合到一个循环神经网络中,通过结合局部的CS-NL先验和非局部的先验到一个强大的循环聚合单元,得到最后的超分辨图像,使用超分辨率增强技术捕捉成像细节,可以大大提高模型推理的精度,同时降低设备的成本。具体的,红外牲畜图片要通过卷积神经网络提取图像特征,然后进入一系列递归神经单元,这些递归神经单元组成递归网络,最后再融合递归单元的信息通过卷积网络,生成高分辨率图片。对每个递归单元,前一层特征要经过三个分支,分别为交叉尺度非局部注意力分支、全尺度非局部注意力分支和局部分支,最后三个分支通过交互映射融合来提取所有特征,作为下一层的输入,具体可以如下操作:通过卷积神经网络提取红外牲畜图片的特征;将上一步的特征作为输入,通过SEM单元(Self-Examplers Minig)进行特征挖掘包括将特征通过交叉尺度非局部注意力网络提取特征、将特征通过内联尺度非局部注意力网络提取特征、将特征通过局部信息提取网络提取特征,将这三步得到的特征进行交互映射融合,将融合的信息通过Stride卷积层和Deconv层网络等进行处理;重复若干个SEM单元,组成循环神经网络;将以上若干个SEM单元挖掘的信息通过网络Concat进行联合,在通过卷积神经网络得到最后的高分辨率红外牲畜图片。以某养殖场的通过分辨率为256*192的红外摄像头采集的牲畜图片为例,此图模糊性太高,特别是牲畜与牲畜的边缘部分和头部等测温关键部位很难准确分辨清楚,通过此超分辨率模型处理,得到一种清晰度高,分辨率为512*384的红外牲畜图片,可见该步骤能够对后续基于红外牲畜图片准确的目标检测,实例分割能够提供极大帮助,这就有利于病死牲畜的检测。It should be noted that the single-picture super-resolution (SISR) algorithm used in this step is integrated into a recurrent neural network through the cross-scale non-local (CS-NL) attention module, by combining the local CS-NL prior and The non-local prior is connected to a powerful recurrent aggregation unit to obtain the final super-resolution image, and the use of super-resolution enhancement technology to capture imaging details can greatly improve the accuracy of model reasoning while reducing the cost of equipment. Specifically, the infrared livestock picture needs to extract image features through a convolutional neural network, and then enter a series of recurrent neural units, which form a recurrent network, and finally fuse the information of the recurrent units through the convolutional network to generate a high-resolution picture. For each recursive unit, the features of the previous layer go through three branches, which are the cross-scale non-local attention branch, the full-scale non-local attention branch and the local branch, and the last three branches extract all features through interactive mapping fusion. As the input of the next layer, the specific operation can be as follows: extract the features of the infrared livestock picture through the convolutional neural network; use the features of the previous step as input, and perform feature mining through the SEM unit (Self-Examplers Minig), including the features through the cross-scale The non-local attention network extracts features, extracts features through the inline scale non-local attention network, extracts features through the local information extraction network, performs interactive mapping and fusion of the features obtained in these three steps, and passes the fused information through Stride The convolutional layer and the Deconv layer network are processed; several SEM units are repeated to form a recurrent neural network; the information mined by the above several SEM units is combined through the network Concat, and the final high-resolution infrared infrared image is obtained through the convolutional neural network. Livestock pictures. Take the picture of livestock collected by an infrared camera with a resolution of 256*192 in a farm as an example. This picture is too blurry, especially the key parts of temperature measurement such as the edge of the livestock and the head, etc. are difficult to distinguish clearly Through this super-resolution model processing, a high-definition infrared livestock picture with a resolution of 512*384 is obtained. It can be seen that this step can provide great help for subsequent accurate target detection and instance segmentation based on infrared livestock pictures. This facilitates the detection of sick and dead livestock.

S3:对超分辨图像中的目标牲畜进行检测,并检测出目标牲畜的温度检测关键点的坐标;S3: Detect the target livestock in the super-resolution image, and detect the coordinates of the temperature detection key points of the target livestock;

上述步骤中利用红外热像仪采集的数据,需要进行数据处理,将与温度矩阵直接对应的灰度图像数据编码成为直观的红外热图,然后对其进行增强处理,可以得到大量的红外图像,将这些数据作为训练数据集,训练得到牲畜实例分割的神经网络模型,最终通过训练好的模型,可以分割出红外图像中的牲畜,并结合温度对所有牲畜进行监测。具体的,选取采集的红外数据中与温度矩阵对应的灰度图数据,根据其对比度,对其进行gamma变换和直方图局部增强,gamma变换可以拉伸高光区域的对比度,使得温度较高的牲畜的纹理更强,而直方图局部增强可以压暗对比度较低的高光区域,使得图像高光区域更柔和,细节更清晰,然后使用热金属编码,将处理后的灰度图编码成为符合视觉习惯的红外热图;构建训练数据集;收集采集的红外数据,对其进行上一步中的数据处理,然后挑选出足够多的牲畜分布各异的图像,对其进行标注,标记出红外图像中每一头牲畜的轮廓,将轮廓连接起来,图像中同一牲畜区域对应的所有像素都标记为同一ID,不同牲畜对应的ID不同;训练牲畜实例分割的神经网络模型,搭建适用于实例分割的神经网络模型,设置合适的损失函数,输入训练数据集,通过反向传播,不断地迭代更新网络模型中的权重,最终得到牲畜实例分割的神经网络模型。利用该训练后的模型即可检测出目标牲畜的温度检测关键点的坐标,将这个坐标对应到红外图像中,即可得到牲畜的体温数据,这种方法直接在牲畜红外热图上做耳根、腹股沟关键点的检测,减少了对硬件资的需求,降低了处理流程复杂度,提高了效率。In the above steps, the data collected by the infrared thermal imager needs to be processed, and the grayscale image data directly corresponding to the temperature matrix is encoded into an intuitive infrared heat map, and then enhanced to obtain a large number of infrared images. Using these data as a training data set, train a neural network model for livestock instance segmentation. Finally, through the trained model, the livestock in the infrared image can be segmented, and all livestock can be monitored in combination with the temperature. Specifically, select the grayscale image data corresponding to the temperature matrix in the collected infrared data, and perform gamma transformation and local enhancement of the histogram according to its contrast. The texture is stronger, and the local enhancement of the histogram can darken the high-light areas with low contrast, making the high-light areas of the image softer and the details clearer. Then use hot metal coding to encode the processed grayscale image into a visually compliant image. Infrared heat map; build a training data set; collect the collected infrared data, process the data in the previous step, and then select enough images with different distributions of livestock, mark them, and mark each head in the infrared image The outline of livestock, connect the outlines, all the pixels corresponding to the same livestock area in the image are marked with the same ID, different IDs correspond to different livestock; train the neural network model of livestock instance segmentation, build a neural network model suitable for instance segmentation, Set an appropriate loss function, input the training data set, and iteratively update the weights in the network model through backpropagation, and finally obtain the neural network model for livestock instance segmentation. The model after training can be used to detect the coordinates of the key points of temperature detection of the target livestock, and the coordinates can be mapped to the infrared image to obtain the body temperature data of the livestock. The detection of key points in the groin reduces the demand for hardware resources, reduces the complexity of the processing process, and improves efficiency.

S4:检测温度检测关键点的温度,当温度高于预设阈值时报警。S4: Detect the temperature of the key point of temperature detection, and alarm when the temperature is higher than the preset threshold.

需要说明的是,该预设阈值可以但不限于为40摄氏度,当将40摄氏度作为判断发烧的依据时,该检测关键点处的温度值超过40摄氏度时,判定为发烧的牲畜,或者在夏季炎热情况下,还可以判断其中一头牲畜的检测关键点处的温度是否比其他牲畜的检测关键点温度高一个值,例如1.8摄氏度,当判定符合上述要求的牲畜为发烧牲畜,缓解了因为环境温度因素的影响导致关键点绝对温度不准而误判的情况,而将温度值低于设定阈值的牲畜判定为死亡牲畜,发生这种情况时均需要进行报警,并且可以将预测得到的发烧牲畜推送到每个单元,饲养员结合推送结果进行及时的诊断和处理。It should be noted that the preset threshold can be but not limited to 40 degrees Celsius. When 40 degrees Celsius is used as the basis for judging fever, when the temperature value at the key point of the detection exceeds 40 degrees Celsius, it is judged as a livestock with a fever, or in summer In hot conditions, it can also be judged whether the temperature at the key detection point of one of the livestock is higher than that of other livestock by a value, for example, 1.8 degrees Celsius. The influence of factors leads to the inaccurate absolute temperature of the key point and misjudgment, and the livestock whose temperature value is lower than the set threshold is judged as dead livestock. When this happens, an alarm is required, and the predicted fever livestock It is pushed to each unit, and the breeder makes timely diagnosis and treatment based on the pushed results.

可见,上述实施例通过将与温度直接相关的图像数据编码并进行增强,得到更加直观的红外图像,然后对牲畜进行实例分割,得到每头牲畜的温度区域,从而对多头牲畜进行体温监测。上述方案中的牲畜可以但不限于为猪、牛和羊,任何类似牲畜都可以利用上述方法进行处理。It can be seen that the above embodiment encodes and enhances the image data directly related to temperature to obtain a more intuitive infrared image, and then performs instance segmentation on livestock to obtain the temperature area of each livestock, thereby monitoring the body temperature of multiple livestock. The livestock in the above scheme can be but not limited to pigs, cattle and sheep, and any similar livestock can be treated by the above method.

通过上述描述可知,本发明提供的上述牲畜温度检测方法的实施例中,由于包括先获取红外拍照指令,利用红外拍照装置采集牲畜的红外图像;然后利用超分辨模型对红外图像处理,得到超分辨图像;再对超分辨图像中的目标牲畜进行检测,并检测出目标牲畜的温度检测关键点的坐标;最后检测温度检测关键点的温度,当温度高于预设阈值时报警,可见该方法无需人工参与,能够在保证精度的前提下实现全天候自动巡栏,为牲畜体温监测提供重要保障,而且能够减少计算量,降低硬件压力,节约成本,防止牲畜疾病的传播。It can be seen from the above description that in the embodiment of the above-mentioned livestock temperature detection method provided by the present invention, because it includes first obtaining an infrared photographing instruction, using an infrared photographing device to collect an infrared image of a livestock; then using a super-resolution model to process the infrared image to obtain a super-resolution image; then detect the target livestock in the super-resolution image, and detect the coordinates of the key point of temperature detection of the target livestock; finally detect the temperature of the key point of temperature detection, and alarm when the temperature is higher than the preset threshold, it can be seen that this method does not need Manual participation can realize all-weather automatic fence patrol on the premise of ensuring accuracy, providing an important guarantee for livestock temperature monitoring, and can reduce the amount of calculation, reduce hardware pressure, save costs, and prevent the spread of livestock diseases.

还需要说明的是,针对红外热像仪采集得到的牲畜红外图像,利用卷积神经网络深度学习方法进行模型训练,获得能直接在牲畜红外图像提取牲畜腹股沟、耳根等关键点的深度学习模型,因此,在上述牲畜温度检测方法的一个具体实施例中,在对超分辨图像中的目标牲畜进行检测之前,还包括对检测模型进行训练,还可以包括:It should also be explained that, for the infrared images of livestock collected by the infrared thermal imager, the convolutional neural network deep learning method is used for model training to obtain a deep learning model that can directly extract key points such as the groin and ear roots of livestock from infrared images of livestock. Therefore, in a specific embodiment of the above livestock temperature detection method, before detecting the target livestock in the super-resolution image, it also includes training the detection model, which may also include:

使用数据标注工具对红外图像进行标注,获得初始训练集,具体的,这是采用人工标注的方式进行的,基于深度学习的关键点检测模型训练需要一定量的多样化样本,通过人工在红外图像上标出牲畜的边框及腹股沟、耳根等关键点,作为“知识”用于深度神经网络模型学习;Use the data labeling tool to label the infrared image to obtain the initial training set. Specifically, this is carried out by manual labeling. The key point detection model training based on deep learning requires a certain amount of diverse samples. Key points such as the frame of the livestock and the groin and ear roots are marked on it, and used as "knowledge" for deep neural network model learning;

利用数据增强方式获得多样化数据集,包括但不限于利用mixup方式来扩充该数据集;Use data enhancement methods to obtain diverse data sets, including but not limited to using mixup methods to expand the data set;

使用深度学习目标检测模型进行训练得到初始模型;Use the deep learning target detection model to train to get the initial model;

对初始模型进行推理,利用温度矩阵对多样化数据集进行数据清洗,判断单张红外图像中是否存在待检测温度区间内的物体,若存在则使用深度学习目标检测模型进行推理,得到红外图像中的预测结果BBox;Inference the initial model, use the temperature matrix to clean the diverse data sets, and judge whether there is an object in the temperature range to be detected in a single infrared image. If it exists, use the deep learning target detection model to reason, and get the The predicted result BBox;

通过设定BBox的阈值过滤掉一部分目标,得到最终的牲畜目标检测结果,也就是推理得到牲畜耳根、腹股沟关键点处的坐标值。By setting the threshold of the BBox to filter out some targets, the final livestock target detection result is obtained, that is, the coordinate values of the key points of the ears and groin of the livestock are obtained by reasoning.

具体的,需要提前建立好深度学习模型训练的数据集,为深度神经网络提供多样化的样本,进行深度神经网络模型训练,根据人工标注的文件,通过裁剪、调整大小、标准化等操作步骤,将图片内所有牲畜分别提取出来,并设定成固定大小;将标注的牲畜的耳根、腹股沟关键点坐标通过高斯核转化成64x64大小的真实heatmap;通过simple baseline神经网络进行特征提取,得到预测heatmap;利用真实heatmap和预测heatmap,计算L2 loss损失函数的值;通过误差反向传播的方式不断更新模型权重,直到模型收敛或满足迭代终止条件;模型应用效果评估及优化,通过实际应用,发现牲畜站立时会出现背部边缘被误判为腹股沟的现象,还可以对损失函数进行改进,在原损失函数中新增不可见关键点被检出而产生的损失值,并重新训练模型,改善模型检测效果,增强检测精度。基于深度学习的红外热图牲畜关键点检测模型训练完成后,提供1张新的牲畜红外热图作为模型的输入,经过目标检测及关键点检测模型处理之后,可以得到图片内各牲畜的耳根、腹股沟等关键点的坐标信息。Specifically, it is necessary to establish a data set for deep learning model training in advance, provide a variety of samples for the deep neural network, and conduct deep neural network model training. All the livestock in the picture are extracted separately and set to a fixed size; the marked coordinates of the ears and groin key points of the livestock are converted into a real heatmap of 64x64 size through a Gaussian kernel; feature extraction is performed through a simple baseline neural network to obtain a predicted heatmap; Use the real heatmap and predicted heatmap to calculate the value of the L2 loss loss function; continuously update the model weight through error backpropagation until the model converges or meets the iteration termination condition; model application effect evaluation and optimization, through practical application, it is found that livestock is standing Sometimes the back edge is misjudged as the groin, and the loss function can also be improved by adding the loss value generated by the detection of invisible key points to the original loss function, and retraining the model to improve the model detection effect. Enhance detection accuracy. After the training of the key point detection model of livestock based on infrared heat map based on deep learning is completed, a new infrared heat map of livestock is provided as the input of the model. After the target detection and key point detection model are processed, the ear root, Coordinate information of key points such as the groin.

在上述牲畜温度检测方法的另一个具体实施例中,数据增强方式可以包括mixup、翻转、平移、随机裁剪、添加随机噪音、GAN方式,也就是说,可以利用其中的至少一种方式来扩充数据集,得到模型训练的样本集。In another specific embodiment of the above livestock temperature detection method, the data enhancement methods may include mixup, flipping, translation, random cropping, adding random noise, and GAN methods, that is to say, at least one of them may be used to expand data Set to get the sample set for model training.

进一步的,可以通过yolov4模型得到红外图像中的预测结果BBox。具体而言,在模型训练时,将训练集中的图片resize到相同的大小并获取其真实的BBox位置信息,通过yolov4模型得到预测到的BBox信息,将真实的BBox位置信息与预测的BBox信息进行对比,将分类loss、confidence loss、location loss、iou loss之和作为最终的loss,利用反向传播算法不断更新权重,直到模型收敛或者满足迭代终止条件,然后进行模型推理与后处理,具体的,在线上推理阶段,首先结合TTA方法多次推理取置信度最大的结果作为目标检测的输出结果,然后设定BBox最小的阈值,当BBox的阈值小于给定阈值时过滤掉推理结果,当BBox阈值大于给定阈值时,输出红外热图牲畜目标检测结果。Further, the prediction result BBox in the infrared image can be obtained through the yolov4 model. Specifically, during model training, resize the pictures in the training set to the same size and obtain their real BBox position information, obtain the predicted BBox information through the yolov4 model, and compare the real BBox position information with the predicted BBox information In contrast, the sum of classification loss, confidence loss, location loss, and iou loss is used as the final loss, and the weight is continuously updated using the backpropagation algorithm until the model converges or the iteration termination condition is satisfied, and then model reasoning and post-processing are performed. Specifically, In the online inference stage, first combine the TTA method for multiple inferences to take the result with the highest confidence as the output result of the target detection, and then set the minimum threshold of the BBox. When the threshold of the BBox is less than the given threshold, the inference results are filtered out. When the threshold of the BBox is When it is greater than the given threshold, output the infrared heat map livestock target detection result.

本发明提供的一种牲畜温度检测装置的实施例如图2所示,图2为本发明提供的一种牲畜温度检测装置的实施例的示意图,该装置包括:An embodiment of a livestock temperature detection device provided by the present invention is shown in Figure 2, and Figure 2 is a schematic diagram of an embodiment of a livestock temperature detection device provided by the present invention, the device includes:

红外拍照部件201,用于获取红外拍照指令,采集牲畜的红外图像,具体的,该红外拍照部件可以但不限于为红外热像仪,红外热像仪是将物体发射出的不可见的红外能量转变为可见的热图像,因此任何温度高于0°的物体都能成像,而牲畜温度明显高于环境温度因此不受光线影响可全天候观测牲畜的状态,结合目标检测技术捕获牲畜目标后可以方便进行体温监控。而且可以利用安装在养殖场过道上方轨道的车上的红外热像仪采集牲畜的红外图像,而不再采用现有的手持测温枪、人眼通过热像仪画面观测温度为主的方式。这个方法中,可以将RFID卡贴在每个栏位正中心的位置,用于实现定位,利用巡检小车定点停靠,结合小车上的红外热像仪,采集牲畜的红外热图数据,对采集到的数据进行初步清洗,挑选角度正常、栏内有牲畜的数据作为初始样本集,判断温度矩阵中的温度最大值是否超出设定的阈值,例如当前阈值为45摄氏度,超过45摄氏度的数据就被判定为异常数据,不参与后续模型的推理;The infrared photographing part 201 is used to obtain infrared photographing instructions and collect infrared images of livestock. Specifically, the infrared photographing part can be, but not limited to, an infrared thermal imager. An infrared thermal imager is an invisible infrared energy emitted by an object. It is transformed into a visible thermal image, so any object with a temperature higher than 0° can be imaged, and the temperature of the livestock is significantly higher than the ambient temperature, so it is not affected by light, and the status of the livestock can be observed around the clock. Combining with the target detection technology to capture the livestock target, it can be convenient Perform temperature monitoring. Moreover, the infrared thermal imaging camera installed on the vehicle on the track above the aisle of the farm can be used to collect infrared images of livestock, instead of using the existing hand-held temperature measuring gun and human eyes to observe the temperature through the thermal imager screen. In this method, the RFID card can be pasted at the center of each column for positioning, and the patrol car can be used to stop at fixed points, combined with the infrared thermal imager on the car, to collect the infrared heat map data of livestock, and to collect Preliminary cleaning of the received data, selecting the data with normal angles and livestock in the pen as the initial sample set, and judging whether the maximum temperature in the temperature matrix exceeds the set threshold, for example, the current threshold is 45 degrees Celsius, and the data exceeding 45 degrees Celsius is It is judged as abnormal data and does not participate in the reasoning of subsequent models;

图像处理部件202,用于利用超分辨模型对红外图像处理,得到超分辨图像,使用的单图片超分辨率(SISR)算法通过交叉尺度非局部(CS-NL)注意力模块,整合到一个循环神经网络中,通过结合局部的CS-NL先验和非局部的先验到一个强大的循环聚合单元,得到最后的超分辨图像,使用超分辨率增强技术捕捉成像细节,可以大大提高模型推理的精度,同时降低设备的成本。具体的,红外牲畜图片要通过卷积神经网络提取图像特征,然后进入一系列递归神经单元,这些递归神经单元组成递归网络,最后再融合递归单元的信息通过卷积网络,生成高分辨率图片。对每个递归单元,前一层特征要经过三个分支,分别为交叉尺度非局部注意力分支、全尺度非局部注意力分支和局部分支,最后三个分支通过交互映射融合来提取所有特征,作为下一层的输入,具体可以如下操作:通过卷积神经网络提取红外牲畜图片的特征;将上一步的特征作为输入,通过SEM单元(Self-Examplers Minig)进行特征挖掘包括将特征通过交叉尺度非局部注意力网络提取特征、将特征通过内联尺度非局部注意力网络提取特征、将特征通过局部信息提取网络提取特征,将这三步得到的特征进行交互映射融合,将融合的信息通过Stride卷积层和Deconv层网络等进行处理;重复若干个SEM单元,组成循环神经网络;将以上若干个SEM单元挖掘的信息通过网络Concat进行联合,在通过卷积神经网络得到最后的高分辨率红外牲畜图片。以某养殖场的通过分辨率为256*192的红外摄像头采集的牲畜图片为例,此图模糊性太高,特别是牲畜与牲畜的边缘部分和头部等测温关键部位很难准确分辨清楚,通过此超分辨率模型处理,得到一种清晰度高,分辨率为512*384的红外牲畜图片,可见能够对后续基于红外牲畜图片准确的目标检测,实例分割能够提供极大帮助,这就有利于病死牲畜的检测;The image processing component 202 is used to process the infrared image using the super-resolution model to obtain a super-resolution image, and the single-picture super-resolution (SISR) algorithm used is integrated into a loop through the cross-scale non-local (CS-NL) attention module In the neural network, by combining the local CS-NL prior and the non-local prior into a powerful recurrent aggregation unit, the final super-resolution image is obtained, and the super-resolution enhancement technology is used to capture the imaging details, which can greatly improve the performance of model reasoning. accuracy while reducing equipment cost. Specifically, the infrared livestock picture needs to extract image features through a convolutional neural network, and then enter a series of recurrent neural units, which form a recurrent network, and finally fuse the information of the recurrent units through the convolutional network to generate a high-resolution picture. For each recursive unit, the features of the previous layer go through three branches, which are the cross-scale non-local attention branch, the full-scale non-local attention branch and the local branch, and the last three branches extract all features through interactive mapping fusion. As the input of the next layer, the specific operation can be as follows: extract the features of the infrared livestock picture through the convolutional neural network; use the features of the previous step as input, and perform feature mining through the SEM unit (Self-Examplers Minig), including the features through the cross-scale The non-local attention network extracts features, extracts features through the inline scale non-local attention network, extracts features through the local information extraction network, performs interactive mapping and fusion of the features obtained in these three steps, and passes the fused information through Stride The convolutional layer and the Deconv layer network are processed; several SEM units are repeated to form a recurrent neural network; the information mined by the above several SEM units is combined through the network Concat, and the final high-resolution infrared infrared image is obtained through the convolutional neural network. Livestock pictures. Take the picture of livestock collected by an infrared camera with a resolution of 256*192 in a farm as an example. This picture is too blurry, especially the key parts of temperature measurement such as the edge of the livestock and the head, etc. are difficult to distinguish clearly , through this super-resolution model processing, a high-definition infrared livestock picture with a resolution of 512*384 is obtained. It can be seen that it can provide a great help for subsequent accurate target detection based on infrared livestock pictures, and instance segmentation, which is Facilitate the detection of sick and dead livestock;

温度检测关键点坐标确定部件203,用于对超分辨图像中的目标牲畜进行检测,并检测出目标牲畜的温度检测关键点的坐标,利用红外热像仪采集的数据,需要进行数据处理,将与温度矩阵直接对应的灰度图像数据编码成为直观的红外热图,然后对其进行增强处理,可以得到大量的红外图像,将这些数据作为训练数据集,训练得到牲畜实例分割的神经网络模型,最终通过训练好的模型,可以分割出红外图像中的牲畜,并结合温度对所有牲畜进行监测。具体的,选取采集的红外数据中与温度矩阵对应的灰度图数据,根据其对比度,对其进行gamma变换和直方图局部增强,gamma变换可以拉伸高光区域的对比度,使得温度较高的牲畜的纹理更强,而直方图局部增强可以压暗对比度较低的高光区域,使得图像高光区域更柔和,细节更清晰,然后使用热金属编码,将处理后的灰度图编码成为符合视觉习惯的红外热图;构建训练数据集;收集采集的红外数据,对其进行上一步中的数据处理,然后挑选出足够多的牲畜分布各异的图像,对其进行标注,标记出红外图像中每一头牲畜的轮廓,将轮廓连接起来,图像中同一牲畜区域对应的所有像素都标记为同一ID,不同牲畜对应的ID不同;训练牲畜实例分割的神经网络模型,搭建适用于实例分割的神经网络模型,设置合适的损失函数,输入训练数据集,通过反向传播,不断地迭代更新网络模型中的权重,最终得到牲畜实例分割的神经网络模型。利用该训练后的模型即可检测出目标牲畜的温度检测关键点的坐标,将这个坐标对应到红外图像中,即可得到牲畜的体温数据,这种方法直接在牲畜红外热图上做耳根、腹股沟关键点的检测,减少了对硬件资的需求,降低了处理流程复杂度,提高了效率;The temperature detection key point coordinate determining component 203 is used to detect the target livestock in the super-resolution image, and detect the coordinates of the temperature detection key point of the target livestock. The data collected by the infrared thermal imager needs to be processed. The grayscale image data directly corresponding to the temperature matrix is encoded into an intuitive infrared heat map, and then enhanced to obtain a large number of infrared images. These data are used as a training data set to train a neural network model for livestock instance segmentation. Finally, through the trained model, the livestock in the infrared image can be segmented, and all livestock can be monitored in combination with the temperature. Specifically, select the grayscale image data corresponding to the temperature matrix in the collected infrared data, and perform gamma transformation and local enhancement of the histogram according to its contrast. The texture is stronger, and the local enhancement of the histogram can darken the high-light areas with low contrast, making the high-light areas of the image softer and the details clearer. Then use hot metal coding to encode the processed grayscale image into a visually compliant image. Infrared heat map; build a training data set; collect the collected infrared data, process the data in the previous step, and then select enough images with different distributions of livestock, mark them, and mark each head in the infrared image The outline of livestock, connect the outlines, all the pixels corresponding to the same livestock area in the image are marked with the same ID, different IDs correspond to different livestock; train the neural network model of livestock instance segmentation, build a neural network model suitable for instance segmentation, Set an appropriate loss function, input the training data set, and iteratively update the weights in the network model through backpropagation, and finally obtain the neural network model for livestock instance segmentation. The model after training can be used to detect the coordinates of the key points of temperature detection of the target livestock, and the coordinates can be mapped to the infrared image to obtain the body temperature data of the livestock. The detection of key points in the groin reduces the demand for hardware resources, reduces the complexity of the processing process, and improves efficiency;

报警部件204,用于检测温度检测关键点的温度,当温度高于预设阈值时报警,需要说明的是,该预设阈值可以但不限于为40摄氏度,当将40摄氏度作为判断发烧的依据时,该检测关键点处的温度值超过40摄氏度时,判定为发烧的牲畜,或者在夏季炎热情况下,还可以判断其中一头牲畜的检测关键点处的温度是否比其他牲畜的检测关键点温度高一个值,例如1.8摄氏度,当判定符合上述要求的牲畜为发烧牲畜,缓解了因为环境温度因素的影响导致关键点绝对温度不准而误判的情况,而将温度值低于设定阈值的牲畜判定为死亡牲畜,发生这种情况时均需要进行报警,并且可以将预测得到的发烧牲畜推送到每个单元,饲养员结合推送结果进行及时的诊断和处理。The alarm component 204 is used to detect the temperature of the key point of temperature detection. When the temperature is higher than the preset threshold, it will alarm. It should be noted that the preset threshold can be but not limited to 40 degrees Celsius. When 40 degrees Celsius is used as the basis for judging fever When the temperature value at the detection key point exceeds 40 degrees Celsius, it is determined to be a livestock with a fever, or in the case of hot summer, it can also be judged whether the temperature at the detection key point of one of the livestock is higher than that of other livestock. A higher value, such as 1.8 degrees Celsius, when it is determined that the livestock meeting the above requirements is a febrile livestock, it alleviates the misjudgment of the absolute temperature of the key point due to the influence of environmental temperature factors, and the temperature value is lower than the set threshold. The livestock is judged as dead livestock. When this happens, an alarm is required, and the predicted fever livestock can be pushed to each unit. The breeder can diagnose and deal with it in a timely manner based on the pushed results.

在上述牲畜温度检测装置的一个具体实施例中,还可以包括检测模型训练部件,用于使用数据标注工具对红外图像进行标注,获得初始训练集;利用数据增强方式获得多样化数据集;使用深度学习目标检测模型进行训练得到初始模型;对初始模型进行推理,利用温度矩阵对多样化数据集进行数据清洗,判断单张红外图像中是否存在待检测温度区间内的物体,若存在则使用深度学习目标检测模型进行推理,得到红外图像中的预测结果BBox;通过设定BBox的阈值过滤掉一部分目标,得到最终的牲畜目标检测结果。In a specific embodiment of the above-mentioned livestock temperature detection device, it may also include a detection model training component, which is used to mark the infrared image with a data labeling tool to obtain an initial training set; use data enhancement to obtain a diverse data set; use depth Learn the target detection model and train to obtain the initial model; reason the initial model, use the temperature matrix to clean the diverse data sets, and judge whether there is an object in the temperature range to be detected in a single infrared image, and if so, use deep learning The target detection model performs inference to obtain the prediction result BBox in the infrared image; by setting the threshold of the BBox to filter out some targets, the final livestock target detection result is obtained.

具体的,需要提前建立好深度学习模型训练的数据集,为深度神经网络提供多样化的样本,进行深度神经网络模型训练,根据人工标注的文件,通过裁剪、调整大小、标准化等操作步骤,将图片内所有牲畜分别提取出来,并设定成固定大小;将标注的牲畜的耳根、腹股沟关键点坐标通过高斯核转化成64x64大小的真实heatmap;通过simple baseline神经网络进行特征提取,得到预测heatmap;利用真实heatmap和预测heatmap,计算L2 loss损失函数的值;通过误差反向传播的方式不断更新模型权重,直到模型收敛或满足迭代终止条件;模型应用效果评估及优化,通过实际应用,发现牲畜站立时会出现背部边缘被误判为腹股沟的现象,还可以对损失函数进行改进,在原损失函数中新增不可见关键点被检出而产生的损失值,并重新训练模型,改善模型检测效果,增强检测精度。基于深度学习的红外热图牲畜关键点检测模型训练完成后,提供1张新的牲畜红外热图作为模型的输入,经过目标检测及关键点检测模型处理之后,可以得到图片内各牲畜的耳根、腹股沟等关键点的坐标信息。Specifically, it is necessary to establish a data set for deep learning model training in advance, provide a variety of samples for the deep neural network, and conduct deep neural network model training. All the livestock in the picture are extracted separately and set to a fixed size; the marked coordinates of the ears and groin key points of the livestock are converted into a real heatmap of 64x64 size through a Gaussian kernel; feature extraction is performed through a simple baseline neural network to obtain a predicted heatmap; Use the real heatmap and predicted heatmap to calculate the value of the L2 loss loss function; continuously update the model weight through error backpropagation until the model converges or meets the iteration termination condition; model application effect evaluation and optimization, through practical application, it is found that livestock is standing Sometimes the back edge is misjudged as the groin, and the loss function can also be improved by adding the loss value generated by the detection of invisible key points to the original loss function, and retraining the model to improve the model detection effect. Enhance detection accuracy. After the training of the key point detection model of livestock based on infrared heat map based on deep learning is completed, a new infrared heat map of livestock is provided as the input of the model. After the target detection and key point detection model are processed, the ear root, Coordinate information of key points such as the groin.

本发明提供的一种计算机设备的实施例如图3所示,图3为本发明提供的一种计算机设备的实施例的示意图,该设备包括:An embodiment of a computer device provided by the present invention is shown in FIG. 3, and FIG. 3 is a schematic diagram of an embodiment of a computer device provided by the present invention. The device includes:

存储器301,用于存储计算机程序;Memory 301, used to store computer programs;

处理器302,用于执行计算机程序时实现如上面任一种牲畜温度检测方法的步骤。The processor 302 is configured to implement the steps of any one of the above livestock temperature detection methods when executing the computer program.

本发明提供的一种计算机可读存储介质的实施例中,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上面任一种牲畜温度检测方法的步骤。In an embodiment of a computer-readable storage medium provided by the present invention, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any one of the methods for detecting the temperature of livestock above are implemented.

本发明提供的上述牲畜温度检测装置、设备和存储介质,能够在保证精度的前提下实现全天候自动巡栏,为牲畜体温监测提供重要保障,而且能够减少计算量,降低硬件压力,节约成本,防止牲畜疾病的传播。The above-mentioned livestock temperature detection device, equipment and storage medium provided by the present invention can realize all-weather automatic fence patrol on the premise of ensuring accuracy, provide an important guarantee for livestock body temperature monitoring, and can reduce the amount of calculation, reduce hardware pressure, save costs, and prevent Spread of livestock disease.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A method for detecting temperature of livestock, comprising:
acquiring an infrared photographing instruction, and acquiring an infrared image of livestock by using an infrared photographing device;
processing the infrared image by using a super-resolution model to obtain a super-resolution image;
detecting target livestock in the super-resolution image, and detecting coordinates of temperature detection key points of the target livestock;
detecting the temperature of the temperature detection key point, and alarming when the temperature is higher than a preset threshold value;
the infrared image is processed by utilizing a super-resolution model, the super-resolution image is obtained, the characteristics of the infrared image of livestock are extracted through a convolutional neural network, the characteristics are taken as input, the characteristics are mined through SEM units, the characteristics are extracted through a cross-scale non-local attention network, the characteristics are extracted through an inline scale non-local attention network, the characteristics are extracted through a local information extraction network, the characteristics obtained in the three steps are subjected to interactive mapping fusion, the fused information is processed through a Stride convolutional layer and a Dev layer network, and a plurality of SEM units are repeated to form a cyclic neural network; combining the information mined by the plurality of SEM units through a network Concat, and obtaining a final super-resolution image through a convolutional neural network;
before the target livestock in the super-resolution image is detected, training a detection model is further included, and the method comprises the following steps:
marking the infrared image by using a data marking tool to obtain an initial training set;
obtaining a diversified data set by utilizing a data enhancement mode;
training by using a deep learning target detection model to obtain an initial model;
reasoning the initial model, cleaning the data of the diversified data sets by utilizing a temperature matrix, judging Shan Zhangsuo whether an object in a temperature interval to be detected exists in the infrared image, and if so, reasoning by using the deep learning target detection model to obtain a prediction result BBox in the infrared image;
filtering out a part of targets by setting a threshold value of BBox to obtain a final livestock target detection result;
and filtering out a part of targets by setting a threshold value of BBox, wherein the final livestock target detection result is obtained by the following steps: and obtaining the coordinate information of the auricles and groin of each livestock in the picture.
2. The method for detecting the temperature of livestock according to claim 1, wherein the step of acquiring the infrared image of the livestock by using the infrared photographing device is:
infrared images of livestock are acquired by using a thermal infrared imager mounted on a car of a rail above a farm aisle.
3. The method of claim 1, wherein the data enhancement mode includes a mix up, flip, pan, random cut, add random noise, GAN mode.
4. The livestock temperature detection method of claim 1, wherein the prediction result BBox in the infrared image is obtained by a yolov4 model.
5. A livestock temperature detection device, comprising:
the infrared photographing component is used for acquiring an infrared photographing instruction and acquiring an infrared image of livestock;
the image processing component is used for processing the infrared image by utilizing the super-resolution model to obtain a super-resolution image;
a temperature detection key point coordinate determining unit for detecting a target livestock in the super-resolution image and detecting coordinates of a temperature detection key point of the target livestock;
the alarm component is used for detecting the temperature of the temperature detection key point, and alarming when the temperature is higher than a preset threshold value;
the image processing component is specifically used for extracting the characteristics of an infrared image of livestock through a convolutional neural network, taking the characteristics as input, carrying out characteristic mining through SEM units, and comprises the steps of extracting the characteristics through a cross-scale non-local attention network, extracting the characteristics through an inline scale non-local attention network, extracting the characteristics through a local information extraction network, carrying out interactive mapping fusion on the characteristics obtained in the three steps, processing the fused information through a Stride convolutional layer and a Deconv layer network, and repeating a plurality of SEM units to form the cyclic neural network; combining the information mined by the plurality of SEM units through a network Concat, and obtaining a final super-resolution image through a convolutional neural network;
the detection model training component is used for marking the infrared image by using a data marking tool to obtain an initial training set; obtaining a diversified data set by utilizing a data enhancement mode; training by using a deep learning target detection model to obtain an initial model; reasoning the initial model, cleaning the data of the diversified data sets by utilizing a temperature matrix, judging Shan Zhangsuo whether an object in a temperature interval to be detected exists in the infrared image, and if so, reasoning by using the deep learning target detection model to obtain a prediction result BBox in the infrared image; filtering out a part of targets by setting a threshold value of BBox to obtain a final livestock target detection result;
the detection model training component is used for obtaining the coordinate information of the auricles and the groins of the livestock in the pictures.
6. The livestock temperature detection device of claim 5, wherein the infrared photographing means is specifically configured to collect infrared images of the livestock using a thermal infrared imager mounted on a car of a rail above the farm aisle.
7. A computer device, comprising:
a memory for storing a computer program;
a processor for carrying out the steps of the method for detecting the temperature of livestock as claimed in any of claims 1 to 4 when executing said computer program.
8. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the livestock temperature detection method according to any of claims 1 to 4.
CN202110033020.9A 2021-01-11 2021-01-11 A livestock temperature detection method, device, equipment and storage medium Active CN112734731B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110033020.9A CN112734731B (en) 2021-01-11 2021-01-11 A livestock temperature detection method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110033020.9A CN112734731B (en) 2021-01-11 2021-01-11 A livestock temperature detection method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112734731A CN112734731A (en) 2021-04-30
CN112734731B true CN112734731B (en) 2023-07-28

Family

ID=75590249

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110033020.9A Active CN112734731B (en) 2021-01-11 2021-01-11 A livestock temperature detection method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112734731B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113487486A (en) * 2021-07-23 2021-10-08 河南牧原智能科技有限公司 Image resolution enhancement processing method, device and equipment and readable storage medium
CN113610871A (en) * 2021-08-11 2021-11-05 河南牧原智能科技有限公司 Individual segmentation method and system based on infrared imaging
CN113678751B (en) * 2021-08-19 2022-08-02 安徽大学 Intelligent passageway device for beef cattle body shape parameter acquisition and exercise health recognition
CN114200967B (en) * 2021-11-29 2024-09-20 河南牧原智能科技有限公司 Method for determining preset angle, method for detecting livestock body temperature and product
CN114264378A (en) * 2021-12-20 2022-04-01 红原县雪月天佑农牧科技有限公司 Intelligent livestock management system and method
CN114885853B (en) * 2022-05-10 2023-11-24 河南讯飞智元信息科技有限公司 Livestock body temperature monitoring method, device, electronic equipment and storage medium
CN114743224B (en) * 2022-06-13 2022-09-09 金乡县康华乳业有限公司 Animal husbandry livestock body temperature monitoring method and system based on computer vision
CN115342937B (en) * 2022-10-20 2023-05-05 正大农业科学研究有限公司 Temperature anomaly detection method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180051785A (en) * 2016-11-09 2018-05-17 건국대학교 산학협력단 Livestock monitoring system
CN110200598A (en) * 2019-06-12 2019-09-06 天津大学 A kind of large-scale plant that raises sign exception birds detection system and detection method
WO2019200735A1 (en) * 2018-04-17 2019-10-24 平安科技(深圳)有限公司 Livestock feature vector acquisition method, apparatus, computer device and storage medium
CN112085089A (en) * 2020-09-03 2020-12-15 国网浙江省电力有限公司电力科学研究院 Intelligent temperature measurement method of substation equipment based on deep learning algorithm

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111192200A (en) * 2020-01-02 2020-05-22 南京邮电大学 Image Super-Resolution Reconstruction Method Based on Residual Network with Fusion Attention Mechanism

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180051785A (en) * 2016-11-09 2018-05-17 건국대학교 산학협력단 Livestock monitoring system
WO2019200735A1 (en) * 2018-04-17 2019-10-24 平安科技(深圳)有限公司 Livestock feature vector acquisition method, apparatus, computer device and storage medium
CN110200598A (en) * 2019-06-12 2019-09-06 天津大学 A kind of large-scale plant that raises sign exception birds detection system and detection method
CN112085089A (en) * 2020-09-03 2020-12-15 国网浙江省电力有限公司电力科学研究院 Intelligent temperature measurement method of substation equipment based on deep learning algorithm

Also Published As

Publication number Publication date
CN112734731A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
CN112734731B (en) A livestock temperature detection method, device, equipment and storage medium
Billah et al. Real-time goat face recognition using convolutional neural network
Zin et al. Image technology based cow identification system using deep learning
CN111046880B (en) Infrared target image segmentation method, system, electronic equipment and storage medium
WO2023060777A1 (en) Pig body size and weight estimation method based on deep learning
CN110200598B (en) Poultry detection system and detection method for abnormal physical signs in large farm
CN109241842B (en) Fatigue driving detection method, device, computer equipment and storage medium
Yu et al. Railway obstacle detection algorithm using neural network
WO2020125057A1 (en) Livestock quantity identification method and apparatus
Noe et al. Automatic detection and tracking of mounting behavior in cattle using a deep learning-based instance segmentation model
CN110929687B (en) Multi-user behavior recognition system based on key point detection and working method
Bello et al. Mask YOLOv7-based drone vision system for automated cattle detection and counting
CN116596861A (en) Method, system, device and storage medium for identifying tooth surface lesions
Yang et al. A defencing algorithm based on deep learning improves the detection accuracy of caged chickens
CN115100732A (en) Phishing detection method, device, computer equipment and storage medium
CN112906510A (en) Fishery resource statistical method and system
CN112215107A (en) Pig behavior identification method and device, electronic equipment and storage medium
CN119313717A (en) Vehicle-mounted camera visibility inversion method, device, medium and electronic equipment
CN117456620A (en) A multi-modal cow individual identification method and system incorporating action information
CN117409409A (en) Infrared pig instance segmentation method and system based on deep learning
CN114943929B (en) Real-time detection method for abnormal behaviors of fish based on image fusion technology
CN116758586A (en) Deep learning-based pregnant sow backfat thickness measurement method, system and equipment
CN113837087B (en) Animal target detection system and method based on YOLOv3
CN115984554A (en) Weight estimation method based on deep learning
CN114255203B (en) A method and system for estimating the number of fry

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
GR01 Patent grant
GR01 Patent grant