Cage rearing broiler feeding anomaly detection method and system based on graph neural network and computer equipment

By combining multimodal data acquisition with graph neural networks, YOLOv11-DO and ST-GATNet models were constructed to solve the problems of low monitoring accuracy and insufficient adaptive adjustment in caged broiler farming environments. This enabled efficient and accurate detection of abnormal feeding, thereby improving farming efficiency and chicken health.

CN121884451APending Publication Date: 2026-04-17TIANJIN AGRICULTURE COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TIANJIN AGRICULTURE COLLEGE
Filing Date
2026-01-06
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing monitoring systems for caged broiler chicken farming environments are characterized by low accuracy, slow response, and inability to adjust in real time. Traditional target detection technologies have low accuracy in dense occlusion and complex environments, and their reliance on fixed thresholds leads to frequent false alarms and missed alarms, lacking flexible adaptive adjustment capabilities.

Method used

A multimodal data acquisition and graph neural network approach was adopted. By processing image and environmental data, a YOLOv11-DO model was constructed for target detection in broilers. The ST-GATNet model was used for feed intake anomaly probability analysis. Combined with adaptive threshold dynamic adjustment, accurate anomaly detection was achieved.

Benefits of technology

It enables precise monitoring of feeding behavior and environmental parameters of caged broilers, improves breeding efficiency, reduces human intervention, ensures the healthy growth of chickens, and can efficiently identify anomalies in complex environments, reducing false alarms and missed alarms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121884451A_ABST
    Figure CN121884451A_ABST
Patent Text Reader

Abstract

The invention discloses a caged broiler feeding anomaly detection method and system based on a graph neural network and computer equipment. The caged broiler feeding anomaly detection method comprises the steps that S1, a feed image, an in-cage broiler image and multi-dimensional environment data are collected to form a database; s2, constructing a YOLOv11-DO model for cage rearing broiler target detection, and outputting the number of broiler individuals in each cage position; s3, each cage position is regarded as an independent node to form a node feature vector, and graph structure data with weights and an adjacent matrix are constructed; s4, obtaining the ingestion abnormal probability of each cage position; and S5, performing graded alarm on the abnormal probability of each cage position, and synchronously pushing the abnormal cage position number, the real-time environment data and the image snapshot information to a monitoring terminal. According to the invention, through multi-module cooperative accurate counting quantification, abnormal conditions are dynamically determined, and the problems of low efficiency, inaccurate counting and easy false and missing report of a fixed threshold value in manual monitoring are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the interdisciplinary field of intelligent monitoring and artificial intelligence application in livestock and poultry farming, specifically to a method, system, and computer equipment for detecting abnormal feed intake in caged broilers based on graph neural networks. Background Technology

[0002] Currently, environmental monitoring and feed feeding systems for caged broiler chickens mainly rely on manual labor or traditional automated equipment, which suffers from low accuracy, slow response, and inability to adjust in real time. Existing systems typically monitor and control only a single environmental factor, lacking comprehensive adjustment of multi-dimensional environmental data, such as temperature, humidity, gas concentration, and chicken numbers. Furthermore, traditional target detection technologies have low accuracy in densely obscured and complex environments, failing to efficiently and accurately monitor chicken behavior in real time. They also often rely on fixed thresholds for anomaly detection, leading to frequent false alarms and missed alarms, and lack flexible adaptive adjustment capabilities. Summary of the Invention

[0003] This invention addresses the problems in existing technologies by disclosing a method, system, and computer device for detecting abnormal feeding in caged broilers based on graph neural networks. This invention employs a combination of multimodal data acquisition and graph neural network inference to accurately monitor the feeding behavior, environmental parameters, and feed consumption of caged broilers. By dynamically adjusting the anomaly detection criteria through adaptive thresholds, it solves the problems of inefficiency and inaccurate counting in manual monitoring, and the tendency for false alarms and missed detections with fixed thresholds. This achieves efficient system integration, accurate anomaly detection, and intelligent decision-making, thereby improving breeding efficiency, reducing human intervention, and ensuring the healthy growth of chickens.

[0004] This invention is achieved through the following technical solution:

[0005] This invention first provides a method for detecting abnormal feed intake in caged broilers based on graph neural networks, comprising the following steps:

[0006] S1. Collect feed images, broiler images in cages, and multidimensional environmental data to form a database. After processing the database, output standardized feed status data, environmental data, and contour feature data.

[0007] S2. Obtain samples from the processed database covering the entire scenario of counting caged broilers, construct a YOLOv11-DO model for target detection of caged broilers, and output the number of broilers in each cage using this model.

[0008] S3. Treat each cage as an independent node, and integrate the feed status data, environmental data, number of broiler individuals, and broiler breed information of that cage to form a node feature vector. Construct a weighted graph structure data and adjacency matrix through the node feature vector.

[0009] S4. Input the graph structure data into the ST-GATNet model, aggregate the spatial and temporal features of the cage positions through the spatiotemporal graph convolutional layer, and combine the multi-head attention mechanism and gated recurrent unit to mine the spatiotemporal dependencies between the cage positions and obtain the feeding abnormality probability of each cage position.

[0010] S5. Based on the global feeding status, the situation of adjacent cages and seasonal factors, obtain dynamic judgment thresholds, and classify the abnormal feeding probability of each cage with alarms. At the same time, push the abnormal cage number, real-time environmental data and image snapshot information to the monitoring terminal.

[0011] As a further step, S1 includes:

[0012] S11. When the inspection vehicle reaches the target cage, it triggers data acquisition. The RGB-D camera collects color images of the feed and corresponding depth images in real time. At the same time, the environmental sensor collects multi-dimensional environmental data such as temperature, humidity, gas, and wind speed.

[0013] S12. Convert the color image of the feed in the target cage into a grayscale image, and compress the three-dimensional color information into one-dimensional grayscale features.

[0014] S13. The grayscale image is smoothed and denoised by Gaussian filtering;

[0015] S14. Enhance the image and improve the contrast of the denoised grayscale image;

[0016] S15. Perform edge detection on the grayscale image after contrast enhancement, extract the closed edge between the feed trough and the feed surface, obtain the binarized edge map of the target feed trough area, and output standardized contour feature data.

[0017] S16. Based on the edge map, perform feature calculations to obtain feed parameters within the track: area, perimeter, centroid coordinates, and shape factor, and output standardized feed state data;

[0018] S17. The multidimensional environmental data is calibrated and smoothed, and standardized environmental data is output.

[0019] As a further embodiment, S15 includes:

[0020] S151. Perform gradient calculation on the image, using the Sobel operator to calculate the gradient components in the x and y directions respectively:

[0021] , ; (3)

[0022] in, This represents the convolution operation. This is the preprocessed grayscale image;

[0023] The gradient magnitude of each pixel is calculated using the gradient magnitude formula. and direction :

[0024] ;(4)。

[0025] S152. Perform non-maximum suppression processing on the image along the gradient direction. Compare the gradient magnitude of the current pixel with the gradient magnitude of its two adjacent pixels along the gradient direction. If the gradient value of the current pixel is not a local maximum, set its value to zero.

[0026] S153. Perform Otsu's double threshold detection on the image and set a high threshold. and low threshold ,in This is used to distinguish between pixels with strong edges, weak edges, and non-edges.

[0027] The classification rules are as follows:

[0028] When gradient magnitude When this happens, mark the pixel as a strong edge;

[0029] when When this occurs, mark it as a weak edge;

[0030] when When the pixel is considered non-edge, it is discarded.

[0031] S154. Perform edge connection on the image. Starting from a strong edge pixel, sample and check if there are connected weak edge pixels in its 8-neighborhood. If a weak edge pixel is connected to any strong edge, it is determined to be part of the real edge and is retained; otherwise, it is discarded to obtain a continuous and closed trough contour edge.

[0032] The threshold is adaptively selected based on Otsu's method. The segmentation threshold with the largest inter-class variance is calculated using the gradient magnitude distribution of the entire image, and then multiplied by an adjustment coefficient to obtain a high threshold. Adaptive estimation:

[0033] ; (5)

[0034] in, The average gradient magnitude. denoted as the standard deviation of the gradient magnitude, and k is an empirical adjustment coefficient, ranging from 1.5 to 2.5.

[0035] S155. After performing edge detection based on the grayscale image, obtain a binarized edge map of the target material tank area;

[0036] S156. For the edge map, extract the contour, use the 8-neighborhood connectivity algorithm to find closed contour curves, identify and determine the complete contour, and then output standardized contour feature data.

[0037] As a further embodiment, S2 includes:

[0038] S21. Obtain samples covering the entire scenario of caged broiler counting, including typical lighting and density scenarios in chicken houses; record supplementary information, binding metadata such as cage number, broiler age, and real-time temperature and humidity to each image;

[0039] S22. Construct a dataset based on the samples and divide the dataset;

[0040] S23. Perform image enhancement and data cleaning on the dataset;

[0041] S24. Construct a YOLOv11-DO model adapted for target detection in caged broiler chickens.

[0042] S25. Train the YOLOv11-DO model;

[0043] S26. Verify the YOLOv11-DO model to ensure that the model is suitable for practical applications;

[0044] As a further step, the methods for partitioning the dataset in S22 include:

[0045] S221. The LabelImg annotation tool is used to annotate the image data, and the minimum bounding rectangle of each broiler chicken is annotated in VOC format. During the annotation process, the chicken's head is used as the core to determine the selection range, so that individuals can still be identified by head features even when occluded. For broilers with an occlusion area greater than 70%, depth information from the RGB-D camera is used to assist in annotation. After annotation, duplicate annotations are filtered by an IOU threshold ≥ 0.85, and the annotation box with the highest confidence is retained. Then, three breeding technicians cross-validate to ensure that the annotation accuracy is > 99%.

[0046] S222. Split the dataset: Divide the input data into a 70% training set, 20% validation set, and 10% test set.

