1. Introduction
The significance of the poultry industry in the global food chain has grown exponentially, providing a vital source of nutrition and protein for the burgeoning human population. This is largely due to their accelerated growth cycle and more efficient feed conversion compared to those of large-scale livestock. Concurrently, consumer perceptions of poultry have been shaped by a multitude of factors, such as health awareness, product quality and safety, and the ethical dimensions of animal welfare [
1,
2]. “On-farm mortality”, which refers to the uncontrolled death of animals within the farming environment, is a pivotal indicator of broiler welfare. High rates of on-farm mortality not only signal poor environmental management and disease prevention strategies but also reflect a compromised state of welfare for the broilers. In particular, mitigating on-farm mortality through enhanced management practices and health monitoring can significantly improve the overall welfare of broilers.
Mortality among broilers within poultry farms is predominantly driven by two key factors: stress and disease. Stressful conditions may arise from genetic predispositions and environmental stressors, including temperature fluctuations, overcrowding, a lack of environmental enrichment, and compromised air quality, as well as the disruptive effects of human presence [
3]. Concurrently, a spectrum of diseases, including lameness, cardiovascular issues, ascites, respiratory infections, and the pervasive risk of avian influenza, also contribute to broiler mortality [
4]. The decomposition of dead broilers within the farm releases harmful gases, which not only diminish the welfare of the live broilers but also serve as a catalyst for disease transmission, thereby escalating the cycle of mortality. It is thus of great importance to implement effective identification and removal protocols for dead broilers to mitigate these risks and enhance the overall welfare and management of the broilers.
The identification of dead broilers has traditionally been carried out by manual observation, which is notably labor-intensive and time-consuming. This method exposes breeders to health and safety hazards, especially in the large-scale poultry farms. The emergence of precision livestock farming (PLF), in conjunction with the growing scarcity of the labor force in poultry operations, has highlighted the urgent necessity for automated systems to adeptly monitor and manage the health of poultry. In response to this need, researchers have introduced a variety of methods, including machine vision technology, acoustic perception technology, and accelerometer technology, to identify dead or sick poultry within a flock.
Machine vision technology, characterized by its low invasiveness, high efficiency, and low cost, is widely used in poultry information perception tasks, including the detection of poultry diseases and mortality. In the early stages, image processing methods were the main method to identify sick poultry based on variations in their physical appearance and behavioral patterns. Researchers extracted and analyzed shape geometric features and motion features of poultry from the images, classifying them with classification algorithm to identify the diseased poultry [
5,
6]. With the introduction of deep learning technology into the agricultural field, researchers have combined deep learning and image processing technology to solve the problem of poultry health identification in complex scenarios, as deep learning has demonstrated great capability in feature extraction and target recognition [
7]. Aydin et al. [
8] extracted and analyzed the relationship between the gait features, such as speed, stride length, and step frequency, of broilers during walking and the degree of lameness using image processing methods. The results showed that there was an important relationship between the extracted features and the lameness of broilers. Sadeghi et al. [
9] extracted statistical features from the thermal images of broilers, achieving 97.2% and 100% accuracy using an SVM algorithm for classifying broilers with avian influenza and Newcastle disease. Vandana at al. [
10] constructed an abnormal chicken feces classification model based on the EfficientNetB7 network, thereby identifying diseases such as salmonella, Newcastle, and coccidiosis in chickens. In the aforementioned studies on the identification of diseased poultry based on vision, researchers often identify poultry diseases by extracting dynamic or static features of the poultry. However, in the identification of dead poultry, only static features of the poultry are used for the identification [
11,
12].
Acoustic perception is also considered promising as a low invasiveness and low-cost technology. Researchers employed sound sensor technology and CNNs to identify abnormal sounds emitted by poultry, thereby achieving monitoring the diseases with classification methods [
13,
14]. Cuan et al. [
15] employed a bidirectional long short-term memory (BiLSTM) model to analyze audio features extracted from the vocalizations of the birds to identify Newcastle disease in poultry. Bhandekar et al. [
16] processed the captured chicken vocalizations with the mel-frequency cepstral coefficients method and classified them with the SVM model to detect the abnormal chickens. Both reports achieved good performance in identifying sick chickens. However, it appears that acoustic perception technology was ineffective for detecting the dead poultry, as the dead poultry did not produce any abnormal sounds.
Accelerometer technology was primarily used in studies on the behavior and health identification of large livestock (pigs, cattle, sheep, etc.). Due to economic and practical considerations, it was less commonly applied in the study of poultry behavior and disease detection. Mei et al. [
17] leveraged three-dimensional acceleration data, collected through wearable accelerometers, to identify aflatoxin-poisoned broilers. Bao et al. [
18] attached sensor-laden foot rings to each chicken to automatically collect three-dimensional acceleration and displacement data of the broilers. The method achieved an accuracy rate of 100% in the detection of dead chickens. However, due to the economic costs, wearable sensor technology remained largely confined to the laboratory stage, which appeared not to be promising for practical applications on commercial farms.
Machine-vision-based techniques for identifying dead broilers have the advantages of being low cost and less instructive for the poultry flocks. However, in the field of dead poultry identification, visual-based methods mainly focus on identifying dead poultry by recognizing the morphological features of the poultry—in other words, static features. There have been no reports on a study that combines machine vision with the movement information of broilers for the identification of dead broilers. Optical flow estimation captures the motion information of objects in a scene by analyzing the displacement of pixels in an image over time [
19]. It is very promising for identifying body movements of broilers in flocks [
20]. Consequently, the aim of this study is to propose a method for identifying dead broilers based on video and historical movement information, mimicking the manual observation of broiler movement to determine dead broilers in the flock. We analyze the movement status of each broiler in a video to achieve the identification of dead broilers.
2. Materials and Methods
2.1. Video Collection
Broiler video collection work was conducted from 17 November to 14 December 2023 at a commercial broiler farm in YanTai, Shandong Province, China. The farm’s coops housed an average of 14,000 white-feather broilers, with each cage containing 60 to 70 individuals, complete with an incandescent light and 2 feed trays. Male broilers and female broilers were co-raised in the cages. For the video recording, an industrial camera (HIKROBOT China Inc., MV-CA023-10UC, Hangzhou, China) was mounted on a tripod to capture videos from outside the cage. The camera was connected to a laptop computer, enabling the capture of RGB videos at a rate of 32 frames per second. The exposure time of the camera was manually adjusted to suit the varying light intensities in different cages. The video collection focused on the period from the 15th to the 41st day of the broilers’ growth cycle. A total of 98 videos containing dead broilers were recorded, ranging in length from 1 to 2.5 min, and more than 200 videos without dead broilers.
2.2. Overall Technical Route
The purpose of this study was to employ a video method for the identification of dead broilers within poultry flocks. The pipeline of the proposed method is depicted in
Figure 1. Key frames were first extracted from the broiler videos using the inter-frame maximum method. Then, we used the average optical flow intensity (AOFI) value threshold to evaluate the movement of broilers in each key frame and classified the broilers into active broilers and candidate dead broilers. The AOFI value was defined based on optical flow estimation and broiler mask segmentation. Finally, we counted the frequency at which each broiler was determined to be a candidate dead broiler in all key frames and made the final determination of dead broilers based on the threshold method.
2.3. Key Frame Extraction
The video data collected from the farm usually comprise numerous frames with low variance, which are not effective for optical flow estimation. This is largely attributed to the broilers’ natural behavior of resting for 70–80% of their time [
21] and the limited activity observed in stacked cage housing. Key frames in this study are video frames that contain more information about the movement of broilers. Utilizing key frames rather than the entire video sequence for the identification of dead broilers can significantly decrease the computational load and enhance the efficiency of the identification process. In this research, the frames with average inter-frame differences that reached a local maximum were defined as key frames. The inter-frame maximum method was employed to extract these pivotal frames. The inter-frame difference, which is calculated as the disparity in pixel intensities between two consecutive frames, is described by Equation (1). To reduce noise and prevent the redundant extraction of similar frames, the algorithm incorporated the Hanning window method to smooth the average difference values before identifying local maxima. As a result, the videos were effectively condensed into a curated set of 50 to 100 key frames, which were then advanced to the subsequent stage of analysis.
where (
X,
Y) refers to the width and height of the frame,
f(
x,
y) represents the color value of the pixel point at the coordinates (
x,
y),
n is the sequence number of the video frame, and
D is the inter-frame difference.
2.4. YOLOv8-SP
YOLOv8-seg is a one-stage segmentation algorithm designed for industrial deployment applications, featuring a fast detection speed and high recognition accuracy, and is easy to deploy and apply. It builds upon the YOLOv8 backbone and incorporates a segmentation head inspired by the YOLOACT structure, adding a specialized head branch for mask segmentation. In this study, the YOLOv8-seg algorithm was used to perform segmentation on broilers. Since the videos were captured by an industrial camera positioned outside the cage, broilers appeared smaller in the images when they were further from the camera. The images contained both large targets that were close to the camera and small targets that were further away. To enhance the model’s ability to recognize small objects, this study introduced the parallelized patch-aware attention module to improve the model’s capacity for capturing multi-scale features, thereby boosting its ability to detect small targets. Additionally, within the label assignment strategy of the YOLOv8 network, a custom power transform (PT) function was developed to optimize the overlap matrix. This function aims to further suppress the weight of low-confidence prediction boxes while amplifying the impact of high-quality prediction boxes on the model’s learning performance. The resulting improved segmentation algorithm is referred to as YOLOv8-SP.
2.4.1. Parallelized Patch-Aware Attention Module
The parallelized patch-aware attention (PPA) module was first proposed in infrared small object detection tasks [
22], which employed a parallel multi-branch strategy to improve the accuracy of small object detection. As shown in
Figure 2, the PPA module includes three parallel branches: the local, global, and serial convolution branches. The input features tensor
was first adjusted through a point-wise convolution to obtain
, and then it was processed through each of the three parallel branches to obtain three different feature tensors,
,
, and
. Finally, the outputs of the three branches were summed to obtain the input of the attention mechanisms,
. Specifically, the distinction branch is controlled by the patch size parameter
p, which aggregates and displaces the non-overlapping patches of the feature maps in spatial dimensions and computes the attention matrix between non-overlapping patches to enable local and global feature extraction and interaction. In the attention mechanism module, the feature tensor was successively processed through a one-dimensional feature attention map and a two-dimensional feature attention map to obtain the final output. The process can be summarized as Equations (2) and (3):
where
is the element-wise multiplication,
and
are the feature tensor after channel and spatial selection, respectively,
and
are the rectified linear unit and batch normalization operation, respectively, and
is the final output.
Figure 3 illustrates the architecture of the C2f_PPA module. To improve the model’s capacity for extracting image information, the PPA module was utilized to replace the bottleneck within the C2f module. Consequently, all C2f layers (2, 4, 6, and 8) in the backbone network were substituted with the C2f_PPA module.
2.4.2. Power Transform
The task alignment learning (TAL) technique, proposed in the TOOD [
23], is a method for distributing positive and negative samples. It achieves explicit alignment between two tasks by designing a sample allocation strategy and a task-alignment loss function, which brings the optimal anchors of both tasks closer. The sample allocation strategy introduces the idea of suppressing the classification scores of misaligned anchors while guiding the network to accurately improve the classification of aligned anchors. Building on this idea, the researchers proposed an anchor alignment metric to evaluate the alignment of tasks at the anchor level, which was used for dynamically optimizing predictions for each anchor. In the YOLOv8 network, the TAL concept is applied to align classification and regression tasks. In RTMDet [
24], in response to the difficulty of distinguishing between high-quality and low-quality matches when using generalized IoU as the matching cost, the authors introduced the idea of using the logarithm of IoU as the regression cost, with the following expression:
Inspired by this, to make the matching quality and loss weights of different GT prediction pairs more discriminative, we optimized the overlap calculation function in the alignment metric computation process using a custom power transform (PT) function. This function could further enhance the weight of high-quality predicted boxes while suppressing the influence of low-quality predicted boxes. The function is expressed as follows:
where
T is the customized
IoU threshold.
2.5. Optical Flow Estimation
Optical flow estimation depicts the motion of the pixel points in an image sequence and can provide information, such as motion trajectories and the velocities of objects. In the broiler video, the activity of broilers over a period of time can be estimated by the optical flow estimation of a series of key frames. Traditional optical flow estimation methods perform well in simple scenes and small-motion processing but are not good at handling complex scenes and large-scale motion. The diverse behaviors of broilers and uneven light distribution in the cage create a complex scene that necessitates a more advanced analytical approach.
The recurrent adaptable pyramids with iterative decoding (RAPIDFlow) optical flow estimation network is an efficient and flexible optical flow estimation network that progressively generates highly detailed optical flow estimates through iterative decoding and refinement processes [
25]. As shown in
Figure 4, the architecture of the RAPIDFlow optical flow network mainly consists of two parts: the encoder and decoder. The encoder part employed stem convolution blocks to project the input images into the feature space and repeatedly applied a single recurrent block to generate multi-scale features. The pyramid decoder used iterative refinement applied to feature pyramids to produce highly detailed flow estimations gradually. At the last pyramid level, a convex up-sample module was added to produce sharper flow fields at the original resolution. The RAPIDFlow network is robust to the input size and efficient in the inference process, which has good performance in detecting the small-range motion in the key frames.
2.6. Dataset and Experimental Setup
A total of 770 images were used to construct the segmentation dataset, the majority of which were obtained from video frames that did not contain dead broilers, and a small portion were from images with dead broilers collected by Hao et al. [
26]. Utilizing the Labelme software (5.6.0), each of the broilers present in the images was annotated, with both dead and live broilers uniformly labeled under the category “broiler”. Subsequently, the dataset was structured in accordance with the COCO format and divided into training and validation subsets with an 8:2 ratio, respectively. Evaluation metrics, including precision, recall, and mean average precision (mAP), were chosen to verify the performance of the proposed broiler segmentation model.
All of the training work was implemented on a desktop computer with a GeForce RTX3090 GPU (24GB) and an Intel i9-12000k
[email protected]. In terms of the runtime environment, the model was trained on an Ubuntu 20.04 system with PyTorch version 1.13. The input size of the segmentation model was set as 640 × 640 pixels, and the total epoch, batch size, and optimizer were 300, 4, and SGD, respectively. The optical flow network was not trained with a custom dataset but used the pre-trained weight trained on the Sintel optical flow datasets.
2.7. Identification of Dead Broilers
In a sequence of video frames, broilers that display movement are certainly alive and active, while those that do not exhibit movement could either be dead or their movement might have been missed by the video frames. Key frames in a video contain a wealth of motion information about the broilers, allowing their movement over a period to be described by two adjacent key frames. Therefore, the first step was to eliminate the active broilers from the key frames by assessing their movement, retaining those that did not show movement. For ease of description, the latter were defined as candidate dead broilers in this research.
To distinguish active broilers in the key frames from candidate dead broilers, this study defined the AOFI index of broilers to quantify their movement in adjacent key frames.
Figure 5 illustrates the computational flowchart of the AOFI index. The first branch acquired the optical flow maps of adjacent key frames through the RAPIDFlow network, and the second branch used an instance segmentation network to segment and extract the pixel coordinate information of each broiler in the key frame. In particular, to ensure that the pixel values in the optical flow map were proportional to the motion level (i.e., pixels with no motion change had a value of 0, and the more intense the motion, the higher the value), an inverse operation was performed on the optical flow map, followed by the extraction of the gray values. Finally, the AOFI value of a broiler was calculated according to Equation (6). A statistical analysis of AOFI values was performed for both dead and active live broilers to confirm an appropriate threshold for detecting candidate dead broilers in the key frames. After that, the threshold was employed to filter out the active live broilers in each key frame, while retaining the pixel coordinates (mask) of the candidate dead broilers for further analysis.
where
N is the number of pixels in a broiler mask, (
x,
y) are the pixel coordinates of the broiler mask, and
IG is the gray value of the pixel (
x,
y) in the inverted optical flow map.
Typically, inactive live broilers will always show some degree of movement over time, resulting in a higher frequency of movement in all video key frames compared to dead broilers. It was possible to assess the historical movement of each broiler in all key frames to identify the dead broilers. Therefore, the second step in identifying dead broilers was to count the frequency at which each broiler was determined to be a candidate dead broiler in all key frames of the video. To facilitate the counting of the candidate dead broilers in all key frames, as shown in
Figure 6a, the center point of the broiler mask was used to represent the broiler and project all points onto the last key frame of the video to count the frequency with which each broiler was identified as a candidate dead broiler (
Figure 6b). Due to the varying number of key frames extracted from the video sequences, this study defined the frequency at which broilers were identified as candidate dead broilers as the number of times the broilers were judged to be candidate dead broilers divided by the total number of key frames. Algorithm 1 presents the pseudocode for identifying dead broilers in a video.
Algorithm 1. Pseudocode for identifying dead broilers in a video |
1: Procedure DetermineDeadBroiler 2: opticalFlowMap ← RAPIDFlow (RGBImage) 3: binaryMask ← YOLOv8-SP (BinaryImage) 4: keyframes ← Broiler video (RGBImage) 5: for each k in keyframes do 6: for each mask in k do 7: AOFI ← getAOFI (binary mask, opticalFlowMap(k)) 8: if AOFI > 1.1 then 9: continue 10: else 11: centerPoints ← centerPoint (mask) 12: end if 13: end for 14: end for 15: for each mask in lastKeyframe do 16: for each c in centerPoints do 17: nmask ← count_c_in_mask (c, mask) 18: end for 19: end for 20: if nmask/numberOf Keyframes >1/3 then 21: return dead broiler detected 22: end if 23: end procedure |
4. Discussion
4.1. Misclassification of Candidate Dead Broilers
Using the AOFI threshold to identify candidate dead broilers in key frames, the candidate dead broilers usually consisted of both live and dead broilers. The reasons for live broilers being mistakenly identified as candidate dead broilers in key frames can be categorized into two types. First, if a broiler did not move at all during the interval between two adjacent key frames, its AOFI value would be nearly zero, thus being identified as a candidate dead broiler. Second, if a broiler’s movement was minimal or slow, which could not be detected by the optical flow algorithm, resulting in an AOFI value below the threshold, it would be identified as a candidate dead broiler. The first scenario was unavoidable because, in the broiler farm, the movement of broilers in cages was random and uncontrollable. Key frames could not always capture the movement of all broilers simultaneously. Capturing video during periods when the broilers were active could reduce such occurrences. The second scenario frequently occurred with broilers farther from the camera due to perspective effects and shooting angles, which caused their movements to be too small to be detected by the optical flow algorithm. These distant broilers were directly excluded by the algorithm in the identification of the candidate dead broilers. Besides, broilers close to the camera with minimal movements also went undetected by the optical flow algorithm. This issue gradually improved as the broilers aged. As broilers grew older and larger, the body movements caused by their breathing could be detected by the optical flow algorithm, reducing the misidentification of live broilers as candidate dead broilers. To mitigate the second scenario, one could either select an appropriate video capture time or increase the sensitivity of the optical flow algorithm.
The dead broilers in key frames were also sometimes mistakenly classified as live broilers. The primary cause of this issue was the obstruction of dead broilers by live broilers. When the obstruction by live broilers was minimal, the movement of active broilers around the dead broiler could transfer optical flow to the dead broiler, resulting in an abnormal AOFI value. When the obstruction was more severe (with the blocked area greater than half the size of the dead broiler), the segmentation model might fail to accurately segment parts of the dead broiler’s pixels, and the movement of surrounding active broilers would have an even greater impact on the dead broiler’s AOFI value. The misclassification of dead broilers frequently occurred in this study. In each of the videos collected in this study, the ratio of identifying dead broilers as candidate dead broilers never reached 1.0. The results indicated that in all videos, there were always key frames where dead broilers were not correctly classified as candidate dead broilers.
4.2. Cause of False Identification of Dead Broilers
The main reason for the low accuracy in identifying dead broilers was the occlusion caused by other broilers. When a dead broiler is largely occluded, it becomes difficult to accurately segment the dead broiler. Its AOFI value is more susceptible to being influenced by other chickens and might even be missed during segmentation. In the 19 videos where dead broiler identification failed, the dead broilers were obstructed for extended periods, with more than half of their bodies covered. In 10 of these videos, occlusion of the dead broilers was mainly caused by the drinking broilers. Occlusion has consistently been a key factor that hinders the accuracy of poultry health and behavior identification based on video or image analysis. Liu et al. [
29] attempted to identify dead chickens using the YOLOv4 algorithm but failed to recognize dead chickens when their heads and feet were not visible. Nasiri et al. [
30] also reported that their drinking detection algorithm failed to recognize the drinking behavior of broilers when they were standing behind the water line. As the degree of obstruction of dead broilers increased, any vision-based method was believed unable to accurately identify the dead broilers.
4.3. Comparison with Related Studies
Table 4 shows the identification methods and existing issues in previous studies on dead poultry recognition. Researchers primarily utilized the physical appearance or temperature characteristics of poultry to identify the dead poultry [
12,
31]. These dead poultry identification methods, constructed based on color camera sensors and deep learning techniques, usually have the advantages of being efficient, minimally invasive, and easy to deploy. However, in most studies, there is a common issue of difficulty in identifying occluded dead poultry. In addition, our previous research found that some dead broilers in cage-layer housing have appearance characteristics similar to those of normal broilers, leading to missed detections when using appearance-based methods for identifying dead broilers [
26]. As shown in
Figure 13a, in the commercial broiler farm, most dead broilers were found with their chests flipped upwards, displaying a red or brownish-red color, and with their legs exposed, which is distinctly different from the live broilers shown in
Figure 13d. However, as depicted in
Figure 13b,c, some dead broilers were found lying on their chests, making them resemble resting live broilers and causing the algorithm to struggle with accurate identification. The dead broiler identification method proposed in this study was not affected by physical appearance and could effectively identify the dead broilers, similar to the live ones.
4.4. Limits and Further Improvement
Although the research method proposed in this paper could effectively identify dead broilers that were similar in appearance to normal broilers, it, like other vision-based methods, struggled with severely occluded dead ones. However, in practical applications, video-based methods may have stronger robustness against occlusion compared to image-based methods. This is because when the degree of occlusion of dead broilers changes, image-based methods may not have the opportunity to capture images with slighter occlusion to achieve the identification of dead ones. Compared to studies that rely on public datasets or images collected under laboratory conditions for poultry health identification, the approach proposed in this research is more practical for production environments. The videos used in this study were captured at commercial poultry farms, with the collection method strictly following the positions and angles specified by the inspection platform [
26]. From an application perspective, most existing poultry mortality inspection platforms primarily use image-based detection methods to identify the dead poultry. The hardware cost of the method proposed in this study is identical to that of image-based detection, although the algorithm deployment is slightly more complex. Moreover, the inspection strategy for mobile inspection platforms differs: this method requires stopping at each cage for at least one minute to capture video, leading to an increase in inspection time.
To enhance the robustness of the proposed dead broiler identification algorithm, future validation should include more videos. Improvements could involve reducing occlusion and increasing the sensitivity of optical flow estimation. For example, capturing video just before feeding times can prevent drinking broilers from obstructing the view of potential dead ones. Extending the video duration allows live broilers to make more movements. A more precise optical flow estimation algorithm to detect subtle movements, such as those caused by breathing in young broilers, can improve the accuracy of identifying candidate dead broilers in key frames. In the future, we will further consider using video-understanding algorithms to more accurately identify the movements of each broiler, thereby identifying dead broilers in shorter videos.
5. Conclusions
This study presented a novel method for identifying dead broilers on commercial broiler farms. Unlike previous studies that focused on identifying dead poultry based on appearance and temperature anomalies, this research emulated the human approach to identifying dead broilers by analyzing their movements in video footage. A YOLOv8-SP network was developed, and by introducing the PPA module and PT function into the YOLOv8-seg network, the model’s ability to recognize small targets and improve mask quality was significantly enhanced. To describe the movement of broilers between key frames, an AOFI threshold was defined to assess their motion, enabling the preliminary identification of dead broilers. The final identification of dead broilers in the video was determined by calculating the frequency with which each broiler was classified as dead across all key frames.
The identification accuracy of the proposed video-based method was 86.7%. This was primarily due to the fact that our video dataset contained a significant number of occluded dead broilers. Like image-based methods, accurately identifying severely occluded broilers remains a challenge. To further enhance performance, it is recommended to capture broiler videos before feeding times, which would reduce occlusion caused by active broilers. Additionally, employing a more sensitive optical flow algorithm could improve the detection accuracy. Finally, this method may be particularly well suited for flat-raised broilers, as these broilers are housed at a lower density, making them less prone to occlusion.