Livestock identity recognition and health early warning method and system based on multi-feature fusion
Patent Information
- Application Number
- CN202611099816.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-10-30
AI Technical Summary
[0004]尽管现有技术在牲畜个体识别和跟踪方面取得了进展,但仍存在诸多不足,在个体识别层面,现有方案多依赖单一生理特征--如仅依靠面部特征或仅依靠鼻镜特征,单一特征所包含的信息量有限,难以构建全面精确的特征表达,在牲畜面部遮挡频繁、姿态变化大、个体间差异不如人脸明显的自然场景下,识别准确率和稳定性难以满足实际养殖需求,在技术架构层面,已有方案通常仅解决单一环节的问题--或仅关注数量统计、或仅关注身份识别、或仅关注行为检测,缺乏将目标检测、多目标跟踪、个体识别、健康评估和群体统计等多个环节无缝衔接的一体化技术方案,在环境适应性层面,真实牧场中逆光、夜间、尘土、雨雾及密集遮挡等复杂条件普遍存在,普通视觉模型缺少系统性的图像增强与鲁棒性设计,难以稳定运行
(1)通过共享特征提取网络与并行检测分支同步输出全身与头部检测框,结合跨帧轨迹关联分配唯一轨迹身份编号,个体识别模型提取面部微纹理、耳廓形态、角部结构及体态轮廓多模态特征进行身份识别,并将外观特征模板反馈至跨帧轨迹关联更新匹配权重,形成识别结果反哺跟踪的双向闭环,有效解决了单一特征识别准确率低、遮挡场景下身份跳变频繁及识别与跟踪数据单向传递缺乏协同的问题,显著提升了复杂牧场环境下个体识别准确率和跟踪稳定性;
Smart Images