[0047] As a further step, the method in S24 for constructing a YOLOv11-DO model adapted for target detection in caged broilers is as follows:

[0048] The YOLOv11-DO model architecture is divided into three parts: feature extraction, feature enhancement, and optimized detection head. The feature map size and number of channels in each layer satisfy the following:

[0049] ; (16)

[0050] For the first Layer size, For the first Layer downsampling rate, For the number of channels, This is the channel variation coefficient;

[0051] S241. The feature extraction includes: using the C3k2 parallel convolution module and C2PSA attention module of YOLOv11 to extract features step by step from the input image; adapting the input image to the resolution of the RGB-D camera, adjusting the 5th downsampling layer of YOLOv11, and adjusting the size of the input image from 640×640 to 640×480;

[0052] S242. The feature enhancement includes: inserting a depthwise parameterized depthwise convolutional layer after the C2PSA module. The structure of this layer achieves feature enhancement through three convolutional operations: First, a 1×1 convolution is performed to compress the high-dimensional features output by the C2PSA module to 64 channels, achieving dimensionality reduction and feature fusion; then, a 3×3 depthwise convolution is used to refine the local features of each channel, focusing on capturing differential information such as the edges and textures of overlapping chickens; finally, a 1×1 convolution is used to increase the number of feature channels to 128 channels, restoring the feature expressive power while completing feature reorganization.

[0053] S243. The optimized detection head includes: replacing the SiLU activation function with the ELU function, the function expression of which is:

[0054] ; (17)

[0055] Where α = 1.0;

[0056] As a further step, the method for training the YOLOv11-DO model in S25 is as follows:

[0057] S251, Training Parameters: Input the preprocessed training and validation sets into the model, and use the SGD optimizer with momentum and weight decay to achieve stable convergence in small sample scenarios. The parameter update formula is:

[0058] ; (18)

[0059] in, For the updated parameters, For the current parameter, The initial learning rate, =0.001, This is the momentum factor, with a value of 0.937. For historical momentum, The gradient of the loss function. This is the weight decay factor, with a value of 0.0005;

[0060] The training pace is controlled using a stepped decay method, with the decay formula as follows:

[0061] ; (19)

[0062] in, For the first Round learning rate, The initial learning rate;

[0063] The training batch size is set to 32, and the inference batch size is set to 1 to meet the single-frame processing requirements of real-time inspection.

[0064] The loss function uses a weighted combination of CIoU loss and cross-entropy loss, and the total loss function formula is as follows:

[0065] ; (20)

[0066] Here, weights of 5.0 and 1.0 correspond to the importance of the regression and classification branches, respectively.

[0067] CIoU loss is used to optimize bounding box regression in occluded scenes. The CIoU loss formula is:

[0068] ; (twenty one)

[0069] in, The intersection-union ratio (IU) of the predicted bounding box and the ground truth bounding box. The Euclidean distance between the center points of the two frames is... The length of the diagonal of the smallest rectangle enclosing the two frames. The balance coefficient is determined by... Calculated , is the aspect ratio consistency parameter, where w represents the width of the botnet detection box predicted by the model, and n represents the height of the botnet detection box predicted by the model. This represents the width of the actual frame of the broiler chicken, as labeled manually. This represents the height of the actual frame of the broiler chicken, as manually labeled.

[0070] Cross-entropy loss optimizes the confidence score for broiler chicken classification. The formula for cross-entropy loss is:

[0071] ;(twenty two)

[0072] in, This refers to the number of test frames per batch. For real labels, The classification confidence score predicted by the model.

[0073] S252, Iterative Training: Each training round includes four steps: forward inference of the model output detection box and confidence, loss calculation of quantified prediction bias, backpropagation of automatic differentiation and gradient calculation, and parameter update of SGD optimizer iteration, for a total of 300 rounds of training.

[0074] S253. Training process control includes: real-time monitoring of the loss value, core target detection metrics, and counting accuracy of the training or validation set using TensorBoard; early stopping mechanism to avoid overfitting; and reduced computational load through structured pruning after training.

[0075] As a further step, the verification method for the model described in S26 is as follows:

[0076] S261. Obtain detection indicators: mAP@0.5 ;

[0077] S262. Obtaining accuracy: The calculation formula is as follows:

[0078] ; (twenty three)

[0079] Among them, TP refers to targets that are correctly detected as broiler chickens, and FP refers to targets that are mistakenly detected as broiler chickens, such as dust, feed residue, and cage screen shadows.

[0080] S263. Obtaining Recall Rate: The calculation formula is as follows:

[0081] ; (twenty four)

[0082] Here, FN refers to real botnets that were not detected by the model, and TP refers to targets that were correctly detected as botnets.

[0083] As a further embodiment, S3 includes:

[0084] S31. Obtain the node vector:

[0085] Each cage is treated as an independent node, and information such as feed volume, feed consumption rate, multi-dimensional environmental parameters, number of broilers, and broiler breed are integrated to form a node feature vector. The node feature vector comprehensively reflects the cage status and is defined as follows:

[0086] ; (25)

[0087] in, The remaining feed volume in the i-th cage position, in L. Feed consumption rate, unit: L / h Ambient temperature, unit: °C. Ambient humidity, unit: %RH This refers to the number of individual broiler chickens. It is a broiler chicken breed. As growth indicators, all features have been normalized using the min-max method.

[0088] S32. Obtain weighted graph structure data through the node feature vectors;

[0089] S33. Construct the adjacency matrix: Store it in a compressed sparse row format, with a size of [size missing]. ,in The total number of cages is used to store only non-zero weight values;

[0090] Preferably, the method of S32 includes:

[0091] The weight design comprehensively considers three types of relationships and achieves the quantification of spatiotemporal dependence through weighted summation:

[0092] S321. Edge weights of spatial adjacency relationships For adjacent cages in the same row or adjacent cages on the same floor, due to similar environmental conditions and potential cross-influence between broilers, the edge weights are based on Euclidean distance. calculate:

[0093] ; (26)

[0094] in, Indicates cage position and cage space The Euclidean distance between them.

[0095] S322, Edge weights of partitioning relationships Cages belonging to the same temperature control zone have strong correlation in their environmental parameters, and edge weights are based on the zone membership degree.

[0096] ;(27)

[0097] Among them, cage position and Whether the chickens are in the same or adjacent zones is determined based on the zoning information of the chicken house.

[0098] S323, Edge weights of time-continuous relationships The cage position data detected sequentially within the same inspection cycle are time-related, and the edge weights are inversely proportional to the time interval. calculate:

[0099] ; (28)

[0100] in, It is a cage position and The time interval between them is in hours;

[0101] The final weights are:

[0102] ; (29)

[0103] Where α=0.5, β=0.3, and γ=0.2 are weighting coefficients.

[0104] As a further embodiment, S4 includes:

[0105] S41. Input the graph structure data into the ST-GATNet model. The ST-GATNet model architecture includes an input layer, a spatiotemporal graph convolutional layer, a multi-head attention layer, a spatiotemporal fusion module, and an output layer. The specific structure is as follows:

[0106] Input layer: The input layer receives the feature matrix of the nodes. Where N is the number of nodes, F=7 is the feature dimension; normalized adjacency matrix The normalization formula for the adjacency matrix is:

[0107] ; (30)

[0108] in , It is the identity matrix. This is the original adjacency matrix. for The corresponding degree matrix; R represents the set of real numbers.

[0109] Spatiotemporal graph convolutional layer: fuses spatial and temporal features; the convolution operation formula is as follows:

[0110] ; (31)

[0111] in, For the first Layer feature matrix, For learnable weight matrix, The LeakyReLU activation function is given by the following formula:

[0112] ; (32)

[0113] in, The output feature value of the convolutional layer is 0.2, which is the slope parameter of the negative half axis of the function.

[0114] Multi-head attention layer: Four attention heads are set up to focus on different types of neighbor associations in parallel, and the output features are concatenated and then dimensionality reduced.

[0115] ; (33)

[0116] in =4 is the number of heads. For the first Node in the head To the neighbors Attention coefficients normalized by the Softmax function, For the first Layer nodes eigenvectors;

[0117] Spatiotemporal fusion module: Employs gated loop units to process temporal features and integrate historical inspection data.

[0118] ; (34)

[0119] in, for Hide your status at all times. for Input features at all times;

[0120] Output layer: The Sigmoid activation function is used to output the probability of feeding abnormality for each cage. The Sigmoid function restricts the output value to the range [0, 1], representing the probability of feeding abnormality occurring in each cage.

[0121] ; (35)

[0122] in, To output the weight matrix, The number of network layers (set to 2). For network feature representation, For the first The probability of abnormal feeding in each cage.

[0123] S42. Train the model from S41:

[0124] The model training employs focus loss to address class imbalance, particularly for classifying rare outliers. The focus loss formula is as follows:

[0125] ; (36)

[0126] in, As a category balance factor, The modulation factor is used. The model is trained using the Adam optimizer with an initial learning rate of 0.001, a batch size of 64, and 200 training rounds.

[0127] As a further embodiment, S5 includes:

[0128] S51. Obtain the global feeding rate deviation.

[0129] S52. Obtain the average anomaly probability of adjacent cage positions.

[0130] S53, the threshold for determining the dynamic position of the cage;

[0131] S54. Detect abnormal feeding conditions in cages and trigger an alarm:

[0132] S55. Identify anomaly types through feature patterns;

[0133] Preferably, S51 includes:

[0134] The formula for obtaining the change in current feeding rate compared to the historical average feeding rate over the past 7 days is:

[0135] ; (37)

[0136] in, This represents the current global average feeding rate. This is the historical average rate for the same period over the past 7 days;

[0137] As a further embodiment, S53 includes:

[0138] The threshold is dynamically determined using a formula, which is:

[0139] ; (39)

