Chicken death discrimination method based on dual-spectrum image target matching and multi-dimensional anomaly detection
Through dual-spectral image fusion technology, combined with deformation convolution and UNet structure, efficient and accurate detection of dead chickens in chicken houses is achieved, solving the problems of low detection efficiency and missed detection in the existing technology, and improving the management level and economic benefits of the breeding farm.
Patent Information
- Application Number
- CN202510448111.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-07-29
AI Technical Summary
The prior art is difficult to detect dead chickens quickly and accurately in chicken houses, resulting in the spread of epidemics and economic losses, manual detection efficiency is low and a single sensor cannot comprehensively evaluate the health status of chickens.
Using a method based on dual-spectral image target matching and multi-dimensional anomaly detection, the characteristics of key parts of the chicken body are extracted through the fusion of visible light and infrared images, combining deformation convolution and UNet structure, abnormalities are judged in pixel height, spatial relationship and temperature distribution, and a death judgment model is generated and an alarm is triggered.
It has achieved efficient and accurate detection of death chickens, improved the management level of farms, reduced the risk of epidemic transmission, improved economic benefits, and maintained high detection accuracy under complex lighting conditions.
Smart Images

Figure CN120388393A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of intelligent detection in breeding, and particularly relates to a method for discriminating chicken death based on dual-spectrum image target matching and multi-dimensional anomaly detection. Background Art
[0002] In modern livestock and poultry breeding, the health status of chickens directly affects breeding efficiency, economic benefits, and food safety. Due to the complex chicken coop environment, high chicken population density, and the difficulty of detecting health problems, dead chickens are often not discovered and processed in a timely manner, which is likely to cause the spread of diseases and result in serious economic losses. How to quickly and accurately detect dead chickens has become an important challenge in breeding management.
[0003] Currently, farms generally use manual detection or single-device monitoring to identify dead chickens, but these traditional methods have obvious limitations. Manual inspections require a large amount of time and manpower, especially in large-scale farms, where the efficiency is low and it is easily affected by fatigue and lighting conditions, resulting in frequent missed detections and false detections. A single sensor (such as a temperature sensor or an infrared camera) can only capture limited feature information, such as temperature anomalies or changes in individual contours, and cannot comprehensively evaluate the health status of chickens. Existing image processing technologies still have deficiencies in accurately identifying the key parts of chickens (such as the head, torso, legs, etc.) and their spatial position relationships, and it is difficult to meet the detection requirements in complex scenarios.
[0004] To address the above needs, the present invention proposes a method for discriminating chicken death based on dual-spectrum image target matching and multi-dimensional anomaly detection, achieving efficient and accurate detection of dead chickens. Summary of the Invention
[0005] Aiming at the above deficiencies of the existing technology, the purpose of the present invention is to provide a method for discriminating chicken death based on dual-spectrum image target matching and multi-dimensional anomaly detection.
[0006] A method for discriminating chicken death based on dual-spectrum image target matching and multi-dimensional anomaly detection includes the following steps:
[0007] Step 1, model establishment:
[0008] Obtain visible light images and infrared images of chickens.
[0009] Preprocess the visible light images and infrared images to enhance the image quality and repair damaged areas.
[0010] Dynamically adjust the sampling positions through deformable convolution, and combine the dynamic multi-scale attention mechanism and the feature pyramid network to extract the key part features of the chicken body.
[0011] Encode, decode, and perform skip connections on the fused features through the UNet structure to generate a model for death discrimination.
[0012] Step 2, Target Matching and Multidimensional Anomaly Detection:
[0013] Perform target matching, and then make an anomaly judgment based on pixel height, spatial relationship, and infrared temperature distribution. Among them, the pixel height threshold is dynamically adjusted according to the age in days, the spatial relationship anomaly is determined based on the relative positions of the torso, head, legs, and toes, and the temperature anomaly is predicted through gray-scale - temperature mapping;
[0014] Step 3, Identification and Judgment:
[0015] Receive the result of the anomaly judgment and calculate the influence of the model itself and the image quality on the model calculation;
[0016] Calculate the comprehensive probability of death. If it is greater than the threshold, the identified object is judged to be dead;
[0017] If it is judged to be dead, trigger an alarm and generate an anomaly report containing the basis and probability of death.
[0018] Furthermore, in the step of obtaining the visible light image and infrared image of the chicken, the visible light image is used to extract morphological features, and the infrared image is used to extract temperature distribution features;
[0019] The shooting distance between the dual-spectrum camera and the dead chicken is maintained within the range of 0.3 meters to 1.0 meters. The dual-spectrum camera forms a 45° angle with the horizontal direction, and various lighting conditions are covered during shooting, including natural light, artificial light sources, and low-light environments;
[0020] In the step of preprocessing the visible light image and infrared image, operations of generative adversarial network enhancement and multi-scale adaptive data enhancement are adopted to process the visible light image and infrared image respectively, improve the image quality, enhance image details, and avoid image distortion.
[0021] Furthermore, in the way of extracting key part features from the preprocessed visible light image, the LabelImg annotation tool is used to annotate the preprocessed visible light image of the dead chicken, annotating the overall frame and the marking frame,
[0022] The overall frame is used to tightly enclose the chicken's body to ensure that the overall contour of the abnormal chicken can be recognized during detection;
[0023] The marking frame is used to mark the head, torso, legs, and toes of the chicken. The marking frames of the head, torso, legs, and toes are all within the overall frame of the chicken's body;
[0024] The visible light image is divided into a central sampling area and an edge sampling area, and the sampling position is dynamically adjusted through deformable convolution to generate a feature map. The deformable convolution formula is as follows,
[0025]
[0026] is the convolution result,
[0027] are the deformed sampling points,
[0028] is the spatial offset of the convolution kernel, which is adaptively adjusted according to the image content,
[0029] Adopt multi-scale convolution kernels to extract low-level, intermediate-level, and high-level features, weight the features of key parts through a dynamic multi-scale attention mechanism, and use a feature pyramid network to fuse multi-layer features;
[0030] At the same time, combine local gradient information and global context information to dynamically adjust the weights of features at different scales.
[0031] Furthermore, in model establishment, encode, decode, and perform skip connections on the fused features through the UNet structure to generate a preliminary result for chicken death discrimination; adopt a multi-task learning framework to jointly optimize the bounding box regression, classification, and feature preservation tasks, and combine knowledge distillation technology to prevent overfitting; process the input image to generate bounding boxes and classification results for different parts.
[0032] Furthermore, perform target matching on the preprocessed visible light image, identify the key parts of the chicken through spatial matching and temporal matching, including the head, torso, legs, and claws, and calculate a comprehensive similarity metric to determine part attribution;
[0033] In multi-dimensional anomaly detection, calculate the set of pixel longitudinal heights of all chicken body targets , where n is the number of targets in the image, and calculate the mean height and the standard deviation ; According to the relative deviation of the pixel height of the target from the mean height, if the pixel height is less than the threshold, it is judged as pixel height anomaly, and the threshold The formula is:
[0034]
[0035]
[0036] is the dynamic adjustment coefficient, which controls the tightness of the threshold,
[0037] is the reference adjustment coefficient, a constant set according to experience,
[0038] is the weight of the adjustment coefficient, which is used to control the influence of the age on the threshold,
[0039] is the target age, serving as an indicator to measure the target growth stage.
[0040] Furthermore, the determination steps for the abnormal spatial relationship of body parts within the target overall frame are as follows:
[0041] Determine the spatial relationship among the torso, legs, and toenails: For each target, calculate the central point coordinates of its legs and the central point coordinates of the torso , as well as the central point coordinates of the toenails ;
[0042] Calculate the angle between the line segment connecting the central point coordinates of the toenails and the central point coordinates of the legs and the horizontal , and the calculation formula is as follows:
[0043] ;
[0044] The determination method for abnormal spatial relationship is that any one of the following determinations can be used to determine abnormality.
[0045] a. If the angle is less than 30°, then it is determined that the spatial relationship between the torso and the feet is abnormal;
[0046] b. If the central point coordinates of the head frame are lower than the central point coordinates of the torso frame , then it is determined that the spatial position relationship between the torso and the head is abnormal;
[0047] c. If the central point coordinates of the head frame are lower than the central point coordinates of the torso frame and the angle between the line segment connecting the central point coordinates of the toenails and the central point coordinates of the legs and the horizontal is less than 30°, then it is determined that the spatial position relationship among the torso, head, and toenails is abnormal.
[0048] Furthermore, calculate the gray - scale mean of the target area of the infrared image, predict the temperature through a linear regression model, and if the predicted temperature is less than the preset threshold, then it is determined that the temperature is abnormal.
[0049] Furthermore, calculate the brightness L and edge intensity S of the image, and compare them with the predetermined standard threshold.
[0050] If the brightness or edge intensity is less than the standard threshold, then reduce the weight of the data corresponding to this image.
[0051] Furthermore, the comprehensive death probability P is a comprehensive index, which is calculated by weighted calculation based on detection confidence, spatial relationship, temperature, image brightness, edge intensity, and pixel height. The formula is as follows:
[0052]
[0053] It represents the confidence of the overall frame of the dead chicken, indicating the degree of trust of the model in the death determination result.
[0054] It is a boolean value of the pixel height relationship. If the height relationship is abnormal, it is 1; otherwise, it is 0.
[0055] It is a boolean value of the spatial relationship. If the spatial relationship for the chicken's death is satisfied, it is 1; otherwise, it is 0.
[0056] It is a boolean value of the temperature. If the temperature is abnormal, it is 1; otherwise, it is 0.
[0057] It is the brightness parameter, which is the ratio of the image brightness to the set threshold of the ratio,
[0058] It is the edge strength parameter, which is the ratio of the edge strength to the set threshold of the ratio,
[0059] It is the weight set according to experience.
[0060] It is the brightness weight and the edge strength weight. If the brightness or the edge strength is less than the standard threshold, the weight of the data corresponding to this image is reduced.
[0061] If the comprehensive death probability P is greater than the set threshold, it is determined as dead.
[0062] The death event is quickly transmitted to the breeding personnel through the way of alarm sound and pushing notifications on the early warning platform to ensure a quick response.
[0063] Furthermore, is 0.25, is 0.15, is 0.15, is 0.25,
[0064] is 0.1, is 0.1
[0065] When the brightness or the edge strength is less than the standard threshold, update and The formulas are as follows:
[0066]
[0067]
[0068] For the reduced weight,
[0069] is the reduced weight.
[0070] Compared with the prior art, the beneficial effects of the technical solution provided by this application.
[0071] By integrating multi-modal data analysis technology, extracting and processing the features of visible light images and infrared images, and combining matching algorithms and anomaly detection mechanisms, efficient and accurate detection of dead chickens is achieved. This system will significantly improve the management level of farms, reduce the risk of disease transmission, increase economic benefits, and provide a reliable intelligent solution for modern livestock and poultry breeding.
[0072] Accurate target recognition and matching can locate the key parts of chickens and analyze their spatial relationships; efficient anomaly detection evaluates pixel height distribution, temperature fluctuations, and other abnormal features through algorithms; real-time and reliability enable rapid alarm and generation of anomaly reports; and good environmental adaptability maintains high detection accuracy under complex lighting conditions. These functions can not only improve detection efficiency but also effectively reduce the risk of diseases. BRIEF DESCRIPTION OF THE DRAWINGS
[0073] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings based on these drawings without creative efforts.
[0074] Among them:
[0075] Figure 1 is the flow chart of the chicken death discrimination method based on dual-spectrum image target matching and multi-dimensional anomaly detection;
[0076] Figure 2 is the flow chart of key part target matching. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0077] To enable those skilled in the art to better understand the technical solutions in this application, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of this application.
[0078] With the development of artificial intelligence and computer vision technologies, multi-modal fusion detection methods provide a basic condition for solving the existing problems. This application combines the feature extraction and analysis of visible light images and infrared images, comprehensively utilizes the temperature distribution feature and appearance feature, and improves the accuracy and efficiency of detection. Infrared images can capture temperature anomalies in the chicken coop, while visible light images are used to identify the key parts of chickens. The fusion of the two significantly enhances the applicability of the detection system.
[0079] To meet the requirements of modern farms, an intelligent dead chicken detection system needs to have the following capabilities: accurate target recognition and matching, which can locate the key parts of chickens and analyze their spatial relationships; efficient anomaly detection, which evaluates pixel height distribution, temperature fluctuations, and other anomaly features through intelligent algorithms; real-time performance and reliability, which can achieve rapid alarm and generate anomaly reports; and good environmental adaptability, maintaining a high detection accuracy rate under complex lighting conditions. These functions can not only improve the detection efficiency but also effectively reduce the disease risk.
[0080] Figure 1 Shows the flow chart of a chicken death discrimination method based on dual-spectrum image target matching and multi-dimensional anomaly detection.
[0081] Figure 2 Shows the flow chart of key part target matching.
[0082] The following will elaborate on the specific method steps in detail.
[0083] The present invention proposes a chicken death discrimination method based on dual-spectrum image target matching and multi-dimensional anomaly detection.
[0084] S1. First, adopt a data acquisition module composed of 6 components: a dual-spectrum camera, a switch, a computer, a power system, a small speaker, and a mobile hard disk. Among them, the dual-spectrum camera is the core device, which is used to collect visible light and infrared images simultaneously; the switch is responsible for data transmission and network connection between devices, ensuring real-time data transmission and image processing; the computer is used for data storage, processing, and display; the power system ensures the continuous operation of each device; the small speaker is used to drive away live chickens, making dead chickens more likely to be exposed in the camera's field of view; the mobile hard disk is used for backing up and storing a large amount of image data to ensure that the data is not lost and is convenient for later analysis.
[0085] During the acquisition process, the data of dead chickens aged 15 to 40 days are used as the acquisition object. The shooting distance between the dual-spectrum camera and the dead chickens is maintained within the range of 0.3 meters to 1.0 meters to ensure the clarity of the images and the capture of details. The dual-spectrum camera forms a 45° angle with the horizontal direction to ensure that all angles of the chickens can be comprehensively captured, avoiding incomplete images that can only be captured from the front or side. This angle helps to obtain comprehensive visual data for subsequent analysis of the posture and behavior of the chickens. When shooting, various lighting conditions are covered, including natural light, artificial light sources, and low-light environments. The resolution of the visible light video stream collected is 1080p, the frame rate is 60fps, the visible light images have a resolution of 1440×1080 pixels, and the resolution of the infrared images is 160×120 pixels. This step provides high-quality raw data for subsequent data preprocessing, feature extraction, and discrimination.
[0086] S2. After the data acquisition is completed, to address issues such as image noise, defects, and lighting changes, the collected visible light images and infrared images are subjected to image restoration and adaptive enhancement processing. This includes:
[0087] Generative adversarial network enhancement: First, the collected images are preliminarily screened to eliminate images with too low quality, noise, blur, or partial damage. Then, a generative adversarial network (GAN) is used to construct a generator and a discriminator. Finally, after restoration by the generative adversarial network, the image details are enhanced, especially the damaged or missing parts are restored, improving the quality of the images.
[0088] Multi-scale adaptive data enhancement: For infrared images, adaptive conditional histogram equalization (AHE) is used to perform local equalization and dynamic adjustment on the images to enhance the local contrast of the images; for visible light images, a noise injection method based on deep reinforcement learning is used. By simulating different environmental noises, the robustness of the model to noise is improved, and histogram equalization is performed on local regions to eliminate local brightness differences.
[0089] Through the above preprocessing, not only are the damaged areas in the images repaired, but also subsequent image annotation and feature extraction are based on high-quality data.
[0090] Histogram equalization is performed on local regions of the images to enhance image details and avoid over-enhancement. The specific process is as follows: First, the input visible light image is divided into multiple local regions, then the histogram is calculated and equalized for each local region separately, and finally, through global threshold adjustment, the brightness differences between local regions are eliminated. Local region equalization formula:
[0091] ;
[0092] Wherein:
[0093] is the equalization result of the local area;
[0094] is the pixel value of the original image;
[0095] and are the mean and standard deviation of the local area.
[0096] The noise injection method based on deep reinforcement learning specifically includes the following steps: First, use the deep reinforcement learning model to generate synthetic noise, and then inject the noise into the training image to perturb the texture and brightness of the image to simulate different noise types in the actual shooting process. The model optimization formula:
[0097] ;
[0098] Wherein:
[0099] : the image after noise injection;
[0100] : the original image;
[0101] : the reward function based on the current state and action.
[0102] S3. The preprocessed high-quality visible light images are labeled using the LabelImg annotation tool for the key parts (head, torso, legs, and claws) of the chickens in each image. All the marked boxes are nested within an overall chicken body box and tightly enclose all the key parts as much as possible. The annotation information generated in this step provides accurate supervision information for subsequent object segmentation, part matching, and dead state discrimination.
[0103] S4. To improve the accuracy of chicken body part detection, based on the annotated images, the input visible light images are divided into two regions: the central sampling area C (mainly capturing the overall contour and key parts of the chicken body) and the edge sampling area B (obtaining detailed edge information). To overcome the problem of fixed sampling positions in traditional convolutions, the deformable convolution mechanism is introduced. This method calculates the spatial offset of each convolution kernel sampling point (output by the convolutional layer and continuously optimized through backpropagation) to make the sampling points adapt to the changes in the image content, thereby more accurately capturing the edge details of the chicken body. In the deformable convolution formula, by adjusting the coordinates, the dynamic adjustment of the sampling position is achieved, enabling subsequent feature extraction to better adapt to the morphological changes of chickens in different postures and angles.
[0104] The deformable convolution formula:
[0105] ;
[0106] Where:
[0107] is the convolution result,
[0108] are the deformed sampling points;
[0109] is the spatial offset of the convolution kernel, which is adaptively adjusted according to the image content.
[0110] Each spatial offset is usually generated by a convolutional layer, and the input of the convolutional layer is the current feature map. During the training process, the convolutional layer will optimize these offsets through backpropagation. The offset is usually predicted as two values: the horizontal and vertical offsets:
[0111]
[0112] Where, and are the offsets along and axes respectively, which define the offset of each sampling point relative to the standard position.
[0113] S5. On the basis of deformable convolution, a multi-scale convolutional kernel is further used to perform convolution operations on the preprocessed image, and low-level (edges, textures), intermediate-level (structures, morphologies), and high-level (global semantics) features are extracted respectively. To solve the problem of different importance of features at different scales, a dynamic multi-scale attention mechanism is introduced. By introducing a weight matrix for each layer of feature map, the weights of features at each scale are dynamically adjusted according to local gradient changes and context information, and the learnable parameters and bias are optimized during backpropagation. Then, FPN is used to perform weighted fusion on low-level and high-level features to form a unified feature map, providing comprehensive and detailed multi-scale feature support for the decoding and reconstruction of the subsequent UNet structure.
[0114] The above-mentioned adaptive adjustment of attention weights is to calculate the loss function and apply the gradient descent method to update the weights and biases during each round of training. The formulas for updating and by gradient descent are:
[0115]
[0116]
[0117] Among them, is the learning rate, and are the gradients of the loss function with respect to the weights and biases, respectively.
[0118] S6. Based on the multi-scale feature fusion result, use the UNet structure to further extract and reconstruct the image features:
[0119] Encoder part: Composed of multiple layers of convolution and pooling, gradually reducing the dimension and extracting low-level features such as edges, corners, and textures in the image, while retaining some mid-level and high-level semantic information;
[0120] Decoder part: Gradually restore the spatial resolution of the image through upsampling, and combine the features at the corresponding levels in the encoder (using the skip connection mechanism) to achieve feature fusion, ensuring that the detailed information is not lost.
[0121] The skip connections between the encoder and the decoder enable each layer of low-resolution features to be effectively combined with the corresponding high-resolution details, providing a strong guarantee for the accuracy of death discrimination.
[0122] The said skip connection is crucial for maintaining the precise details of the key parts of the chicken. The formula of the skip connection is as follows:
[0123]
[0124] is the final output feature,
[0125] is the feature after convolution operation.
[0126] S7. To enable the model to accurately regress the bounding boxes of the key parts of the chicken body, correctly classify the death state, and maintain the key information at the same time, a multi-task learning framework is adopted. Among them:
[0127] (1) Conduct bounding box regression (using mean squared error loss), classification (using cross-entropy loss), and feature preservation tasks;
[0128] (2) Use the loss function weighting mechanism to dynamically adjust the losses of each task. If a certain task performs poorly, appropriately increase its loss weight;
[0129] (3) Introduce the knowledge distillation technology to transfer the key information of the pre-trained model to the current model, further prevent overfitting, and improve the overall generalization ability.
[0130] The joint training of each task enables the system to achieve high accuracy in both regression and classification, and realizes a robust improvement in overall performance through the dynamic adjustment of the loss function.
[0131] The formula of the loss function: combining the losses of each task, expressed as:
[0132]
[0133] Among them, is the bounding box regression loss, is the classification loss, is the feature preservation loss, are the loss weighting coefficients of these tasks respectively.
[0134] S8. After obtaining accurate local detection in multi-task learning, to ensure the correct matching between different parts (trunk, head, legs, claws) within the same chicken body, this embodiment adopts an object matching method, which includes the following steps:
[0135] (1) Spatial matching: For each detected trunk box , calculate the Euclidean distance between its center and the centers of all head boxes and leg boxes . By selecting the matching object with the closest distance and within the same overall box, the spatial association of each part is initially completed;
[0136] (2) Temporal matching: Further analyze the movement trajectories of the same chicken body within consecutive time . The optical flow method is used to calculate the trajectories of the trunk, head, and legs , and Similarly, the dynamic time warping (DTW) algorithm is used to measure the similarity between trajectories, effectively solving the problem of mis-matching caused by short-term occlusion or pose changes;
[0137] (3) Comprehensive similarity metric: Combining spatial matching (Euclidean distance) and temporal matching (DTW distance), the weighted Euclidean distance formula is adopted:
[0138]
[0139] : Comprehensive similarity metric; : Weight coefficient, adjusted according to actual applications. : Spatial Euclidean distance, used to measure the spatial positions of the head, body, legs, and claws of the chicken; Dynamic time warping distance between the body and the head, used to measure the dynamic changes between time series; Dynamic time warping distance between the body and the legs; The Euclidean distance in the time dimension is used to detect whether there are continuous abnormal behaviors of chickens in the time series.
[0140] According to this comprehensive metric value, and a preset threshold are compared. If , it is considered that the matching of each part is correct, and then further death discrimination is carried out. Otherwise, this matching is excluded. Spatial matching provides a preliminary screening for temporal matching, while temporal matching corrects the errors caused by local occlusion or instantaneous pose changes. The two complement each other to ensure the accuracy of the subsequent abnormal discrimination basis.
[0141] S9. After ensuring the correct matching of the key parts of the same chicken body, for all chicken bodies detected in each visible light image, calculate the longitudinal pixel height of its overall contour (i.e., the longitudinal size of the chicken body in the image). Let the number of chicken bodies in the image be n, then the set of pixel heights of all chicken bodies is expressed as:
[0142]
[0143] is the pixel height of the th chicken. And based on this, calculate the mean value and the standard deviation . This statistical result provides a quantitative basis for subsequent anomaly detection based on pixel height.
[0144] Based on the statistically obtained mean value and the standard deviation , and combined with the chicken age factor, dynamically set the threshold (introduce an adjustment coefficient , and automatically compress the threshold range as the age changes). For each chicken body, if its pixel height is less than , it is initially determined that the pixel height is abnormal. The formula is:
[0145]
[0146]
[0147] is the dynamic adjustment coefficient, which controls the tightness of the threshold,
[0148] is the reference adjustment coefficient, a constant set according to experience,
[0149] is the weight of the adjustment coefficient, which is used to control the influence of age on the threshold,
[0150] is the target age, serving as an indicator to measure the target growth stage.
[0151] This step makes full use of the phenomenon that after the chicken dies, the muscle relaxes and the pixel height significantly decreases due to the chicken body lying flat.
[0152] The standard deviation of the set of pixel heights Formula:
[0153]
[0154] S10. In addition to the pixel height, abnormal judgment is also carried out through the spatial relationship of each key part inside the chicken body:
[0155] (1) Relationship between the trunk, legs and claws: In the normal state, the chicken legs are vertical or the line connecting the claws and the center of the legs is close to perpendicular to the horizontal plane; while in the dead chicken, due to lying on its side, its legs tend to be oblique, and the included angle between the line connecting the claws and the legs is less than 30°; Through the center point coordinates of the legs and the center point coordinates of the trunk , as well as the center point coordinates of the claws , calculate the angle between the line connecting the center point coordinates of the claws and the center point coordinates of the legs and the horizontal:
[0156]
[0157] If this angle is less than 30°, it is determined that the spatial relationship between the trunk and the feet is abnormal.
[0158] (2) Relationship between the trunk and the head: The head of a normal chicken is usually higher than the center of the trunk, but after death, the head may be inverted, making the center of the head lower than the center of the trunk; The vertical coordinate of the center of the head frame is lower than the vertical coordinate of the center point of the trunk frame, then it is determined that the spatial relationship between the trunk and the head is abnormal.
[0159] (3) Comprehensive relationship of multiple parts: When both the head is lower than the center of the trunk and the included angle between the line connecting the claws and the legs is less than 30° are satisfied, it can better indicate that the comprehensive spatial relationship of multiple parts of the chicken body is in an abnormal state.
[0160] If any of the above situations is satisfied, it is determined that the chicken body has an abnormal spatial relationship.
[0161] S11. Using the temperature information collected in the infrared image, to supplement the morphological abnormality detection, a group of infrared images with known temperatures is selected. In each image, according to the true temperature of the temperature sensor and the gray value of the target area of the image for preprocessing, and the average gray value of this area is extracted . Since the grayscale value has a linear relationship with the actual temperature, a linear regression model is introduced:
[0162]
[0163] where is the temperature predicted based on the grayscale value, is the grayscale value of this area, and are the coefficients of the linear regression model, representing the slope and intercept respectively.
[0164] By comparing the predicted temperature with the actual measured temperature , the error loss function is calculated:
[0165]
[0166] Using the gradient descent method, according to the gradients of the loss function with respect to the parameters a and b, iterate and update:
[0167]
[0168]
[0169] Until the loss function converges, thus realizing the dynamic self-calibration of the grayscale-temperature mapping relationship.
[0170] Using the optimized linear model, calculate the grayscale average of each target chicken body area and predict the temperature . Set the temperature threshold . When , it is considered that there is an abnormal temperature in this chicken body, indicating a decrease in body temperature or loss of vital signs, and thus further determined as an abnormal temperature death.
[0171] S12. To prevent misjudgment caused by low-light or blurred images, perform image quality detection on each frame of the image:
[0172] Brightness calculation: Calculate the average value of the grayscale values of all pixels in the image ;
[0173] Edge intensity calculation: Use the Sobel operator to perform convolution operation on the image to obtain the edge intensity ; Compare with the predetermined brightness threshold , with the predetermined edge sharpness threshold . If or , then reduce the weight of this frame of data or , avoid interference from low-quality images in death discrimination.
[0174] S13. After completing morphological detection, temperature anomaly discrimination, and image quality assessment, the system calculates the probability of death by comprehensively considering the following factors :
[0175]
[0176] is the confidence of the overall bounding box of the dead chicken, representing the confidence of the model in the death determination result.
[0177] is the boolean value of the pixel height relationship. If the height relationship is abnormal, it is 1; otherwise, it is 0.
[0178] is the boolean value of the spatial relationship. If the spatial relationship for chicken death is satisfied, it is 1; otherwise, it is 0.
[0179] is the boolean value of temperature. If the temperature is abnormal, it is 1; otherwise, it is 0.
[0180] is the brightness parameter, which is the ratio of the image brightness to the set threshold of.
[0181] is the edge intensity parameter, which is the ratio of the edge intensity to the set threshold of.
[0182] is the weight set according to experience. Here, a basic weight selection is given: = 0.25, = 0.15, = 0.15, = 0.25,
[0183] are the brightness weight and the edge intensity weight. Here, a basic weight selection is given: = 0.1, = 0.1. If the brightness or edge intensity is less than the standard threshold, the weight corresponding to the image data is reduced. The weight reduction formula is as follows:
[0184]
[0185]
[0186] is the reduced weight.
[0187] For the reduced weight,
[0188] finally compare with the preset death discrimination threshold and if it is determined that the chicken is dead, otherwise it is determined as non-dead;
[0189] The above and The sum of the basic weights of the six weights is 1.
[0190] S14. When the comprehensive death probability exceeds the threshold the system automatically triggers an alarm mechanism. The alarm methods can include sound alarms, platform push notifications, and SMS notifications, etc., to ensure that abnormal events can be promptly reported to the breeding personnel. In addition, the system automatically generates an abnormal report, including the chicken body number, the basis for death determination (pixel height, spatial relationship, temperature, image quality, etc.), the comprehensive death probability value , the alarm trigger time, and the detailed alarm information, which are convenient for subsequent on-site processing and data archiving.
[0191] Example 1:
[0192] This embodiment provides a target matching method, including using the preprocessed visible light image to accurately locate the key parts (head, torso, legs, and claws) inside the chicken body through a model, and generating the bounding boxes and center coordinates of each part.
[0193] For each detection target, use the optical flow method to extract the motion trajectories of the head, torso, and legs in consecutive video frames respectively.
[0194] For any two candidate matching targets, calculate the Euclidean distance between the corresponding center points of their key parts in a single-frame image. This distance reflects the similarity of the two targets in spatial position and is an important basis for preliminary screening. To make up for the deficiencies of single-frame spatial matching in terms of short-term occlusion and local errors, the dynamic time warping (DTW) algorithm is used to align the motion trajectories of the key parts of each target.
[0195] Calculate the DTW distances between the torso trajectory and the head trajectory, and between the torso trajectory and the leg trajectory respectively. The DTW algorithm can flexibly align time-series data, eliminate the time-series deviation caused by occlusion or instantaneous posture changes, and provide a more robust matching metric.
[0196] Fuse the Euclidean distance of spatial matching and the DTW distance of time-series matching according to the preset weights to construct the comprehensive similarity of target matching , if is less than the threshold , it is determined that the matching of different key parts of the same target is correct; otherwise, the matching result is rejected.
[0197] Embodiment 2:
[0198] This embodiment provides a multi-dimensional anomaly detection method, including determination of pixel height anomaly: after a chicken dies, its muscles lose tension, and the chicken body lies completely flat or limp on the ground. Observing the chickens in the chicken coop at a 45° angle, the overall longitudinal height of the dead chickens is significantly lower than that of the normal chickens. The longitudinal pixel distance of the overall contour of the chicken is extracted through image processing and denoted as . If there are n chickens in an image, then n overall chicken frames will be detected, where is the average pixel height of the n overall chicken frames. The daily age dynamic adjustment coefficient is introduced, and by statistically calculating the average pixel height and the standard deviation of the chicken flock, an adaptive threshold is generated. The traditional method uses a fixed height threshold and cannot adapt to the body size changes of chickens during rapid growth (the weight difference from 15 to 40 days old can reach 5 times). In this solution, the threshold range is dynamically compressed by the daily age coefficient k (for example, at 40 days old = 2.0, the threshold is reduced to × 0.8), and the determination of the lying posture at different growth stages is accurately matched. If is lower than , then it is judged as a death anomaly.
[0199] Determination of spatial relationship anomaly: The visible parts of the chicken in the image are mainly divided into three situations: (1) Trunk, legs and claws: In the normal state of a chicken, the chicken usually presents a standing posture, at this time its legs are vertical, and the angle between the line connecting the claws and the center point of the legs and the horizontal plane is about 90°. Or, the chicken may be in a lying posture, at this time the legs are not visible. In the case of a dead chicken, the chicken body lies horizontally in the chicken coop, and the legs are in an oblique horizontal or horizontal state, so the angle between the line connecting the claws and the center point of the legs and the horizontal plane is less than 30°. (2) Trunk and head: In most cases, the head position of a normal chicken is higher than the center of the trunk, and only in a few cases such as eating or lying posture, the head is basically level with the center of the trunk. However, in the case of a dead chicken lying horizontally, its head will fall to the ground, and due to the relatively wide body, the center point of the trunk will be higher than the center point of the head. (3) Trunk, head, legs and claws: Combining the methods of the above two situations for joint determination, it is necessary to meet both to determine an anomaly. If one of the three situations is encountered to determine a death anomaly.
[0200] Temperature anomaly: Based on the known temperature samples and the infrared gray-scale mean value , the coefficients a and b are dynamically optimized by the gradient descent method to achieve self-calibration of the gray-scale - temperature mapping relationship. Define the brightness index (the overall gray-scale mean value of the image) and the clarity index (Sobel edge intensity mean). Traditional gray-scale to temperature mapping relationships are often based on fixed calibration coefficients, which may lead to a decline in calibration accuracy due to factors such as environmental changes and equipment aging in practical applications. This method dynamically optimizes coefficients a and b through the gradient descent method, can adjust the mapping relationship in real time, thereby improving calibration accuracy, has global convergence, and can avoid falling into local optimal solutions to a certain extent, thus improving the robustness of the system. Define the brightness index and the clarity index , set the thresholds , . When (low light) or (blurry), automatically reduce the weight of the frame data to avoid misjudgment caused by low-quality images.
[0201] Through the deep coupling of pixel height anomaly determination, spatial relationship anomaly determination, infrared temperature prediction and image quality analysis, this solution constructs a death determination system covering three dimensions of morphology - bioheat - data quality. Each technical feature is not simply superimposed, but forms an organic whole through dynamic weight allocation, cross-validation rules, and closed-loop feedback mechanisms, and finally realizes the high-precision, high-robustness, and high-adaptability characteristics of death detection in complex breeding scenarios, solving the long-existing pain points in the breeding industry such as low automation, poor environmental adaptability, and high false omission and detection rates.
[0202] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combinations of these technical features do not conflict, they should be considered as falling within the scope described in this specification.
[0203] The above-described embodiments only represent several implementation manners of the present application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the patent of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A method for discriminating chicken death based on dual-spectrum image target matching and multi-dimensional anomaly detection, characterized in that, It includes the following steps: Step 1, model establishment: Obtain visible light images and infrared images of chickens; Preprocess the visible light images and infrared images to enhance the image quality and repair damaged areas; Dynamically adjust the sampling positions through deformable convolutions, and combine the dynamic multi-scale attention mechanism and the feature pyramid network to extract the key part features of the chicken body; Encode, decode and perform skip connections on the fused features through the UNet structure to generate a model for death discrimination; Step 2, target matching and multi-dimensional anomaly detection: Perform target matching, and then make anomaly judgments based on pixel height, spatial relationship and infrared temperature distribution, where the pixel height threshold is dynamically adjusted by the age, the spatial relationship anomaly is determined based on the relative positions of the trunk, head, legs and claws, and the temperature anomaly is predicted through gray-scale - temperature mapping; Step 3, recognition and determination: Receive the results of the anomaly judgment and calculate the impact of the model itself and the image quality on the model calculation; Calculate the comprehensive death probability. If it is greater than the threshold, the recognized object is judged to be dead; If it is determined to be dead, trigger an alarm and generate an anomaly report containing the basis and probability of death.
2. A method for discriminating chicken death based on dual-spectrum image target matching and multi-dimensional anomaly detection according to claim 1, wherein In the step of obtaining visible light images and infrared images of chickens, the visible light images are used to extract morphological features, and the infrared images are used to extract temperature distribution features; The shooting distance between the dual-spectrum camera and the dead chicken is kept within the range of 0.3 meters to 1.0 meters, and the dual-spectrum camera forms a 45° angle with the horizontal direction. The shooting covers a variety of lighting conditions, including natural light, artificial light sources and low-light environments; In the step of preprocessing the visible light images and infrared images, operations of generative adversarial network enhancement and multi-scale adaptive data enhancement are adopted to process the visible light images and infrared images respectively, improve the image quality, enhance the image details and avoid image distortion.
3. A method for discriminating chicken death based on dual-spectrum image target matching and multi-dimensional anomaly detection according to claim 1, wherein In the way of extracting key part features from the preprocessed visible light images, use the LabelImg annotation tool to annotate the preprocessed visible light images of dead chickens, annotating the overall frame and the marking frame; The overall frame is used to tightly enclose the chicken body to ensure that the overall contour of the abnormal chicken can be recognized during detection; The marking frame is used to mark the head, trunk, legs and claws of the chicken. The marking frames of the head, trunk, legs and claws are all within the overall frame of the chicken body; Divide the visible light image into a central sampling area and an edge sampling area, dynamically adjust the sampling positions through deformable convolutions to generate a feature map. The deformable convolution formula is as follows; is the convolution result, is the sampled point after deformation, is the spatial offset of the convolution kernel, which is adaptively adjusted according to the image content. Adopt multi-scale convolutional kernels to extract low-level, intermediate-level and high-level features, weight the key part features through the dynamic multi-scale attention mechanism, and use the feature pyramid network to fuse multi-layer features; At the same time, combine local gradient information and global context information to dynamically adjust the weights of features at different scales.
4. A method for discriminating chicken death based on dual - spectrum image target matching and multi - dimensional anomaly detection according to claim 1, characterized in that In model establishment, the fused features are encoded, decoded, and skip - connected through a UNet structure to generate a preliminary result for discriminating chicken death; a multi - task learning framework is used to jointly optimize the bounding box regression, classification, and feature preservation tasks, and knowledge distillation technology is combined to prevent overfitting; the input images are processed to generate bounding boxes and classification results for different parts.
5. A method for discriminating chicken death based on dual - spectrum image target matching and multi - dimensional anomaly detection according to claim 1, characterized in that Perform target matching on the pre - processed visible - light image, identify the key parts of the chicken, including the head, torso, legs, and toe claws, through spatial and temporal matching, and calculate the comprehensive similarity metric value to determine the part attribution. In multi-dimensional anomaly detection, calculate the set of pixel longitudinal heights of all chicken body targets , where n is the number of targets in the image, and calculate the mean height and the standard deviation ; According to the relative deviation of the pixel height of the target from the mean height, if the pixel height is less than the threshold, it is judged as pixel height anomaly, and the threshold The formula is: is a dynamic adjustment coefficient to control the tightness of the threshold, is a reference adjustment coefficient, a constant set according to experience, is the weight of the adjustment coefficient, used to control the influence of age on the threshold, is the target age, serving as an indicator for measuring the target growth stage.
6. A method for discriminating chicken death based on dual - spectrum image target matching and multi - dimensional anomaly detection according to claim 5, characterized in that The steps for determining the abnormal spatial relationship of body parts within the overall target box are as follows: Determine the spatial relationship of the torso, legs, and claws: For each target, calculate the coordinates of the center point of its legs and the coordinates of the center point of the torso , as well as the coordinates of the center point of the claws ; Calculate the angle between the line segment connecting the center point coordinates of the toe claw and the center point coordinates of the leg and the horizontal , and the calculation formula is as follows: ; The determination method for abnormal spatial relationship is that if any of the following determinations appears, it can be determined as abnormal. a, if the included angle is less than 30°, it is determined that the spatial relationship between the torso and the feet is abnormal; b, if the center coordinates of the head frame are lower than the center point coordinates of the torso frame , it is determined that the spatial position relationship between the torso and the head is abnormal; c, if the center coordinate of the head frame is lower than the center point coordinate of the torso frame and the included angle between the line segment connecting the center point coordinate of the toe claws and the center point coordinate of the leg and the horizontal is less than 30°, it is determined that the spatial position relationship of the torso, head and toe claws is abnormal.
7. A method for discriminating chicken death based on dual - spectrum image target matching and multi - dimensional anomaly detection according to claim 5, characterized in that Calculate the gray - scale mean of the target area of the infrared image, predict the temperature through a linear regression model, and if the predicted temperature is less than the preset threshold, it is determined as temperature anomaly.
8. A method for discriminating chicken death based on dual - spectrum image target matching and multi - dimensional anomaly detection according to claim 5, characterized in that Calculate the brightness L and edge intensity S of the image and compare them with the predetermined standard threshold. If the brightness or edge intensity is less than the standard threshold, reduce the weight of the data corresponding to the image.
9. A method for discriminating chicken death based on dual - spectrum image target matching and multi - dimensional anomaly detection according to claim 5, characterized in that The comprehensive death probability P is a comprehensive index, calculated by weighted calculation based on detection confidence, spatial relationship, temperature, image brightness, edge intensity, and pixel height. The formula is as follows: It represents the confidence level of the overall frame of a dead chicken, indicating the degree of trust of the model in the death determination result. It is a Boolean value for the pixel height relationship. If the height relationship is abnormal, it is 1; otherwise, it is 0. It is a Boolean value of spatial relationship. If the spatial relationship for chicken death is satisfied, it is 1; otherwise, it is 0. is a temperature boolean value, which is 1 if the temperature is abnormal and 0 otherwise. is the brightness parameter, which is the ratio of the image brightness to the set threshold value of is the edge strength parameter, which is the ratio of the edge strength to the set threshold value of is the weight set according to experience, are the brightness weight and the edge intensity weight. If the brightness or the edge intensity is less than the standard threshold value, the weight of the data corresponding to the image is reduced. If the comprehensive death probability P is greater than the set threshold, it is judged as dead. The death event is quickly transmitted to the breeding personnel by means of alarm sound and pushing notifications through a warning platform to ensure a quick response.
10. A method for discriminating chicken death based on dual - spectrum image target matching and multi - dimensional anomaly detection according to claim 9, characterized in that is 0.25, is 0.15, is 0.15, is 0.25, is 0.1, is 0.1 When the brightness or edge intensity is less than the standard threshold, update and The formulas are as follows: For the reduced weight For The reduced weight.
Citation Information
Cited By
Passport photo and face verification method
CN121010999A