Figure CN123016137A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and smart farming technology, specifically relating to a method and system for livestock identification and health early warning based on multi-feature fusion. Background Technology
[0002] In recent years, the application of computer vision technology in the field of smart farming has received widespread attention. Researchers have used convolutional neural networks to extract biological features such as livestock faces and noses for individual identification. Deep learning-based cattle face recognition technology, with its non-contact and high-precision characteristics, provides a new technical approach for individual identification.
[0003] In terms of target tracking, some solutions combine AI vision and multi-target tracking technology to generate a global ID mapping table containing unique individual identifiers, enabling real-time statistics of livestock numbers and identification of abnormal behaviors. In addition, some patents have proposed a method for tracking individual cattle based on the fusion and matching of identity features and spatial information, as well as a method for identifying cattle based on the fusion of multimodal decision layers. The above research shows that computer vision and deep learning have achieved certain research results in livestock individual identification, target tracking, and behavior analysis.
[0004] Despite the progress made in livestock individual identification and tracking, existing technologies still have many shortcomings. At the individual identification level, existing solutions mostly rely on single physiological features—such as facial features or only nasal mirror features. The amount of information contained in a single feature is limited, making it difficult to construct a comprehensive and accurate feature representation. In natural scenarios where livestock faces are frequently obscured, posture changes are significant, and individual differences are not as obvious as human faces, the accuracy and stability of identification are difficult to meet the actual farming needs. At the technical architecture level, existing solutions usually only address the problem of a single link—either focusing only on quantity statistics, identity recognition, or behavior detection. There is a lack of an integrated technical solution that seamlessly connects multiple links such as target detection, multi-target tracking, individual identification, health assessment, and group statistics. At the environmental adaptability level, complex conditions such as backlighting, nighttime, dust, rain, fog, and dense occlusion are common in real pastures. Ordinary visual models lack systematic image enhancement and robust design, making it difficult to operate stably.
[0005] In addition, traditional ear tag and RFID identification methods rely on specialized equipment and manual operation, which is labor-intensive and can easily cause stress reactions in animals, and cannot achieve real-time visual judgment of the group's activity status. Summary of the Invention
[0006] To address the aforementioned problems in the existing technology, this invention provides a method and system for livestock identification and health early warning based on multi-feature fusion. The objective of this invention can be achieved through the following technical solutions: Includes the following steps: The target area video image is acquired, preprocessed with adaptive illumination correction and background suppression, and then input into a shared feature extraction network. After synchronous decoupling through a parallel detection branch, the whole body and head detection boxes and confidence scores are output. Based on the confidence level and temporal spatial constraints, cross-frame trajectory association is performed, and trajectory identification numbers are dynamically allocated and maintained. The detection area corresponding to the trajectory identity number is input into the individual recognition model to extract facial micro-texture, ear shape, angular structure and body contour features. After multimodal feature alignment and similarity calculation, the identity recognition result is output, and the appearance feature template is fed back to the cross-frame trajectory association to update the matching weight. Based on the identity recognition results, historical health baselines are retrieved, and baseline deviation detection is performed using accumulated temporal behavioral parameters and visual state features. The health level is determined according to the degree of deviation, and an early warning is triggered. The number of deduplicated groups from multiple perspectives is output simultaneously.
[0007] Specifically, the process of the input shared feature extraction network is as follows: The preprocessed video images are fed into the network frame by frame. Multi-layer convolutional downsampling is used. The bottom layer extracts the edge direction, corner distribution and texture primitives of the bottom visual features. The middle layer combines the bottom features to form the secondary semantic responses of ear contour, corner base and body surface patches. The top layer gathers context information through the global receptive field to generate a high-level semantic feature map. The high-level semantic feature map retains spatial resolution and channel depth, serving as the input basis for the parallel detection branch.
[0008] Specifically, the process of synchronously decoupling and outputting the whole-body and head detection boxes and confidence scores through parallel detection branches is as follows: The system connects the whole-body and head detection branches in parallel. Each branch contains independent classification and regression subnetworks. The whole-body branch predicts the bounding box parameters and target confidence of the entire torso, while the head branch predicts the bounding box parameters and target confidence of the head region. Both the full-body branch and the head branch regression subnetworks output the horizontal and vertical coordinates of the bounding box center, as well as the width and height. The classification and regression subnetworks do not interfere with each other and output the full-body and head detection boxes simultaneously.
[0009] Specifically, the process of performing cross-frame trajectory association is as follows: The processing priority of the current frame detection box is determined based on the confidence level and the preset first-level confidence threshold and second-level confidence threshold; Extract the coordinates and appearance feature vectors of the detection boxes that exceed the first-level confidence threshold, calculate the overlap ratio and cosine distance with the active trajectory prediction position and cumulative appearance template, merge them into a comprehensive matching score, and construct a cost matrix to solve the association scheme. Detection boxes with confidence between the first-level and second-level confidence thresholds are temporarily stored in the cache.
[0010] Specifically, the process of dynamically allocating and maintaining trajectory identification numbers is as follows: For targets that appear for the first time, whose confidence exceeds the trajectory creation confidence threshold, and cannot be associated with existing trajectories, a new number is generated and state parameters are initialized. The state parameters include location coordinates, detection box scale, appearance feature template, and tracking frame counter. For successfully associated targets, retain the original number and update the status parameters; for unassociated trajectories in multiple consecutive frames, mark them as pending cancellation, and release the number when the number of consecutive frames exceeds the trajectory cancellation frame threshold.
[0011] Specifically, the processing procedure of the individual identification model is as follows: The head region and the whole body region are obtained by cropping the detection area corresponding to the assigned trajectory number. The facial micro-texture features of the periorbital texture and the surface texture of the nose mirror are extracted by the facial branch. The ear length-to-width ratio and the ear tip pointing angle are extracted by the ear branch. The body proportion and back line curvature body contour features are extracted by the body posture branch. Each branch is mapped to a fixed-length feature sub-vector through an independent encoding network, and then concatenated into a multimodal fusion feature vector through a fusion layer.
[0012] Specifically, the process of outputting the identity recognition result is as follows: The multimodal fusion feature vector output by the individual recognition model is compressed into an identity embedding vector through a fully connected mapping network. The identity output layer calculates the cosine similarity between the identity embedding vector and the embedding vectors of each registered identity template in the identity template library. The identity template with the highest cosine similarity value is selected as the candidate identity. When the maximum cosine similarity exceeds the preset identity confirmation threshold, the individual identity information corresponding to the candidate identity is output.
[0013] Specifically, the process of feeding back the appearance feature template to the cross-frame trajectory association update matching weight is as follows: When outputting the identity recognition result, the identity embedding vector extracted from the detection area of the current frame is used as the latest appearance feature sample, and a weighted rolling update is performed on the historical appearance feature templates accumulated with the same trajectory number. After the update, the cross-frame trajectory association module replaces the original appearance matching template. The trajectory association of the next frame uses the updated template to calculate the feature cosine distance. The weighting coefficient of appearance similarity in the comprehensive matching score is dynamically adjusted according to the number of consecutive successful trajectory association frames.
[0014] Specifically, the process of baseline deviation detection is as follows: The time series of cumulative behavioral parameters for identified livestock includes body displacement distance, percentage of lying down time, cumulative time of head being below the trunk line, mean respiratory amplitude reflected by the rate of change of the detection frame area, and normalized distance between the target center point and the group center point. The statistical mean and standard deviation of each parameter within a continuous historical time window preceding the current moment are stored in the individual's health profile as historical health baselines. The difference between the measured parameter values and the baseline mean is divided by the standard deviation to obtain the baseline deviation of each behavioral parameter.
[0015] Specifically, the process of determining the health level and triggering an alert based on the degree of deviation is as follows: The absolute value of the baseline deviation of the behavioral parameters is taken and then summed according to preset weights to obtain the comprehensive deviation index. If the comprehensive deviation index is below the first preset threshold, it is considered to be in a healthy baseline state. If it is between the first and second preset thresholds, it is considered to be slightly abnormal and a attention mark is recorded. If it is between the second and third preset thresholds, it is considered to be moderately abnormal and an early warning is triggered. If it is above the third preset threshold, it is considered to be severely abnormal and an emergency warning is triggered. The timestamp, identity number, comprehensive deviation index, and abnormal parameter details are recorded in the log simultaneously.
[0016] Specifically, the process of synchronously outputting the number of duplicate groups from multiple perspectives is as follows: For multi-view independent target detection and cross-frame trajectory association, obtain the set of active trajectory IDs for each view, and calculate the overlap of trajectories in the overlapping areas of the field of view between pairs of views; If the same trajectory number appears in multiple viewpoints and the overlap exceeds the viewpoint overlap threshold, it is determined to be the same target. The total number of non-repeating trajectory numbers from all viewpoints is counted as the population size. The earliest and latest occurrence times under each viewpoint are merged to generate a complete cross-viewpoint activity time window record, which is output together with the population size.
[0017] Specifically, the livestock identification and health early warning system based on multi-feature visual analysis includes: Detection unit: acquires video images of the target area, performs adaptive illumination correction and background suppression preprocessing, inputs them into a shared feature extraction network, and outputs full-body and head detection boxes and confidence scores through parallel detection branches for synchronous decoupling; Tracking unit: Based on the confidence level and temporal spatial constraints, it performs cross-frame trajectory association, dynamically allocates and maintains trajectory identification numbers; Recognition Unit: Inputs the detection area corresponding to the trajectory identity number into the individual recognition model, extracts facial micro-texture, ear shape, angular structure and body contour features, outputs the identity recognition result after multimodal feature alignment and similarity calculation, and feeds back the appearance feature template to the cross-frame trajectory association update matching weight; Early warning unit: Based on the identity recognition result, retrieve the historical health baseline, accumulate time-series behavioral parameters and visual state features to perform baseline deviation detection; determine the health level according to the degree of deviation and trigger an early warning, and simultaneously output the number of deduplicated groups from multiple perspectives.
[0018] The beneficial effects of this invention are as follows: (1) By sharing the feature extraction network and parallel detection branch, the whole body and head detection boxes are output synchronously. Combined with cross-frame trajectory association, a unique trajectory identity number is assigned. The individual recognition model extracts multimodal features of facial micro-texture, ear shape, corner structure and body contour for identity recognition. The appearance feature template is fed back to the cross-frame trajectory association to update the matching weight, forming a two-way closed loop of recognition results feeding back to tracking. This effectively solves the problems of low accuracy of single feature recognition, frequent identity jumps in occluded scenes and lack of coordination in the one-way transmission of recognition and tracking data, and significantly improves the accuracy of individual recognition and tracking stability in complex pasture environments. (2) By retrieving the historical health baseline of the corresponding individual based on the identity recognition result, the baseline deviation detection is performed by accumulating the time-series behavioral parameters and visual state features. The health level is determined according to the degree of deviation and a graded warning is triggered. The number of deduplicated groups from multiple perspectives is output simultaneously, realizing the integrated linkage of individual identification, health assessment and group statistics. This effectively overcomes the defects of health assessment relying on a unified threshold and not being able to be individualized, each module operating independently and not being able to form a management closed loop, and the repeated statistics of group numbers under multiple perspectives. It significantly improves the accuracy of health warning and the efficiency of group management. Attached Figure Description
[0019] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings.
[0020] Figure 1 This is a data flow diagram of the livestock identification and health early warning method and system based on multi-feature fusion according to the present invention; Figure 2 This is a system architecture diagram of the livestock identification and health early warning system based on multi-feature fusion according to the present invention; Figure 3 This is a schematic diagram of the individual identification model structure in this invention. Detailed Implementation
[0021] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided.
[0022] Please see Figures 1-3 A method and system for livestock identification and health early warning based on multi-feature fusion; Includes the following steps: The target area video image is acquired, preprocessed with adaptive illumination correction and background suppression, and then input into a shared feature extraction network. After synchronous decoupling through a parallel detection branch, the whole body and head detection boxes and confidence scores are output. In this embodiment, the activity area of cattle and sheep is used as the application scenario. The video image acquisition device is deployed in the cattle shed, sheep shed, feeding passage, drinking area and entrance and exit, etc., to collect the natural activity video stream of cattle and sheep in the target area. This method is applicable to both single-view and multi-view monitoring modes. The specific process of synchronously decoupling and outputting full-body and head detection bounding boxes and confidence scores is as follows: Video streams of cattle and sheep activity areas captured by one or more cameras located in cattle sheds, sheep sheds, feeding areas, drinking areas, and entrances / exits are fed frame-by-frame into a shared feature extraction network. This network uses a multi-layer convolutional structure for progressive downsampling. The bottom convolutional layer extracts the edge direction, corner distribution, and texture primitives from the image's low-level visual features. The middle layer combines these low-level features to form secondary semantic responses such as ear contours, corner bases, and body surface patches. The top layer aggregates contextual information through the global receptive field to generate a high-level semantic feature map containing the full-body posture and head orientation of the cattle and sheep. This high-level semantic feature map simultaneously retains spatial resolution and channel depth, serving as the common input basis for the parallel detection branches. The whole-body detection branch and the head detection branch are connected in parallel on a shared feature map. Each branch contains an independent classification subnetwork and a regression subnetwork. The whole-body detection branch predicts the bounding box parameters and target confidence of the entire cattle and sheep torso at various spatial locations on the feature map. The head detection branch predicts the bounding box parameters and target confidence of the head region of cattle and sheep at the same feature map location. The regression subnetworks of both branches output the horizontal and vertical coordinates of the bounding box center, width and height. The classification subnetwork and the regression subnetwork do not interfere with each other and output the whole-body and head detection boxes synchronously. Among them, the target area video images refer to the video streams of the cattle and sheep activity areas collected by one or more cameras set up at the cattle shed, sheep shed, feeding area, drinking area, and entrance / exit locations; Adaptive illumination correction refers to the dynamic range compression and stretching of image brightness using gamma correction and histogram equalization for backlight, nighttime, and low-light scenes, so that the overall brightness distribution of the image is uniform. Background suppression refers to removing invalid background areas in the camera's field of view by cropping the Region of Interest (ROI) to reduce the computational load of subsequent networks. Confidence score refers to the probability that the detection box predicted by the target detection branch actually contains cattle and sheep targets. The value ranges from 0 to 1, and the closer it is to 1, the more reliable the detection result is. High-level semantic feature maps refer to feature response maps formed in deep networks after multi-layer convolution downsampling, which contain global contextual information and semantic category information. These feature maps retain sufficient spatial location resolution for bounding box regression and have rich semantic information for classification confidence prediction.
[0023] Based on the confidence level and temporal spatial constraints, cross-frame trajectory association is performed, and trajectory identification numbers are dynamically allocated and maintained. In this embodiment, the specific process of dynamically allocating and maintaining trajectory identification numbers is as follows: The processing priority of detection boxes in the current frame is determined based on confidence level and preset first-level and second-level confidence thresholds. The position coordinates and appearance feature vectors of detection boxes exceeding the first-level confidence threshold are extracted. The overlap ratio between the position coordinates and the predicted motion position of the current active trajectory is calculated. The cosine distance between the appearance feature vectors and the cumulative appearance template of the current active trajectory is calculated. The overlap ratio and cosine distance are weighted and combined into a comprehensive matching score. The comprehensive matching score is used to construct a matching cost matrix between the detection boxes and the active trajectory, and the optimal association scheme is solved. Detection boxes with confidence levels between the first-level and second-level confidence thresholds are temporarily stored in a cache, awaiting further processing. In subsequent frames, the confidence level is increased before the target is matched again. For targets that appear for the first time, have a confidence level exceeding the first-level confidence threshold, and cannot be successfully associated with any existing active trajectory, a new trajectory ID is generated and the state parameters are initialized. These state parameters include the target's position coordinates in the current frame, the detection box scale, the appearance feature template, and the tracking frame count counter. For targets that are successfully associated with existing active trajectories, their original trajectory ID is retained and the state parameters are updated. For existing active trajectories that have not been associated with any detection box for multiple consecutive frames, they are marked as pending cancellation. The trajectory ID is released when the pending cancellation status exceeds a preset frame limit. The first-level confidence threshold is set to 0.7, and the second-level confidence threshold is set to 0.4. The overlap ratio refers to the ratio of the intersection area of the detection box and the trajectory prediction box to the union area, which is used to measure the degree of overlap between the two in spatial location. The appearance feature vector refers to the 128-dimensional feature embedding extracted from the detection box region through a deep convolutional network, which is used to characterize the appearance information of the target. Cosine distance refers to the cosine value of the angle between two feature vectors, which ranges from -1 to 1. The closer it is to 1, the more similar the two features are. The comprehensive matching score is a single value obtained by weighting the positional overlap ratio and the appearance cosine distance according to preset weights. It is used to comprehensively measure the degree of matching between the detection box and the trajectory. The trajectory identification number is a unique identifier assigned to each individual cow or sheep that appears continuously in the video frame. It is used to distinguish different individuals and maintain identity consistency across frames. The number is assigned sequentially starting from 0 and can be reused by a new target after being released.
[0024] like Figure 3 As shown, the detection area corresponding to the trajectory identity number is input into the individual recognition model, and facial micro-texture, ear shape, corner structure and body contour features are extracted. After multimodal feature alignment and similarity calculation, the identity recognition result is output, and the appearance feature template is fed back to the cross-frame trajectory association to update the matching weight. In this embodiment, the specific process of extracting facial micro-texture, ear shape, horn structure, and body contour features is as follows: the head region and the whole body region are obtained by cropping from the detection region corresponding to the assigned trajectory number; the facial branch extracts the facial micro-texture features of the periorbital texture direction and the surface texture of the nose mirror from the head region; the ear branch extracts the ear length to ear width ratio and ear tip pointing angle from the peripheral area of the head as ear shape features; the body shape branch extracts the body proportion and back line curvature as body contour features from the whole body region; each branch is mapped to a fixed-length feature sub-vector through an independent coding network, and then concatenated into a 384-dimensional multimodal fusion feature vector through a fusion layer; The specific process of outputting the identity recognition result after multimodal feature alignment and similarity calculation is as follows: the 384-dimensional multimodal fusion feature vector is compressed into a 128-dimensional identity embedding vector through a fully connected mapping network; the identity output layer calculates the cosine similarity between the identity embedding vector and the embedding vectors of each registered identity template in the identity template library; the identity template with the largest cosine similarity value is selected as the candidate identity, and when the maximum cosine similarity exceeds the preset identity confirmation threshold of 0.75, the individual identity information corresponding to the candidate identity is output; The specific process of feeding back the appearance feature template to the cross-frame trajectory association update matching weight is as follows: When outputting the identity recognition result, the 128-dimensional identity embedding vector extracted from the detection area of the current frame is used as the latest appearance feature sample. The historical appearance feature templates accumulated with the same trajectory number are subjected to weighted rolling update, with the update weight set to 0.1 for the current feature and 0.9 for the historical template. After the update, the template is sent back to the cross-frame trajectory association module to replace the original appearance matching template. The next frame trajectory association uses the updated template to calculate the feature cosine distance. The weighting coefficient of appearance similarity in the comprehensive matching score is dynamically adjusted according to the number of consecutive successful trajectory association frames. Among them, facial microtextures include the direction and distribution of textures around the eye sockets of cattle and sheep and the texture patterns on the surface of the nasal mirror. These textures vary among different individuals and remain relatively stable with age. Auricular morphology includes the ratio of ear length to ear width and the pointing angle of the ear tip in three-dimensional space. There are significant differences in auricular proportions among different breeds and individuals. The horn structure includes the horn base width, horn length, and horn curvature direction. The horn is one of the most significant stable biological characteristics that vary between individual cattle and sheep. Body contour features include the curvature of the back curve of cattle and sheep and the body proportions of the trunk. The skeletal structure and muscle distribution of different individuals determine the uniqueness of their body contour. The identity template library refers to the collection of pre-registered individual identity embedding vectors for each cow or sheep, with each template corresponding to a cow or sheep with a known identity; The identity verification threshold refers to the minimum cosine similarity requirement for determining whether the current recognition result is credible. Setting it to 0.75 means that the identity is only verified when the similarity between the identity embedding vector and a certain template exceeds 75%. Weighted rolling update refers to the process of weighting new appearance feature samples with historical cumulative templates according to a certain proportion each time they are obtained, so that the templates can reflect the latest appearance changes of individuals while maintaining long-term stability.
[0025] Based on the identity recognition results, historical health baselines are retrieved, and baseline deviation detection is performed using accumulated temporal behavioral parameters and visual state features. The health level is determined according to the degree of deviation, and an early warning is triggered. Simultaneously, the number of deduplicated groups from multiple perspectives is output. In this embodiment, the specific process of baseline deviation detection for cumulative time-series behavioral parameters and visual state features is as follows: For the time series of cumulative behavioral parameters of cattle and sheep whose identities have been confirmed, the behavioral parameters include the body displacement distance per second, the proportion of lying down time per minute to the observation time, the cumulative time per minute for the head to be below the torso line, the average respiratory amplitude reflected by the rate of change of the detection frame area, and the normalized distance between the target center point and the group center point; The statistical mean and standard deviation of each parameter within the historical time window of 72 consecutive hours before the current moment are used as the historical health baseline of the cattle and sheep and stored in the individual file; The baseline deviation of each behavioral parameter is obtained by subtracting the mean of the measured parameter value from the baseline and dividing by the standard deviation; The specific process for determining the health level and triggering an alert based on the degree of deviation is as follows: the absolute values of the baseline deviations of each behavioral parameter are taken and then summed according to preset weights to obtain a comprehensive deviation index; when the comprehensive deviation index is below 1.5, it is determined to be a healthy baseline state; between 1.5 and 3.0, it is determined to be a mild abnormality and a attention mark is recorded; between 3.0 and 5.0, it is determined to be a moderate abnormality and an alert is triggered; and above 5.0, it is determined to be a severe abnormality and an emergency alert is triggered; the timestamp, identity number, comprehensive deviation index, and abnormal parameter details are simultaneously recorded in the log. The specific process for synchronously outputting the number of duplicate groups from multiple viewpoints is as follows: For multiple video capture viewpoints covering the same target area, target detection and cross-frame trajectory association are performed independently in each viewpoint to obtain the set of active trajectory IDs at the current moment of each viewpoint; the overlap of trajectories in the overlapping areas of the field of view between each pair of viewpoints is calculated, and when the same trajectory ID appears in multiple viewpoints and the overlap exceeds the overlap threshold of 0.6, it is determined to be the same target; the total number of unique trajectory IDs in all viewpoints is counted as the group number in that area; the earliest and latest occurrence times in each viewpoint are merged to generate a complete cross-viewpoint activity time window record, which is output together with the group number. Among them, the historical health baseline refers to the normal fluctuation range of behavioral parameters established individually for each individual cattle and sheep. By accumulating the behavioral data of the individual in a healthy state for 72 consecutive hours, the mean and standard deviation of each behavioral parameter are calculated as a personalized benchmark for subsequent health assessment. There are differences in the health baseline of different individuals. For example, the average daily lying down time of adult cattle is usually 0.15 to 0.25, while that of calves can reach 0.30 to 0.45. The body displacement distance in the behavioral parameters refers to the Euclidean distance that the target center point of cattle and sheep moves in the image coordinate system per unit time. The percentage of time spent lying down refers to the cumulative time during which the ratio of the height to the width of the cattle and sheep target detection boxes is lower than the lying down judgment threshold within a unit of observation time, out of the total observation time. The cumulative time the head is below the torso line refers to the cumulative time that the center vertical coordinate of the head detection frame of cattle and sheep is below the center vertical coordinate of the whole body detection frame; Normalized outgroup distance is the dimensionless value obtained by dividing the distance between the target center point of cattle and sheep and the geometric center of all target center points in the group by the distribution radius of the group. The mean respiratory amplitude reflected by the rate of change of the detection frame area refers to an indicator that indirectly estimates the respiratory frequency and amplitude of cattle and sheep by measuring the periodic fluctuation amplitude of the detection frame area in consecutive frames. The comprehensive deviation index is a single quantitative indicator obtained by weighted summation of the baseline deviations of behavioral parameters from multiple dimensions; The weights for body displacement distance (0.25), lying down duration (0.30), head below trunk line (0.20), respiratory amplitude (0.15), and normalized outlier distance (0.10) are used to comprehensively reflect the overall deviation of an individual from their normal state. The larger the value, the worse the health condition. Overlap is the ratio of the intersection area to the union area of the detection boxes of two trajectories after spatial mapping, and is used to measure whether the same target is observed from different perspectives. The overlap threshold is a preset crossover ratio critical value used to determine the same target. Setting it to 0.6 means that when the spatial overlap ratio of the trajectory detection boxes in two views exceeds 60%, it is identified as the same cattle or sheep. The complete time window record refers to merging the first and last appearance times of the same trajectory identification number in each view to form a continuous activity timeline of the cattle or sheep in the entire multi-view monitoring system coverage area. The record format includes the time of entering the monitoring area, the time of leaving the monitoring area, and the details of the dwell time in each view.
[0026] Example: Taking a large-scale cattle farm as an example; Multiple high-definition network cameras were installed in the cattle shed, feeding passage, drinking area, and entrance / exit. Each viewpoint covered the activity area of the cattle and sheep, and there was overlap between adjacent viewpoints. The video stream was connected to the edge computing device in real time. Adaptive illumination correction and background suppression preprocessing were performed on each frame of the image. Dynamic range compression was performed using gamma correction and histogram equalization. Invalid background areas were removed by ROI cropping. The preprocessed images were fed into a shared feature extraction network. The network used multi-layer convolutional downsampling. The bottom layer extracted edge direction, corner distribution, and texture primitives. The middle layer combined to form ear contour, corner base, and body surface patch response. The top layer generated a high-level semantic feature map. The whole body and head detection branches were connected in parallel on the high-level semantic feature map. Each branch contained independent classification and regression sub-networks. The whole body and head detection boxes and confidence scores were output simultaneously. The detection boxes in the current frame are prioritized based on their confidence levels. For detection boxes exceeding a high threshold, the overlap ratio and appearance cosine distance between their positions and active trajectories are calculated, and these are weighted and merged into a comprehensive matching score to solve for the optimal association scheme. Detection boxes with confidence levels between the high and low thresholds are temporarily cached and await matching in subsequent frames. For targets that appear for the first time, exceed the threshold, and cannot be associated, a new trajectory number is generated and the status parameters are initialized. For successfully associated targets, the original number is retained and the status is updated. Trajectories that have not been associated for several consecutive frames are released after a timeout. For cattle and sheep with assigned trajectory numbers, the head and body regions are cropped from the detection area and fed into the face, ear, and body posture branches to extract micro-texture, ear shape, and body contour features. Each branch is independently encoded and mapped into feature sub-vectors, which are then fused into a multimodal feature vector and compressed into an identity embedding vector. The identity output layer calculates the cosine similarity between this vector and each template in the template library. When the similarity exceeds the confirmation threshold, the identity information is output. At the same time, the current identity embedding vector is used as an appearance sample, and a weighted rolling update is performed on the historical templates. The tracking module is sent back to replace the original template, and the updated template is used for subsequent frame association. The weighting coefficient is dynamically adjusted according to the number of consecutively associated frames of the trajectory. After confirming the individual's identity, accumulate individual behavioral parameters, including body displacement, percentage of time spent lying down, duration of head below the torso line, average respiratory amplitude, and outlier distance. Retrieve the individual's historical baseline, compare the current parameters with the baseline to obtain the degree of deviation, and calculate the weighted sum to obtain the comprehensive deviation index. Determine the health baseline, mild concern, moderate warning, or severe emergency warning based on the index interval. Log the data simultaneously. Perform detection and association independently from each perspective to obtain a set of trajectory numbers. Calculate the overlap of trajectories in the overlapping areas of each pair of perspectives. If the overlap exceeds the threshold, the same target is identified. Count the total number of unique numbers from all perspectives to obtain the population size. Merge the occurrence times of each perspective to generate time window records, and output them together with the population size.
[0027] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for livestock identification and health early warning based on multi-feature fusion, characterized in that, Includes the following steps: The target area video image is acquired, preprocessed with adaptive illumination correction and background suppression, and then input into a shared feature extraction network. After synchronous decoupling through a parallel detection branch, the whole body and head detection boxes and confidence scores are output. Based on the confidence level and temporal spatial constraints, cross-frame trajectory association is performed, and trajectory identity numbers are dynamically allocated and maintained. The detection area corresponding to the trajectory identity number is input into the individual recognition model to extract facial micro-texture, ear shape, angular structure and body contour features. After multimodal feature alignment and similarity calculation, the identity recognition result is output, and the appearance feature template is fed back to the cross-frame trajectory association to update the matching weight. Based on the identity recognition results, historical health baselines are retrieved, and baseline deviation detection is performed by accumulating temporal behavioral parameters and visual state features. The health level is determined based on the degree of deviation and an early warning is triggered. The number of duplicate groups from multiple perspectives is output simultaneously.
2. The method according to claim 1, characterized in that, The specific process of the input shared feature extraction network is as follows: The preprocessed video images are fed into the network frame by frame. Multi-layer convolutional downsampling is used. The bottom layer extracts the edge direction, corner distribution and texture primitives of the bottom visual features. The middle layer combines the bottom features to form the secondary semantic responses of ear contour, corner base and body surface patches. The top layer gathers context information through the global receptive field to generate a high-level semantic feature map. The high-level semantic feature map retains spatial resolution and channel depth, serving as the input basis for the parallel detection branch.
3. The method according to claim 1, characterized in that, The specific process of synchronously decoupling and outputting the whole-body and head detection bounding boxes and confidence scores through parallel detection branches is as follows: The system connects the whole-body and head detection branches in parallel. Each branch contains independent classification and regression subnetworks. The whole-body branch predicts the bounding box parameters and target confidence of the entire torso, while the head branch predicts the bounding box parameters and target confidence of the head region. Both the full-body branch and the head branch regression subnetworks output the horizontal and vertical coordinates of the bounding box center, as well as the width and height. The classification and regression subnetworks do not interfere with each other and output the full-body and head detection boxes simultaneously.
4. The method according to claim 1, characterized in that, The specific process of performing cross-frame trajectory association is as follows: The processing priority of the current frame detection box is determined based on the confidence level and the preset first-level confidence threshold and second-level confidence threshold; Extract the coordinates and appearance feature vectors of the detection boxes that exceed the first-level confidence threshold, calculate the overlap ratio and cosine distance with the active trajectory prediction position and cumulative appearance template, merge them into a comprehensive matching score, and construct a cost matrix to solve the association scheme. Detection boxes with confidence between the first-level and second-level confidence thresholds are temporarily stored in the cache.
5. The method according to claim 1, characterized in that, The specific processing procedure of the individual identification model is as follows: The head region and the whole body region are obtained by cropping the detection area corresponding to the assigned trajectory number. The facial micro-texture features of the periorbital texture and the surface texture of the nose mirror are extracted by the facial branch. The ear length-to-width ratio and the ear tip pointing angle are extracted by the ear branch. The body proportion and back line curvature body contour features are extracted by the body posture branch. Each branch is mapped to a fixed-length feature sub-vector through an independent encoding network, and then concatenated into a multimodal fusion feature vector through a fusion layer.
6. The method according to claim 1, characterized in that, The specific process for outputting the identity recognition result is as follows: The multimodal fusion feature vector output by the individual recognition model is compressed into an identity embedding vector through a fully connected mapping network. The identity output layer calculates the cosine similarity between the identity embedding vector and the embedding vectors of each registered identity template in the identity template library. The identity template with the highest cosine similarity value is selected as the candidate identity. When the maximum cosine similarity exceeds the preset identity confirmation threshold, the individual identity information corresponding to the candidate identity is output.
7. The method according to claim 1, characterized in that, The specific process of feeding back the appearance feature template to the cross-frame trajectory association update matching weight is as follows: When outputting the identity recognition result, the identity embedding vector extracted from the detection area of the current frame is used as the latest appearance feature sample, and a weighted rolling update is performed on the historical appearance feature templates accumulated with the same trajectory number. After the update, the cross-frame trajectory association module replaces the original appearance matching template. The trajectory association of the next frame uses the updated template to calculate the feature cosine distance. The weighting coefficient of appearance similarity in the comprehensive matching score is dynamically adjusted according to the number of consecutive successful trajectory association frames.
8. The method according to claim 1, characterized in that, The specific process for baseline deviation detection is as follows: The time series of cumulative behavioral parameters for identified livestock includes body displacement distance, percentage of lying down time, cumulative time of head being below the trunk line, mean respiratory amplitude reflected by the rate of change of the detection frame area, and normalized distance between the target center point and the group center point. The statistical mean and standard deviation of each parameter within a continuous historical time window preceding the current moment are stored in the individual's health profile as historical health baselines. The difference between the measured parameter values and the baseline mean is divided by the standard deviation to obtain the baseline deviation of each behavioral parameter.
9. The method according to claim 1, characterized in that, The specific process of synchronously outputting the number of duplicate groups from multiple perspectives is as follows: For multi-view independent target detection and cross-frame trajectory association, obtain the set of active trajectory IDs for each view, and calculate the overlap of trajectories in the overlapping areas of the field of view between pairs of views; If the same trajectory number appears in multiple viewpoints and the overlap exceeds the viewpoint overlap threshold, it is determined to be the same target. The total number of non-repeating trajectory numbers from all viewpoints is counted as the population size. The earliest and latest occurrence times under each viewpoint are merged to generate a complete cross-viewpoint activity time window record, which is output together with the population size.
10. A livestock identification and health early warning system based on multi-feature visual analysis, characterized in that, include: Detection unit: acquires video images of the target area, performs adaptive illumination correction and background suppression preprocessing, inputs them into a shared feature extraction network, and outputs full-body and head detection boxes and confidence scores through parallel detection branches for synchronous decoupling; Tracking unit: Based on the confidence level and temporal spatial constraints, it performs cross-frame trajectory association, dynamically allocates and maintains trajectory identification numbers; Recognition Unit: Inputs the detection area corresponding to the trajectory identity number into the individual recognition model, extracts facial micro-texture, ear shape, angular structure and body contour features, outputs the identity recognition result after multimodal feature alignment and similarity calculation, and feeds back the appearance feature template to the cross-frame trajectory association update matching weight; Early warning unit: Based on the identity recognition result, retrieve the historical health baseline, and perform baseline deviation detection by accumulating time-series behavioral parameters and visual state features; The health level is determined based on the degree of deviation and an early warning is triggered. The number of duplicate groups from multiple perspectives is output simultaneously.