[0140] in, , is the initial threshold for the dynamic determination threshold of this cage position; The global feeding rate deviation reflects the overall feeding status; The average feeding abnormality probability of adjacent cages is used to capture locally correlated anomalies. , All are weighting coefficients; Season is the seasonal factor;

[0141] As a further embodiment, S54 includes:

[0142] S541, Probability of Abnormal Feeding in Cages With dynamic judgment threshold Compare and determine abnormal situations.

[0143] when When the feeding is deemed abnormal, multiple alarm levels are triggered:

[0144] when At that time, a yellow alert was issued, prompting attention.

[0145] when A red alarm will sound, requiring immediate action.

[0146] S542. Alarm information includes the abnormal cage number, occurrence time, abnormal probability, current feed volume, consumption rate, real-time temperature and humidity, and automatically saves an RGB-D image snapshot of the corresponding cage containing depth data.

[0147] Preferably, S55 includes:

[0148] Low consumption anomaly: Feed consumption rate in the current cage space ,in This represents the average consumption rate of this cage over the same period over the past 7 days.

[0149] Rapid consumption exception: , ;

[0150] Abnormal clustering: When three or more adjacent cages in the same space and time trigger a red alarm simultaneously, it indicates an abnormal regional environment or a group problem, requiring regional investigation.

[0151] This invention also provides a graph neural network-based system for detecting abnormal feed intake in caged broilers, including...

[0152] The data acquisition and processing module is used to acquire feed images, broiler images in cages, and multi-dimensional environmental data; it performs grayscale processing on color images and Gaussian filtering for noise reduction; it performs threshold segmentation and edge extraction on depth images to obtain the feed trough outline; it performs two-point calibration and smoothing processing on environmental data; and it calculates the remaining feed volume and feed consumption rate by combining depth images and image features, and finally outputs standardized feature data.

[0153] The target tracking and counting module is used to acquire samples covering the entire scenario of caged broiler counting and build a YOLOv11-DO model adapted for target detection of caged broilers. This model is used to collect broiler target detection in cage images in real time and accurately output the number of broilers in each cage.

[0154] The graph structure construction module is used to treat each cage as an independent node and integrate information such as feed volume, feed consumption rate, multi-dimensional environmental parameters, number of broiler individuals, and broiler breed of the cage to form a node feature vector. The weighted graph structure data and adjacency matrix are constructed through the node feature vector.

[0155] The graph neural network inference module is used to input graph structure data into the ST-GATNet model, aggregate the spatial and temporal features of cage positions through spatiotemporal graph convolutional layers, and mine the spatiotemporal dependencies between cage positions by combining multi-head attention mechanism and gated recurrent unit, and finally output the feeding abnormality probability of each cage position.

[0156] The adaptive anomaly detection module dynamically calculates the detection threshold based on the global feeding status, the situation of adjacent cages, and seasonal factors. It compares the anomaly probability of each cage with the corresponding threshold. When the anomaly probability exceeds the threshold, an alarm is triggered, and information such as the abnormal cage number, real-time environmental data, and image snapshots are simultaneously pushed to the monitoring terminal.

[0157] As a further step, the standardized feature data includes feed condition data, environmental data, and profile feature data.

[0158] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described.

[0159] The features and beneficial effects of this invention are as follows:

[0160] (1) This invention adopts a technology that combines multimodal data acquisition with graph neural network inference, which can accurately monitor the feeding behavior, environmental parameters and feed consumption of caged broilers. It also solves the problems of low efficiency of manual monitoring, inaccurate counting and easy false alarms of fixed thresholds by dynamically adjusting the abnormal detection standard through adaptive thresholds. It realizes efficient system integration, accurate abnormal detection and intelligent decision-making, thereby improving breeding efficiency, reducing human intervention and ensuring the healthy growth of chickens.

[0161] (2) This invention designs a YOLOv11-DO target detection model architecture adapted to cage rearing scenarios. It embeds a deep overparameterized deep convolutional layer (DO DConv) and an ELU activation function optimization module in the feature extraction chain, which can efficiently model the pain points of broiler counting in dense occlusion and low light environments. Through the feature enhancement process of 1×1 convolution dimensionality reduction, 3×3 deep convolution feature extraction, and 1×1 convolution dimensionality increase, combined with the attention mechanism to adaptively focus on key feature regions such as the broiler head, the model can maintain high counting accuracy and stability in complex farming environments.

[0162] (3) This invention introduces the ST-GATNet spatiotemporal graph attention neural network, which integrates spatiotemporal dependence and multimodal feature coupling mechanism, to construct a graph structure reasoning model for the evolution of cage feeding status, significantly enhancing the ability to characterize the spatial correlation and temporal continuity between cages. By embedding spatial adjacency, partition affiliation, and temporal continuity as weighted adjustment parameters in the graph structure modeling, it can accurately capture the coordinated change patterns of multimodal data such as feed status, environmental data, and broiler counts, so that feeding abnormalities can show significant probability deviations in the bud stage, thus possessing a stronger forward-looking early warning capability.

[0163] (4) This invention proposes a context-adaptive anomaly determination mechanism and a focus loss optimization strategy to improve the ability to identify rare feeding anomalies. This invention dynamically adjusts the determination threshold by integrating the global feeding status, the situation of adjacent cages and seasonal factors, and strengthens the weight of abnormal samples by combining focus loss. It constructs a closed-loop mechanism for anomaly probability calculation, dynamic threshold matching and anomaly type tracing, so as to achieve fine identification of weak signal anomalies such as low consumption, rapid consumption and abnormal aggregation, and effectively alleviate the performance deviation caused by sample imbalance. Attached Figure Description

[0164] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0165] Figure 1 This is a flowchart of the method for detecting abnormal feed intake in caged broilers based on graph neural networks, as described in an embodiment of the present invention.

[0166] Figure 2 This is a schematic diagram of the abnormal feed intake detection system for caged broilers based on graph neural networks, as described in an embodiment of the present invention. Detailed Implementation

[0167] To facilitate understanding of the present invention, a more comprehensive description of the present invention will be given below, and embodiments of the present invention will be provided, but this does not limit the scope of the present invention.

[0168] To improve the efficiency of detecting abnormal feeding behavior in caged broilers, existing methods rely on microphones to collect the sounds of broilers pecking at feed. However, this approach fails in high-density environments such as stacked cages. The pecking sounds from multiple cages, along with the calls of the broilers, create significant acoustic interference, making it difficult to accurately distinguish the feeding sounds of individual cages or individuals, and thus impossible to accurately determine if feeding is abnormal. Therefore, this application proposes a graph neural network-based method for detecting abnormal feeding behavior in caged broilers. This method combines multimodal data acquisition with graph neural network inference, enabling precise monitoring of feeding behavior, environmental parameters, and feed consumption. It dynamically adjusts the anomaly detection criteria through adaptive thresholds, solving the problems of low efficiency in manual monitoring, inaccurate microphone counting, and false negatives / missed reports with fixed thresholds. This achieves efficient system integration, accurate anomaly detection, and intelligent decision-making, thereby improving breeding efficiency, reducing human intervention, and ensuring the healthy growth of the chickens.

[0169] like Figure 1 and Figure 2 As shown, a method for detecting abnormal feed intake in caged broilers based on graph neural networks includes: S1, collecting feed images, images of broilers in cages, and multidimensional environmental data to form a database; processing the database and outputting standardized feed status data, environmental data, and contour feature data; including:

[0170] S11. Data acquisition is triggered when the inspection vehicle reaches the target cage. The RGB-D camera with depth sensing function acquires the feed color image and corresponding depth image in real time at a frequency of 30fps. At the same time, the environmental sensor acquires multi-dimensional environmental data such as temperature, humidity, gas, and wind speed.

[0171] S12. The color image of the feed in the target cage is preprocessed using a standard grayscale conversion formula to convert the color image into a grayscale image. The three-dimensional color information is compressed into one-dimensional grayscale features. Grayscale conversion will ensure that the image retains only the contour information.

[0172] The formula for grayscale conversion preprocessing is:

[0173] ; (1)

[0174] Where R(x, y), G(x, y), and B(x, y) are the values ​​of the red, green, and blue channels of each pixel, respectively.

[0175] S13. The grayscale image is smoothed and denoised using Gaussian filtering. A 5×5 Gaussian kernel is used for convolution filtering. A 5×5 Gaussian kernel is suitable for calculating efficient adaptation scenarios. The Gaussian kernel function is:

[0176] ; (2)

[0177] Where σ=1.4. Gaussian filtering can effectively reduce the interference of messy textures and lighting noise in the poultry house environment on subsequent edge detection.

[0178] S14. Image enhancement is performed on the denoised grayscale image by using histogram equalization to improve image contrast. This method stretches the grayscale distribution, highlights image details, and enhances the distinction between the trough outline and feed particles, providing a clearer image for subsequent edge detection and segmentation. Histogram equalization stretches the grayscale distribution and highlights image details, making the trough outline and feed particles more prominent in the image, which is beneficial for subsequent edge detection or segmentation.

[0179] S15. Edge detection is performed on the contrast-enhanced grayscale image. Using adaptive thresholding and optimized edge connectivity as the core, Sobel gradient calculation, non-maximum suppression, Otsu's double-threshold detection, and 8-neighborhood weak edge connectivity are sequentially applied to extract the closed edges of the feed trough and feed surface. Dynamic adjustment of the Sobel operator gradient magnitude, threshold selection, and denoising optimization are used to extract the feed trough contour more accurately.

[0180] S151. Perform gradient calculation on the image, and use the Sobel operator to calculate the gradient components of the image in the x and y directions respectively:

[0181] , ; (3)

[0182] in This represents the convolution operation. This is the preprocessed grayscale image.

[0183] The gradient magnitude of each pixel is calculated using the gradient magnitude formula. and direction :

[0184] ; (4)

