I. INTRODUCTION
The welfare of all farmed livestock is of importance to the consuming public. Australian consumers especially have some concerns about welfare within more intensive animal production systems, such as commercial egg farms (Rachel et al., 2017). Most consider cage-free and free-range production systems to be more `natural` and associate this with `good` animal welfare (Buddle et al., 2021). Commercial egg farms experiencing smothering and mortality events as a result of pile-ups experience reduced egg production and risk social licence from compromised animal welfare. Pile-ups occur when a group of hens increasingly cluster together within a small space, which can progress to smothering and death. Recurring pile-ups seem more prevalent on some farms and in some sheds. Birds that do not die can suffer in other ways including heat stress, injury and increase fear responses (Gray et al., 2020). Risk factors for pile-ups include several environmental factors (including light and temperature), shed infrastructure, genetics and sudden disturbances resulting in the mass movement and/or attraction (Gray et al., 2020).
The monitoring of bird welfare is a challenging task on large egg farms that have tens of thousands of birds per shed. For this reason, an increasing number of Precision Livestock Farming methods have recently been developed (Dawkins, et al., 2013). Specifically, density estimation technologies provide the potential for non-intrusive and continuous monitoring and management support on egg farms by providing effective auto-analysis focused on animal welfare and egg production.
In this paper, we present our applied computer vision and machine learning techniques that operate within a video-based monitoring system to enable dynamic estimates of the local density of birds at any time and place. Using low-cost equipment, the system can work continuously giving real-time information. This means that high-density ‘problem’ areas can be effectively detected without labour, and mitigating steps taken in response in a timely fashion.
II. METHOD
Our system is based on crowd counting and automated region analysis from video streams. To effectively estimate the flock density, a top-view video camera is mounted to capture the video footage, as illustrated in Figure 1. Such a view setting can avoid occlusion and enlarge the observation area. The video camera is connected to a desktop, which provides backend computation and communication. The live video feed is analysed in real-time, providing the essential density estimates and monitoring to prevent pile-ups.
Figure 1 - The camera setting.
Figure 2 - An illustration of k-means on 2D coordinates.
The backend computational model is data-driven, which requires image data collection and manual annotation. To do this, we set up two cameras on a commercial egg farm in Windsor, NSW to collect video data. One camera was mounted in the shed, and the other was mounted on a pole in the open area outside the shed with the cameras covering 15m2 and 40m2 for indoor and outdoor environments respectively. After annotation of each observable bird on sampled images, we built a simple crowd-counting model as described by Wang (Wang et al.). Given an image, the model outputs a density map of the same size, where the value of each pixel represents the probability of an object instance, i.e., a bird in our case. The summation of the values across the whole density map is the total number of observable instances. However, alone, it cannot identify the specific region within the field of vision where maximal density occurred; this is the key indicator of risk for potential pile-ups (the ratio of count and area). Hence, we applied the k-means cluster algorithm on the density map, and then counted the birds in each cluster to calculate the bird density separately. Note that the k-means requires several iterations to identify and calculate clusters, which does not support the real-time computation of frame streams. Also, when the seeds of the randomly selected centroids are initialized differently, the final clusters are different. However, given there are only minor motion differences between any two consecutive frames, we only need to update the cluster centroids once within each frame and the next iteration uses the current cluster centroid as the starting point. In the 2D clustering, each bird is allocated to a cluster, which is represented as a circle. So, the density can be estimated by the ratio between the number of observable birds within the circle and its area. When there is an observable pile-up event, the bird density becomes very high in the specific area within camera coverage. In our camera setting, the top-down camera has spatial distortions, i.e., the observation area is not an exact rectangle. We used a scale mask for each cluster, that adjusts the image according to the relative position and angle of the camera, to control spatial distortions and thereby ensure the same area is used to give more accurate density estimations.
III. RESULTS
Based on the design and development of the system, we conducted a case study for bird density estimation. Figure 3 shows the visualization of the density measured in both indoor and outdoor environments. In the two cases, the cameras are 2.5 and 3.5 metres high, covering about 15m2 and 40m2 areas, respectively. In our setting, we set the number of clusters to 5, and the realtime calculation only returns the cluster with the maximal density. The maximal densities are 5 and 7 birds per square metre for indoor and outdoor environments respectively.
Figure 3 - The visualization of density estimations in both indoor (left) and outdoor (right) environments.
The system has a very high computation performance using low-cost hardware; it can process video streams with 30 frames per second (FPS), thereby enabling real-time monitoring. In Figure 4, we show the statistics for dynamic density estimation for a given day from the sampled video streams. We did not observe any pile-ups during the video recording, however, the real-time density monitoring capability identified potential for pile-ups by flagging densities above a user-defined threshold density. If the observed density is above the threshold, the system can give an early warning to help prevent piling behaviours.
Figure 4 - The density estimation statistics in both indoor (left) and outdoor (right) environments, where the horizontal axis represents the recorded time, and the vertical axis represent the maximal density (number of birds/m2) within the observable area.
IV. DISCUSSION AND CONCLUSION
In this paper, we have proposed applying advanced computer vision and machine learning techniques to monitor bird densities in commercial egg farms. With automated observation and analysis, the system has the potential to help monitor animal welfare and improve the productivity and hen welfare on commercial egg farms in Australia.
ACKNOWLEDGEMENT: The authors are grateful to Australian Eggs for their financial support of this study.
Presented at the 34th Annual Australian Poultry Science Symposium 2023. For information on the next edition, click here.