[0185] gradient magnitude The larger the value, the more drastic the grayscale change at that pixel, meaning it may be located at an edge.

[0186] S152. Perform non-maximum suppression (NMS) processing on the image along the gradient direction. The gradient magnitude of the current pixel is compared with that of its two adjacent pixels along the gradient direction. If the gradient value of the current pixel is not a local maximum, its value is set to zero, thereby removing false edges and noise. After non-maximum suppression, edges are preserved at a single pixel width, and noise and false edges are further reduced.

[0187] S153. Perform Otsu's method double threshold detection on the image and set a high threshold. and low threshold (in ( ), to distinguish strong edges, weak edges and non-edge pixels.

[0188] The classification rules are as follows:

[0189] When gradient magnitude When this happens, mark the pixel as a strong edge;

[0190] when When this occurs, mark it as a weak edge;

[0191] when When the pixel is considered to be non-edge, it is discarded.

[0192] By using dual thresholding, noisy pixels are removed while important edge pixels are preserved.

[0193] S154. The image is edge-connected. Starting from a strong edge pixel, samples and checks whether there are connected weak edge pixels in its 8-neighborhood. If a weak edge pixel is connected to any strong edge, it is determined to be part of a real edge and is retained; otherwise, it is discarded. A continuous and closed trough contour edge is obtained.

[0194] The threshold is adaptively selected based on Otsu's method. The segmentation threshold with the largest inter-class variance is calculated using the gradient magnitude distribution of the entire image, and then multiplied by an adjustment coefficient to obtain a high threshold. Adaptive estimation:

[0195] ; (5)

[0196] in, The average gradient magnitude. Let be the standard deviation of the gradient magnitude, and k be an empirical adjustment coefficient (ranging from 1.5 to 2.5). Adaptively adjust... and This makes edge detection more robust to different images.

[0197] S155. After performing edge detection based on the grayscale image, obtain a binarized edge map of the target material tank area.

[0198] S156. Contour extraction is performed on the edge map. The 8-neighborhood connectivity algorithm is used to find closed contour curves, identify and determine complete contours. For the detected connected components, the Douglas-Peucker polygon approximation algorithm is used for simplification, reducing redundant points and polyline inflection points, thereby reducing contour complexity and preserving contour shape, and outputting standardized contour feature data.

[0199] S16. Based on the edge map, perform feature calculations to obtain feed parameters within the track: area, perimeter, centroid coordinates, and shape factor, and output standardized feed status data.

[0200] For the area The pixel area of ​​the region enclosed by the outline can be obtained by counting the number of white pixels in the binary image after filling the outline pixels.

[0201] For the perimeter P, which is the outer length of the contour, it is calculated by successively adding the distances between each adjacent point of the contour, and must satisfy the formula: (6)

[0202] For the centroid coordinates The centroid of the contour region is obtained by averaging the coordinates of all pixels within the region.

[0203] , (7)

[0204] in, This represents the number of pixels in the region.

[0205] For the shape factor F, the circle used to quantitatively describe the contour shape is defined as follows: ; (8)

[0206] When the outline is a perfect circle The narrower and more irregular the outline, the better. The smaller the value, the better. Shape factors can be used to help distinguish between different types of contours.

[0207] In some embodiments, the feature calculation can further verify whether the detected contour is a feed trough and feed surface.

[0208] The extracted feed trough contour and feed surface contour are used, and the volume of remaining feed is calculated by combining the feed trough depth information. This yields the three-dimensional height difference distribution inside the feed trough. It represents the height difference between the calibration plane at the bottom of the feed trough and the current feed surface. Three-dimensional height difference distribution based on depth image. Then, based on the pre-calibrated cross-sectional area of ​​the feed trough, the volume of remaining feed is calculated using a double integral. The formula is:

[0209] ; (9)

[0210] Where A is the cross-sectional area range of the feed trough (pre-determined through image calibration), and D(x,y) is the depth value of the corresponding point in the depth image. The remaining feed volume is obtained by integrating the depth values ​​of all pixels in the feed trough, with the calculation error controlled within 3%.

[0211] Feed consumption rate The formula for calculating the difference in feed volume between two consecutive inspections is as follows:

[0212] ; (10)

[0213] in This refers to the feed volume from the previous inspection cycle. For the current volume, The inspection interval is set to 2 hours by default, but can be dynamically adjusted according to the age of the broilers.

[0214] S17. The multidimensional environmental data is calibrated and smoothed, and standardized environmental data is output.

[0215] The calibration process employs a two-point calibration method, using 0℃ / 50% RH and 35℃ / 90% RH as standard environmental points to obtain the sensor's offset and sensitivity coefficient. The calibration formula is as follows:

[0216] ; (11)

[0217] in, This is the offset. These are the original measured values. This is the sensitivity coefficient. This is the offset, used to quickly correct sensor linearity errors.

[0218] The smoothing process combines moving average filtering and exponential smoothing to eliminate instantaneous fluctuations and maintain real-time response.

[0219] The moving average filtering formula is:

[0220] ;(12)

[0221] Where n is the index of the current data point to be smoothed, and i is the summation index variable.

[0222] The formula for exponential smoothing is:

[0223] ; (13)

[0224] in =0.3 is a smoothing factor; this processing ensures the stability and response speed of environmental data. The final output includes standardized feed condition data, environmental data, and profile feature data.

[0225] S2. Obtain high-quality samples covering the entire scenario of caged broiler chicken counting, construct a dataset according to the established image quality control standards, then label and divide the data, and then preprocess the data to prepare for model training.

[0226] S21. Obtain high-quality samples covering the entire scenario of caged broiler chicken counting, and establish image quality control standards.

[0227] The high-quality sample images are sourced from two mainstream breeds, white-feathered and yellow-feathered broilers, covering the entire growth cycle of broilers and ensuring that the samples are suitable for counting broilers of different sizes. The samples include typical lighting and density scenarios in chicken houses. Additional information is recorded, with each image bound to metadata such as cage number, broiler age, and real-time temperature and humidity, providing a basis for subsequent scenario-based verification.

[0228] S22. Construct a dataset based on the samples and divide the dataset;

[0229] S221. The LabelImg annotation tool is used to annotate the minimum bounding rectangle of each broiler chicken in VOC format. During the annotation process, the chicken's head is used as the core to determine the selection range, ensuring that individuals can still be identified by head features even when occluded. For chickens with an occlusion area greater than 70%, depth information from the RGB-D camera is used to assist in annotation. After annotation, duplicate annotations are filtered out using an IOU threshold ≥ 0.85. IOU (Intersection over Union) is the core indicator for measuring the degree of overlap between two annotation boxes, and its calculation formula is as follows:

[0230] ;(14)

[0231] Where A∩B represents the area of ​​the intersection of the two bounding boxes, and A∪B represents the area of ​​the union of the two bounding boxes. When IOU≥0.85, it is determined to be a duplicate labeling of the same broiler chicken, and the bounding box with the highest confidence is retained; then, three breeding technicians cross-validate to ensure that the labeling accuracy is >99%.

[0232] S222. Divide the dataset to prepare for model building;

[0233] The input data is divided into a 70% training set, a 20% validation set, and a 10% test set. The 70% training set ensures the model fully learns features and avoids underfitting; the 20% validation set supports parameter tuning and overfitting monitoring; and the 10% test set independently and objectively evaluates generalization ability. This approach balances data utilization efficiency with the need for model performance validation.

[0234] S23. Data preprocessing: Perform targeted preprocessing on the dataset to reduce the interference of invalid information on the model. This includes two steps: image enhancement and data cleaning.

[0235] The image enhancement includes: randomly adjusting brightness and contrast to simulate different lighting fluctuations; adding Gaussian noise. To simulate sensor noise and dust interference, the Mosaic enhancement method is adopted, which randomly stitches together four images. That is, four images of cage positions in different scenes are randomly selected from the dataset, cropped and scaled to retain the broiler target, and then stitched together into a new synthetic image in a 2×2 grid layout. The coordinates of the annotation box are simultaneously calibrated to improve the training effect in dense scenes.

[0236] The data cleaning process includes: image screening, removing images with a sharpness score less than 0.6; deleting images with abnormal exposure and a grayscale mean less than 30 or greater than 220; re-verifying the annotation boxes of the cleaned data, deleting empty annotations without chickens, and correcting invalid annotations that exceed the image boundaries to ensure the integrity of the annotations for each image.

[0237] The sharpness score uses the Laplacian variance direct normalization method. Images with a sharpness score less than 0.6 are discarded if they are blurry. The formula is as follows:

[0238] ; (15)

[0239] in, The image after convolution with the Laplacian operator. The variance of pixel values ​​in the convolutional image. Rate the clarity.

[0240] S24. Construct a YOLOv11-DO model adapted for target detection in caged broiler chickens. Targeted improvements are made to address the characteristics of dense, occluded, and small targets in caged broiler chickens. The model architecture consists of three parts: feature extraction, feature enhancement, and optimized detection head.

[0241] The feature map size and number of channels in each layer satisfy the following:

[0242] ; (16)

[0243] For the first Layer size, For the first Layer downsampling rate, For the number of channels, This is the channel variation coefficient.

[0244] S241. The feature extraction includes: using the C3k2 parallel convolution module and C2PSA attention module of YOLOv11 to extract features step by step from the input image; adapting the input image to the resolution of the RGB-D camera, adjusting the 5th downsampling layer of YOLOv11, and adjusting the size of the input image from 640×640 to 640×480 to avoid image scaling distortion and ensure the preservation of image details.

[0245] S242. The feature enhancement includes: inserting a depthwise overparameterized depthwise convolutional layer (DODConv) after the C2PSA module. This layer's structure achieves feature enhancement through three convolutional operations. First, a 1×1 convolution is performed to compress the high-dimensional features output by the C2PSA module to 64 channels, achieving dimensionality reduction and feature fusion. Next, a 3×3 depthwise convolution is used to refine the local features of each channel, focusing on capturing differential information such as edges and textures of overlapping chickens. Finally, a 1×1 convolution is used to increase the number of feature channels to 128 channels, restoring feature expressiveness while completing feature reorganization.

[0246] S243. The optimized detection head includes: replacing the SiLU activation function with the ELU function (α=1.0), the function expression of which is:

[0247] ; (17)

[0248] By utilizing the soft saturation property of the negative half-axis of the ELU function, the problem of weak detection response in low-light scenes is solved, and the robustness of the model under low illumination is improved.

[0249] S25. For the training of the aforementioned model, based on the preprocessed dataset, the model achieves efficient convergence and possesses good generalization ability through core parameter optimization and dynamic control strategies. This specifically includes three parts: training parameter design, iterative training process, and training process control.

[0250] S251, The training parameter design includes: inputting the preprocessed training set and validation set into the model, and using momentum (…). =0.937) and weight decay ( The SGD optimizer with a value of 0.0005 is adapted for stable convergence in small sample scenarios, and the parameter update formula is:

[0251] ; (18)

[0252] in, For the updated parameters, For the current parameter, The initial learning rate ( =0.001), Momentum factor For historical momentum, The gradient of the loss function. This is the weight decay factor.

[0253] A stepped decay method is used to control the training pace and avoid parameter oscillations in the later stages. The decay formula is as follows:

[0254] ; (19)

[0255] in, For the first Round learning rate, The initial learning rate;

[0256] The training batch size is set to 32 to balance memory usage and gradient stability, while the inference batch size is set to 1 to meet the single-frame processing requirements of real-time inspection.

[0257] The loss function uses a weighted combination of CIoU loss and cross-entropy loss, and the total loss function formula is as follows:

[0258] ; (20)

[0259] Here, weights of 5.0 and 1.0 correspond to the importance of the regression and classification branches, respectively.

[0260] CIoU loss is used to optimize bounding box regression in occluded scenes. The CIoU loss formula is:

[0261] ; (twenty one)

[0262] in, The intersection-union ratio (IU) of the predicted bounding box and the ground truth bounding box. The Euclidean distance between the center points of the two frames is... The length of the diagonal of the smallest rectangle enclosing the two frames. The balance coefficient (by) Calculated , (This is the aspect ratio consistency parameter), where w represents the width of the broiler detection box predicted by the model, and n represents the height of the broiler detection box predicted by the model. This represents the width of the actual frame of the broiler chicken, as labeled manually. This represents the height of the actual frame of the broiler chicken, as manually labeled.

[0263] Cross-entropy loss optimizes the confidence score for broiler chicken classification. The formula for cross-entropy loss is:

[0264] ;(twenty two)

[0265] in, This refers to the number of test frames per batch. The labels are real (1 for botnet, 0 for background). The classification confidence score predicted by the model.

[0266] S252, The iterative training includes:

[0267] Each training round consists of four steps: forward inference (model output detection boxes and confidence scores), loss calculation (quantification of prediction bias), backpropagation (automatic differentiation to calculate gradients), and parameter update (SGD optimizer iteration). A total of 300 training rounds are conducted.

[0268] S253, The training process control includes:

[0269] The loss value, core object detection metrics (mAP@0.5), and counting accuracy of the training or validation sets are monitored in real time using TensorBoard. An early stopping mechanism is adopted (if the mAP@0.5 of the validation set improves by less than 0.1% for 15 consecutive rounds, the test is stopped) to avoid overfitting. After training, structured pruning (pruning rate of 30%, retaining convolutional kernels with a contribution of >0.01) is used to reduce the computational cost.

[0270] S26. The model validation is carried out using a validation set as the carrier, and the detection indicators mAP@0.5, precision and recall are adopted. Targeted validation is carried out focusing on the pain points of caged breeding scenarios, the shortcomings of the model are located and optimized, and the model is adapted to actual applications.

[0271] S261. The detection metric mAP@0.5 represents the model's overall detection performance, integrating the trade-off between precision and recall. It reflects the model's stability in different scenarios. If mAP@0.5 improves, it means that the model can not only accurately identify clear botnets, but also effectively cope with complex interference scenarios.

[0272] S262. Accuracy is the reliability of the detection results. It is the proportion of targets that the model classifies as "botnets" but which are actually botnets. The calculation formula is:

[0273] ; (twenty three)

[0274] Among them, TP (true positive) refers to a target that is correctly detected as a broiler (IOU ≥ 0.5 between the detection box and the actual broiler label box), and FP (false positive) refers to a target that is mistakenly detected as a broiler, such as dust, feed residue, or cage netting shadows.

[0275] S263. Recall rate is the comprehensiveness of detection coverage, that is, the proportion of real botnets that are successfully detected by the model. The calculation formula is:

[0276] ; (twenty four)

[0277] Among them, FN (false negative) refers to real botnets that were not detected by the model, mainly due to scenarios such as dense occlusion (limb overlap rate > 50%) and blurred outlines of botnets in low light environments.

[0278] This application designs a YOLOv11-DO object detection model architecture adapted to cage rearing scenarios. It embeds a deep overparameterized deep convolutional layer (DO DConv) and an ELU activation function optimization module into the feature extraction chain, enabling efficient modeling of the challenges in broiler counting under conditions of dense occlusion and low light. Through a feature enhancement process involving 1×1 convolution dimensionality reduction, 3×3 deep convolution feature extraction, and 1×1 convolution dimensionality increase, combined with an attention mechanism that adaptively focuses on key feature regions such as the broiler head, the model maintains high counting accuracy and stability even in complex farming environments.

[0279] S3. Treat each cage as an independent node and integrate information such as feed volume, feed consumption rate, multi-dimensional environmental parameters, number of broiler individuals, and broiler breed for that cage to form a node feature vector. Construct a weighted graph structure data and adjacency matrix using this node feature vector.

[0280] S31. Obtain the node vector:

[0281] Each cage is treated as an independent node, and information such as feed volume, feed consumption rate, multidimensional environmental parameters, number of broilers, and broiler breed are integrated to form a node feature vector. The node feature vector comprehensively reflects the cage status and is defined as follows:

[0282] ; (25)

[0283] in, Let L be the volume of remaining feed in the i-th cage. Feed consumption rate (unit: L / h). Ambient temperature (unit: °C). Ambient humidity (unit: %RH) This refers to the number of individual broiler chickens. Set the broiler breeds (white-feathered broilers are set to 1, and yellow-feathered broilers are set to 2). The growth index (age-standardized values, range 0-1) is used, and all features are normalized by min-max to eliminate the influence of dimensions.

[0284] S32. Obtain weighted graph structure data and adjacency matrix through the node feature vectors;

[0285] The edge weight design comprehensively considers three types of association relationships, and achieves the quantification of spatiotemporal dependence through weighted summation:

[0286] S321. Edge weights of spatial adjacency relationships For adjacent cages in the same row or adjacent cages on the same floor, due to similar environmental conditions and potential cross-influence between broilers, the edge weights are based on Euclidean distance. calculate:

[0287] ; (26)

[0288] in, Indicates cage position and cage space The Euclidean distance between them.

[0289] S322, Edge weights of partitioning relationships Cages belonging to the same temperature control zone have strong correlation in their environmental parameters, and edge weights are based on the zone membership degree.

[0290] ;(27)

[0291] Among them, cage position and Whether the chickens are in the same or adjacent zones is determined based on the zoning information of the chicken house.

[0292] S323, Edge weights of time-continuous relationships The cage position data detected sequentially within the same inspection cycle are time-related, and the edge weights are inversely proportional to the time interval. calculate:

[0293] ; (28)

[0294] in, It is a cage position and The time interval between them (in hours).

[0295] The final edge weights are:

[0296] ; (29)

[0297] Here, α=0.5, β=0.3, and γ=0.2 are weighting coefficients, which are determined through grid search optimization to ensure the dominant role of spatial correlation.

[0298] S33. The adjacency matrix is ​​constructed and stored in a compressed sparse row format, with a size of [size missing]. ,in The total number of cages is used to store only non-zero weight values, reducing memory usage and facilitating large-scale chicken house deployment.

[0299] S4. Input the graph structure data into the ST-GATNet model, aggregate the spatial and temporal features of the cage positions through the spatiotemporal graph convolutional layer, and combine the multi-head attention mechanism and gated recurrent unit to mine the spatiotemporal dependencies between the cage positions and obtain the feeding abnormality probability of each cage position.

[0300] include:

[0301] S41. Input the graph structure data into the ST-GATNet model.

[0302] The ST-GATNet model architecture includes an input layer, a spatiotemporal graph convolutional layer, a multi-head attention layer, a spatiotemporal fusion module, and an output layer, with the specific structure as follows:

[0303] Input layer: The input layer receives the feature matrix of the nodes. (N is the number of nodes, F=7 is the feature dimension) and the normalized adjacency matrix The normalization formula for the adjacency matrix is:

[0304] ; (30)

[0305] in ( (the identity matrix) This is the original adjacency matrix. for The corresponding degree matrix.

[0306] Spatiotemporal graph convolutional layer: fuses spatial and temporal features; the convolution operation formula is as follows:

[0307] ; (31)

[0308] in, For the first Layer feature matrix, The learnable weight matrix (first layer dimension 7×64, second layer 64×32). The LeakyReLU activation function is given by the following formula:

[0309] ; (32)

[0310] in, The input to the function (i.e., the output feature value of the convolutional layer) is 0.2, which is the slope parameter of the negative half axis of the function, used to avoid the gradient vanishing problem when the input is negative.

[0311] Multi-head attention layer: Four attention heads are set up to focus on different types of neighbor associations in parallel, and the output features are concatenated and then dimensionality reduced.

[0312] ; (33)

[0313] in =4 is the number of heads. For the first Node in the head To the neighbors Attention coefficients normalized by the Softmax function, For the first Layer nodes eigenvectors.

[0314] Spatiotemporal fusion module: Employs gated recurrent units (GRUs) to process temporal features and integrate historical inspection data.

[0315] ; (34)

[0316] in, for The state is always hidden (dimension 32). for By constantly inputting features, the temporal evolution of feeding status can be effectively captured.

[0317] Output layer: The Sigmoid activation function is used to output the probability of feeding abnormality for each cage, achieving binary classification prediction. The Sigmoid function restricts the output value to the range [0, 1], representing the probability of feeding abnormality occurring in each cage.

[0318] ; (35)

[0319] in, To output the weight matrix, The number of network layers (set to 2). For network feature representation, For the first The probability of abnormal feeding in each cage.

[0320] S42. Train the model from S41:

[0321] The model training employs focus loss to address class imbalance, particularly for classifying rare outliers. The focus loss formula is:

[0322] ; (36)

[0323] in, As a category balance factor, This is a modulation factor that effectively increases the weight of outlier samples. The model is trained using the Adam optimizer with an initial learning rate of 0.001, a batch size of 64, and 200 training epochs. Gradient updates and learning rate decay are used to ensure effective convergence of the model during training and to avoid overfitting.

[0324] This invention introduces the ST-GATNet spatiotemporal graph attention neural network, which integrates spatiotemporal dependence and multimodal feature coupling mechanisms, to construct a graph structure inference model for the evolution of cage feeding states. This significantly enhances the ability to characterize the spatial correlation and temporal continuity between cages. By embedding three weighted control parameters—spatial adjacency, partition affiliation, and temporal continuity—into the graph structure modeling, it can accurately capture the coordinated change patterns of multimodal data such as feed status, environmental data, and broiler counts. This allows feeding anomalies to exhibit significant probability deviations in their early stages, thus providing a stronger proactive early warning capability.

[0325] S5. Based on the global feeding status, the situation of adjacent cages and seasonal factors, obtain dynamic judgment thresholds, and classify the abnormal probability of each cage with alarms. At the same time, push the abnormal cage number, real-time environmental data and image snapshot information to the monitoring terminal.

[0326] Context-adaptive thresholds are used instead of fixed thresholds, and the judgment criteria are dynamically adjusted according to the overall status of the chicken house to balance the false alarm rate and the false alarm rate.

[0327] S51. Obtain the global feeding rate deviation to reflect the change in the current feeding rate compared to the historical average feeding rate over the past 7 days. The formula is:

[0328] ; (37)

[0329] in This represents the current global average feeding rate. This is the historical average rate for the same period over the past 7 days;

[0330] S52. Obtain the average anomaly probability of adjacent cage positions to capture locally correlated anomalies. The formula is:

[0331] ; (38)

[0332] in, Let i be the set of spatially adjacent cage positions of node i; This represents the single anomaly probability of the j-th cage position. This represents the arithmetic mean of the probabilities of anomalies in adjacent cages.

[0333] S53. Obtaining the Dynamic Judgment Threshold: A dynamic judgment threshold is obtained by comprehensively considering the overall feeding situation and the status of adjacent cages, combined with seasonal factors. The formula is:

[0334] ; (39)

[0335] in, , is the initial threshold for the dynamic determination threshold of this cage position; The global feeding rate deviation reflects the overall feeding status; The average feeding abnormality probability of adjacent cages is used to capture locally correlated anomalies. =0.5 (corresponding to the global feeding rate deviation weight) =0.3 (corresponding to the anomaly probability weight of adjacent cage positions) =0.2 (corresponding to the seasonal factor weight) is the weight coefficient; Season is the seasonal factor (0.95 for summer, 1.05 for winter, and 1.0 for spring and autumn), which adapts to the impact of ambient temperature on the feed demand of broilers.

[0336] S54. Detect abnormal feeding conditions in cages and trigger an alarm:

[0337] The probability of abnormal feeding in cages With dynamic judgment threshold Compare and determine abnormal situations.

[0338] when When the feeding is deemed abnormal, multiple alarm levels are triggered:

[0339] when At that time, a yellow alert was issued, prompting attention.

[0340] when At that time, a red alarm will be triggered, requiring immediate action.

[0341] Alarm information includes the abnormal cage number, occurrence time, abnormal probability, current feed volume, consumption rate, and real-time temperature and humidity. It automatically saves an RGB-D image snapshot of the corresponding cage with depth data to trace the cause.

[0342] S55. Identifying anomaly types through feature patterns:

[0343] Low consumption anomaly: Feed consumption rate in the current cage space ( (This refers to the average consumption rate of this cage over the same period over the past 7 days).

[0344] Rapid consumption exception: This is due to statistical errors in the number of broilers in cages, feed spillage, or accelerated growth of broilers, which are verified in conjunction with the age of the broilers.

[0345] Abnormal clustering: When three or more adjacent cages in the same space and time trigger a red alarm simultaneously, it indicates an abnormal regional environment (such as sudden changes in local temperature and humidity) or a group problem, requiring regional investigation.

[0346] Example 2:

[0347] A large-scale caged broiler chicken farm (total stock of 480,000 chickens) tested the caged broiler chicken feed intake anomaly detection system described in this invention. The farm's 12 sheds can each accommodate approximately 40,000 chickens, employing a four-layer, three-dimensional cage structure, and are equipped with 24 / 7 video monitoring cameras and multiple environmental sensors. However, in actual farming, core pain points remain: large deviations in broiler chicken counting under densely covered conditions, low accuracy in quantifying feed consumption, and frequent false alarms and missed alarms regarding feed intake anomalies. Traditional detection methods relying on manual counting and fixed thresholds have an accuracy rate of only 65% ​​in identifying feed intake anomalies, and each shed requires two dedicated feeders for verification, resulting in high labor costs.

[0348] After the system of this invention was deployed, a 42-day field test was conducted in the No. 12 breeding shed (containing 1600 cages) of the breeding base. Eighteen RGB-D depth cameras and 40 sets of multi-dimensional environmental sensors were deployed inside the shed, collecting approximately 62,000 pieces of multimodal data daily, including feed images, depth data, temperature and humidity, and gas concentration. After grayscale conversion, Gaussian noise reduction, edge extraction, and feature standardization by the data acquisition and processing module, a unified format dataset was constructed, and a synchronous timeline was used to form the model input sequence.

[0349] In the early stages of the experiment, the research team used historical inspection data (including 400 hours of valid records) from the breeding base from March to May 2025 to jointly train the YOLOv11-DO target tracking and counting module and the ST-GATNet graph neural network inference module. During the training process, by integrating multimodal features such as feed status, environmental parameters, and broiler counts, the model achieved a recognition accuracy of 94.9% on the training set and 91.9% on the validation set, significantly outperforming the 73.2% of traditional single-modal detection methods.

[0350] On the 16th day of the system's official operation, the feed intake rate of broilers in cage #12 remained below 70% of the historical average for 30 minutes. The system used ST-GATNet to analyze the spatiotemporal correlation between this cage and adjacent cages, and combined this with real-time temperature and humidity data and feed consumption rate to calculate an anomaly probability of 0.81, triggering a yellow alert. On-site inspection by the breeder revealed that the feed trough outlet in this cage was clogged with clumps of feed, leading to insufficient feed supply. After cleaning, the feed intake rate returned to normal within two hours, preventing growth retardation caused by insufficient feed intake in this cage.

[0351] To fully verify the system's actual effectiveness, the research team selected the 11th breeding shed in the same farm as a control group, using traditional manual counting and fixed threshold detection methods to monitor abnormal feed intake. Table 1 shows the comparative data of the two methods over a continuous 25-day experiment during the test period:

[0352] Table 1:

[0353] index Example (Building 12) Comparative Example (Building 11) Total number of anomaly detections 45 times 30 times Number of correct identifications 42 times 16 times False negative rate 6.7% 31.2% False alarm rate 3.9% 20.4% Average response time lead 1 hour 51 minutes 15 minutes Accuracy in identifying rare anomalies (such as low resource consumption and anomaly clustering). 94.1% 60.3%

[0354] The comparative data shows that the method of this invention outperforms traditional methods in terms of recognition accuracy, response speed, false negative rate, and detection of rare anomalies. Especially in the detection of low-frequency anomalous behavior, the recognition accuracy of the method of this invention is 94.1%, far exceeding the 60.3% of traditional methods. This fully demonstrates the superiority of spatiotemporal graph reasoning and adaptive thresholding mechanisms in handling sparse anomalies.

[0355] A graph neural network-based system for detecting abnormal feed intake in caged broiler chickens includes a data acquisition and processing module, a target tracking and counting module, a graph structure construction module, a graph neural network inference module, and an adaptive anomaly detection module.

[0356] The data acquisition and processing module is used to acquire feed images, broiler images in cages, and multi-dimensional environmental data; it performs grayscale processing on color images and Gaussian filtering for noise reduction; it performs threshold segmentation and edge extraction on depth images to obtain the feed trough outline; it performs two-point calibration and smoothing processing on environmental data; and it calculates the remaining feed volume and feed consumption rate by combining depth images and image features, and finally outputs standardized feature data.

[0357] The target tracking and counting module is used to acquire samples covering the entire scenario of caged broiler counting and build a YOLOv11-DO model adapted for target detection of caged broilers. This model is used to collect broiler target detection in cage images in real time and accurately output the number of broilers in each cage.

[0358] The graph structure construction module is used to treat each cage as an independent node and integrate information such as feed volume, feed consumption rate, multi-dimensional environmental parameters, number of broiler individuals, and broiler breed of the cage to form a node feature vector. The weighted graph structure data and adjacency matrix are constructed through the node feature vector.

[0359] The graph neural network inference module is used to input graph structure data into the ST-GATNet model, aggregate the spatial and temporal features of cage positions through spatiotemporal graph convolutional layers, and mine the spatiotemporal dependencies between cage positions by combining multi-head attention mechanism and gated recurrent unit, and finally output the feeding abnormality probability of each cage position.

[0360] The adaptive anomaly detection module dynamically calculates the detection threshold based on the global feeding status, the situation of adjacent cages, and seasonal factors. It compares the anomaly probability of each cage with the corresponding threshold. When the anomaly probability exceeds the threshold, an alarm is triggered, and information such as the abnormal cage number, real-time environmental data, and image snapshots are simultaneously pushed to the monitoring terminal.

[0361] The standardized feature data includes feed condition data, environmental data, and profile feature data.

[0362] This invention proposes a context-adaptive anomaly detection mechanism and a focus loss optimization strategy to improve the ability to identify rare feeding anomalies. Existing technologies generally use fixed thresholds, leading to frequent false negatives and false negatives, and are difficult to deal with the problem of sample imbalance. This invention dynamically adjusts the detection threshold by integrating global feeding status, adjacent cage conditions, and seasonal factors, and strengthens the weight of abnormal samples by combining focus loss. It constructs a closed-loop mechanism for anomaly probability calculation, dynamic threshold matching, and anomaly type tracing, which enables precise identification of weak signal anomalies such as low consumption, rapid consumption, and abnormal clustering, effectively mitigating the performance deviation caused by sample imbalance.

[0363] In summary, this application employs a combination of multimodal data acquisition and graph neural network inference to accurately monitor the feeding behavior, environmental parameters, and feed consumption of caged broilers, and dynamically adjusts anomaly detection standards through adaptive thresholds. Compared with existing technologies, this invention achieves efficient system integration, accurate anomaly detection, and intelligent decision-making, thereby improving breeding efficiency, reducing human intervention, and ensuring the healthy growth of chickens.

[0364] This embodiment also provides a computer device applicable to a method for detecting abnormal feeding in caged broilers based on graph neural networks, including a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to realize the method for detecting abnormal feeding in caged broilers based on graph neural networks as proposed in the above embodiment.

[0365] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a method for detecting abnormal feeding in caged broilers based on a graph neural network as proposed in the above embodiment.

[0366] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0367] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0368] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0369] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0370] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0371] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for detecting abnormal feed intake in caged broiler chickens based on graph neural networks, characterized in that: Includes the following steps: S1. Collect feed images, broiler images in cages, and multidimensional environmental data to form a database. After processing the database, output standardized feed status data, environmental data, and contour feature data. S2. Obtain samples from the processed database covering the entire scenario of counting caged broilers, construct a YOLOv11-DO model for target detection of caged broilers, and output the number of broilers in each cage using this model. S3. Treat each cage as an independent node, and integrate the feed status data, environmental data, number of broiler individuals, and broiler breed information of that cage to form a node feature vector. Construct a weighted graph structure data and adjacency matrix through the node feature vector. S4. Input the graph structure data into the ST-GATNet model, aggregate the spatial and temporal features of the cage positions through the spatiotemporal graph convolutional layer, and combine the multi-head attention mechanism and gated recurrent unit to mine the spatiotemporal dependencies between the cage positions and obtain the feeding abnormality probability of each cage position. S5. Based on the global feeding status, the situation of adjacent cages and seasonal factors, obtain dynamic judgment thresholds, and classify the abnormal feeding probability of each cage with alarms. At the same time, push the abnormal cage number, real-time environmental data and image snapshot information to the monitoring terminal.

2. The method for detecting abnormal feed intake in caged broilers based on graph neural networks according to claim 1, characterized in that: S1 includes: S11. When the inspection vehicle reaches the target cage, it triggers data acquisition. The RGB-D camera collects color images of the feed and corresponding depth images in real time. At the same time, the environmental sensor collects multi-dimensional environmental data such as temperature, humidity, gas, and wind speed. S12. Convert the color image of the feed in the target cage into a grayscale image, and compress the three-dimensional color information into one-dimensional grayscale features. S13. The grayscale image is smoothed and denoised by Gaussian filtering; S14. Enhance the image and improve the contrast of the denoised grayscale image; S15. Perform edge detection on the grayscale image after contrast enhancement, extract the closed edge between the feed trough and the feed surface, obtain the binarized edge map of the target feed trough area, and output standardized contour feature data. S16. Based on the edge map, perform feature calculations to obtain feed parameters within the track: area, perimeter, centroid coordinates, and shape factor, and output standardized feed state data; S17. The multidimensional environmental data is calibrated and smoothed, and standardized environmental data is output.

3. The method for detecting abnormal feed intake in caged broilers based on graph neural networks according to claim 2, characterized in that: S15 includes: S151. Perform gradient calculation on the image, using the Sobel operator to calculate the gradient components in the x and y directions respectively: , ; (3) in, This represents the convolution operation. This is the preprocessed grayscale image; The gradient magnitude of each pixel is calculated using the gradient magnitude formula. and direction : ; (4); S152. Perform non-maximum suppression processing on the image along the gradient direction. Compare the gradient magnitude of the current pixel with the gradient magnitude of its two adjacent pixels along the gradient direction. If the gradient value of the current pixel is not a local maximum, set its value to zero. S153. Perform Otsu's double threshold detection on the image and set a high threshold. and low threshold ,in This is used to distinguish between pixels with strong edges, weak edges, and non-edges. The classification rules are as follows: When gradient magnitude When this happens, mark the pixel as a strong edge; when When this occurs, it is marked as a weak edge; when When the pixel is considered non-edge, it is discarded. S154. Perform edge connection on the image. Starting from a strong edge pixel, sample and check if there are connected weak edge pixels in its 8-neighborhood. If a weak edge pixel is connected to any strong edge, it is determined to be part of the real edge and is retained; otherwise, it is discarded to obtain a continuous and closed trough contour edge. The threshold is adaptively selected based on Otsu's method. The segmentation threshold with the largest inter-class variance is calculated using the gradient magnitude distribution of the entire image, and then multiplied by an adjustment coefficient to obtain a high threshold. Adaptive estimation: ; (5) in, The average gradient magnitude. denoted as the standard deviation of the gradient magnitude, and k is an empirical adjustment coefficient, ranging from 1.5 to 2.

5. S155. After performing edge detection based on the grayscale image, obtain a binarized edge map of the target material tank area; S156. For the edge map, extract the contour, use the 8-neighborhood connectivity algorithm to find closed contour curves, identify and determine the complete contour, and then output standardized contour feature data.

4. The method for detecting abnormal feed intake in caged broilers based on graph neural networks according to claim 2, characterized in that: S2 includes: S21. Obtain samples covering the entire scenario of caged broiler counting, including typical lighting and density scenarios in chicken houses; record supplementary information, binding metadata such as cage number, broiler age, and real-time temperature and humidity to each image; S22. Construct a dataset based on the samples and divide the dataset; S23. Perform image enhancement and data cleaning on the dataset; S24. Construct a YOLOv11-DO model adapted for target detection in caged broiler chickens. S25. Train the YOLOv11-DO model; S26. Verify the YOLOv11-DO model to ensure that the model is suitable for practical applications; Preferably, the method for partitioning the dataset in S22 includes: S221. The LabelImg annotation tool is used to annotate the image data, and the minimum bounding rectangle of each broiler chicken is annotated in VOC format. During the annotation process, the chicken's head is used as the core to determine the selection range, so that individuals can still be identified by head features even when occluded. For broilers with an occlusion area greater than 70%, depth information from the RGB-D camera is used to assist in annotation. After annotation, duplicate annotations are filtered by an IOU threshold ≥ 0.85, and the annotation box with the highest confidence is retained. Then, three breeding technicians cross-validate to ensure that the annotation accuracy is > 99%. S222. Split the dataset: Divide the input data into a 70% training set, 20% validation set, and 10% test set. Preferably, the method for constructing a YOLOv11-DO model adapted for target detection in caged broiler chickens in S24 is as follows: The YOLOv11-DO model architecture is divided into three parts: feature extraction, feature enhancement, and optimized detection head. The feature map size and number of channels in each layer satisfy the following: ; (16) For the first Layer size, For the first Layer downsampling rate, For the number of channels, This is the channel variation coefficient; S241. The feature extraction includes: using the C3k2 parallel convolution module and C2PSA attention module of YOLOv11 to extract features step by step from the input image; adapting the input image to the resolution of the RGB-D camera, adjusting the 5th downsampling layer of YOLOv11, and adjusting the size of the input image from 640×640 to 640×480; S242. The feature enhancement includes: inserting a depthwise parameterized depthwise convolutional layer after the C2PSA module. The structure of this layer achieves feature enhancement through three convolutional operations: First, a 1×1 convolution is performed to compress the high-dimensional features output by the C2PSA module to 64 channels, achieving dimensionality reduction and feature fusion; then, a 3×3 depthwise convolution is used to refine the local features of each channel, focusing on capturing differential information such as the edges and textures of overlapping chickens; finally, a 1×1 convolution is used to increase the number of feature channels to 128 channels, restoring the feature expressive power while completing feature reorganization. S243. The optimized detection head includes: replacing the SiLU activation function with the ELU function, the function expression of which is: ; (17) Where α = 1.0; Preferably, the method for training the YOLOv11-DO model in S25 is as follows: S251, Training Parameters: Input the preprocessed training and validation sets into the model, and use the SGD optimizer with momentum and weight decay to achieve stable convergence in small sample scenarios. The parameter update formula is: ; (18) in, For the updated parameters, For the current parameter, The initial learning rate, =0.001, This is the momentum factor, with a value of 0.

937. For historical momentum, The gradient of the loss function. This is the weight decay factor, with a value of 0.0005; The training pace is controlled using a stepped decay method, with the decay formula as follows: ; (19) in, For the first Round learning rate, The initial learning rate; The training batch size is set to 32, and the inference batch size is set to 1 to meet the single-frame processing requirements of real-time inspection. The loss function uses a weighted combination of CIoU loss and cross-entropy loss, and the total loss function formula is as follows: ; (20) Here, weights of 5.0 and 1.0 correspond to the importance of the regression and classification branches, respectively. . CIoU loss is used to optimize bounding box regression in occluded scenes. The CIoU loss formula is: ; (21) in, The intersection-union ratio (IU) of the predicted bounding box and the ground truth bounding box. The Euclidean distance between the center points of the two frames is... The length of the diagonal of the smallest rectangle enclosing the two frames. The balance coefficient is determined by... Calculated , is the aspect ratio consistency parameter, where w represents the width of the botnet detection box predicted by the model, and n represents the height of the botnet detection box predicted by the model. This represents the width of the actual frame of the broiler chicken, as labeled manually. This represents the height of the actual frame of the broiler chicken, as manually labeled. Cross-entropy loss optimizes the confidence score for broiler chicken classification. The formula for cross-entropy loss is: ;(22) in, This refers to the number of test frames per batch. For real labels, The classification confidence score predicted by the model; S252, Iterative Training: Each training round includes four steps: forward inference of the model output detection box and confidence, loss calculation of quantified prediction bias, backpropagation of automatic differentiation and gradient calculation, and parameter update of SGD optimizer iteration, for a total of 300 rounds of training. S253. Training process control includes: real-time monitoring of the loss value, core target detection metrics, and counting accuracy of the training or validation set using TensorBoard; early stopping mechanism to avoid overfitting; and reduced computational load through structured pruning after training. Preferably, the verification method for the model described in S26 is as follows: S261. Obtain the detection indicators: mAP@0.5 ; S262. Obtaining accuracy: The calculation formula is as follows: ; (23) Among them, TP refers to targets that are correctly detected as broiler chickens, and FP refers to targets that are mistakenly detected as broiler chickens, such as dust, feed residue, and cage screen shadows. S263. Obtaining Recall Rate: The calculation formula is as follows: ; (24) Here, FN refers to real botnets that were not detected by the model, and TP refers to targets that were correctly detected as botnets.

5. The method for detecting abnormal feed intake in caged broilers based on graph neural networks according to claim 1, characterized in that: S3 includes: S31. Obtain the node vector: Each cage is treated as an independent node, and information such as feed volume, feed consumption rate, multi-dimensional environmental parameters, number of broilers, and broiler breed are integrated to form a node feature vector. The node feature vector comprehensively reflects the cage status and is defined as follows: ; (25) in, The remaining feed volume in the i-th cage position, in L. Feed consumption rate, unit: L / h Ambient temperature, unit: °C. Ambient humidity, unit: %RH This refers to the number of individual broiler chickens. It is a broiler chicken breed. As growth indicators, all features have been normalized using the min-max method. S32. Obtain weighted graph structure data through the node feature vectors; S33. Construct the adjacency matrix: Store it in a compressed sparse row format, with a size of [size missing]. ,in The total number of cages is used to store only non-zero weight values; Preferably, the method of S32 includes: The weight design comprehensively considers three types of relationships and achieves the quantification of spatiotemporal dependence through weighted summation: S321. Edge weights of spatial adjacency relationships For adjacent cages in the same row or adjacent cages on the same floor, due to similar environmental conditions and potential cross-influence between broilers, the edge weights are based on Euclidean distance. calculate: ; (26) in, Indicates cage position and cage space The Euclidean distance between them; S322, Edge weights of partitioning relationships Cages belonging to the same temperature control zone have strong correlation in their environmental parameters, and edge weights are based on zone membership. ; (27) Among them, cage position and Whether they are in the same or adjacent zones is determined based on the zoning information of the chicken coop; S323, Edge weights of time-continuous relationships The cage position data detected sequentially within the same inspection cycle are time-related, and the edge weights are inversely proportional to the time interval. calculate: ; (28) in, It is a cage position and The time interval between them is in hours; The final weights are: ; (29) Where α=0.5, β=0.3, and γ=0.2 are weighting coefficients.

6. The method for detecting abnormal feed intake in caged broilers based on graph neural networks according to claim 1, characterized in that: S4 includes: S41. Input the graph structure data into the ST-GATNet model. The ST-GATNet model architecture includes an input layer, a spatiotemporal graph convolutional layer, a multi-head attention layer, a spatiotemporal fusion module, and an output layer. The specific structure is as follows: Input layer: The input layer receives the feature matrix of the nodes. Where N is the number of nodes, F=7 is the feature dimension; normalized adjacency matrix The normalization formula for the adjacency matrix is: ; (30) in , It is the identity matrix. This is the original adjacency matrix. for The corresponding degree matrix; R represents the set of real numbers. Spatiotemporal graph convolutional layer: fuses spatial and temporal features; the convolution operation formula is as follows: ; (31) in, For the first Layer feature matrix, For learnable weight matrix, The LeakyReLU activation function is given by the following formula: ; (32) in, The output feature value of the convolutional layer is 0.2, which is the slope parameter of the negative half axis of the function. Multi-head attention layer: Four attention heads are set up to focus on different types of neighbor associations in parallel, and the output features are concatenated and then dimensionality reduced. ; (33) in =4 is the number of heads. For the first Nodes in the head To the neighbors Attention coefficients normalized by the Softmax function, For the first Layer nodes eigenvectors; Spatiotemporal fusion module: Employs gated loop units to process temporal features and integrate historical inspection data. ; (34) in, for Hide your status at all times. for Input features at all times; Output layer: The Sigmoid activation function is used to output the probability of feeding abnormality for each cage. The Sigmoid function restricts the output value to the range [0, 1], representing the probability of feeding abnormality occurring in each cage. ; (35) in, To output the weight matrix, The number of network layers (set to 2). For network feature representation, For the first The probability of abnormal feeding in each cage; S42. Train the model from S41: The model training employs focus loss to address class imbalance, particularly for classifying rare outliers. The focus loss formula is as follows: ; (36) in, As a class balance factor, The modulation factor is used. The model is trained using the Adam optimizer with an initial learning rate of 0.001, a batch size of 64, and 200 training rounds.

7. The method for detecting abnormal feed intake in caged broilers based on graph neural networks according to claim 1, characterized in that: S5 includes: S51. Obtain the global feeding rate deviation. S52. Obtain the average anomaly probability of adjacent cage positions. S53, the threshold for determining the dynamic position of the cage; S54. Detect abnormal feeding conditions in cages and trigger an alarm: S55. Identify anomaly types through feature patterns; Preferably, S51 includes: The formula for obtaining the change in current feeding rate compared to the historical average feeding rate over the past 7 days is: ; (37) in This represents the current global average feeding rate. This is the historical average rate for the same period over the past 7 days; Preferably, S53 includes: The threshold is dynamically determined using a formula, which is: ; (39) in, , is the initial threshold for the dynamic determination threshold of this cage position; The global feeding rate deviation reflects the overall feeding status; The average feeding abnormality probability of adjacent cages is used to capture locally correlated anomalies. , All are weighting coefficients; Season is the seasonal factor; Preferably, S54 includes: S541, Probability of Abnormal Feeding in Cages With dynamic judgment threshold Compare and determine abnormal situations. when When the feeding is deemed abnormal, multiple alarm levels are triggered: when At this time, a yellow alert is issued, urging attention. when A red alarm will sound, requiring immediate action. S542. Alarm information includes the abnormal cage number, occurrence time, abnormal probability, current feed volume, consumption rate, real-time temperature and humidity, and automatically saves an RGB-D image snapshot of the corresponding cage containing depth data. Preferably, S55 includes: Low consumption anomaly: Feed consumption rate in the current cage space ,in This represents the average consumption rate of this cage over the same period over the past 7 days. Rapid consumption exception: , ; Abnormal clustering: When three or more adjacent cages in the same space and time trigger a red alarm simultaneously, it indicates an abnormal regional environment or a group problem, requiring regional investigation.

8. A system for detecting abnormal feed intake in caged broiler chickens based on graph neural networks, characterized in that: include The data acquisition and processing module is used to acquire feed images, broiler images in cages, and multi-dimensional environmental data; it performs grayscale processing on color images and Gaussian filtering for noise reduction; it performs threshold segmentation and edge extraction on depth images to obtain the feed trough outline; it performs two-point calibration and smoothing processing on environmental data; and it calculates the remaining feed volume and feed consumption rate by combining depth images and image features, and finally outputs standardized feature data. The target tracking and counting module is used to acquire samples covering the entire scenario of caged broiler counting and build a YOLOv11-DO model adapted for target detection of caged broilers. This model is used to collect broiler target detection in cage images in real time and accurately output the number of broilers in each cage. The graph structure construction module is used to treat each cage as an independent node and integrate information such as feed volume, feed consumption rate, multi-dimensional environmental parameters, number of broiler individuals, and broiler breed of the cage to form a node feature vector. The weighted graph structure data and adjacency matrix are constructed through the node feature vector. The graph neural network inference module is used to input graph structure data into the ST-GATNet model, aggregate the spatial and temporal features of cage positions through spatiotemporal graph convolutional layers, and mine the spatiotemporal dependencies between cage positions by combining multi-head attention mechanism and gated recurrent unit, and finally output the feeding abnormality probability of each cage position. The adaptive anomaly detection module dynamically calculates the detection threshold based on the global feeding status, the situation of adjacent cages, and seasonal factors. It compares the anomaly probability of each cage with the corresponding threshold. When the anomaly probability exceeds the threshold, an alarm is triggered, and information such as the abnormal cage number, real-time environmental data, and image snapshots are simultaneously pushed to the monitoring terminal.

9. A graph neural network-based abnormal feed intake detection system for caged broiler chickens according to claim 8, characterized in that: The standardized feature data includes feed condition data, environmental data, and profile feature data.

10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.