The laying hen industry is shifting from conventional caged to cage-free (CF) housing due to various welfare concerns and public demand to improve poultry behavior and welfare. The CF housing can improve welfare by providing more space and chances to perform natural behaviors, but there are some serious downsides to bird welfare and problematic behaviors like mislaying eggs due to floor egg-laying behavior of laying hens. Floor egg laying is natural behavior observed in laying hens where they sit on the floor and lay their eggs. However, laying eggs on the floor increases labor demand and economic losses to the producer because floor eggs have higher chances of contamination with harmful bacteria and are not considered table eggs or for direct sale. In addition, floor eggs have a higher chance of getting broken and eaten by laying hens. This study aimed to develop and optimize a deep learning-based detector for monitoring hens’ mislaying behavior on the floor with deep learning technologies.


The experiment was conducted in four identical research CF rooms (200 Hy-Line W-36 hens per room) at the University of Georgia in Athens, GA, USA, and perches and litter floor were provided to mimic commercial tiered aviary system. Birds were raised from days 1 to 350 (75 weeks) in each room, measuring 7.3 m L × 6.1 m W × 3 m H (Figure 1).

Figure 1. Experimental cage-free laying hen facility.

This study used a night-vision network camera (PRO-1080MSB, Swann Communications USA Inc., Santa Fe Springs, LA, USA) to record hens’ behaviors, and recorded videos were converted into image to form a dataset for model development. Each room was equipped with 6 cameras mounted ~3 m above the litter floor, and two cameras above the ground floor placed at 0.5 m from the ground. The detailed process of data collection, labeling, training, validation, testing, and implementation is shown in Figure 2.

Figure 2. Floor egg laying detection workflow.


The test results from the YOLOv5 model comparisons for floor egg laying behavior (FELB) and non-floor egg laying behavior (NFELB) detection are shown in Figure 3. The YOLOv5 model has improved the detection of FELB and NFELB in test data. From the several tested and validated images, the YOLOv5s and YOLOv5m show higher detection accuracy for FELB and NFELB detection, whereas the YOLOv5n resulted in the lowest FELB and NFELB detection. 

Figure 3.  YOLOv5 detection results based on each model used for the same image (pink boxes represent detected floor egg laying behavior (FELB) and red boxes represent detected non-floor egg laying behavior (NFELB)).

Detecting FELB in hens can be more challenging when observed in a group than being observed individually because when multiple hens are in the same area, visual obstructions can make it harder to accurately detect the behavior. Similarly, occlusion can still occur when observing individual hens within a group, making it more difficult to identify the behavior. After training and validating with the YOLOv5s model, group-labeled trained images show higher performance in FELB detection than individuals. The test results are given in Table 1, and the detection of FELB in test data is in Figure 4. The detection of individual object performance decreases due to images occluded by other hens.

Table 1. Performance of the YOLOv5s model in detecting FELB proportion (mAP- mean average precision).

Data summaryPrecision (%)Recall (%)mAP@0.50 (%)mAP@0.50-0.95 (%)
YOLOv5s-individual 97.695.5 98.373.0 
YOLOv5s-group99.898.3 99.5 75.8 

Figure 4. The FELB detected in test data using the YOLOv5s model for different hen proportions: a) individual hen detection; and b) group hens’ detection.


This study trained and tested five deep-learning models based on YOLOv5 structure and then compared them for detecting floor egg-laying behaviors in four cage-free floor-raised rooms present within the research barn. The following conclusions were drawn from this study. A lower camera height (e.g., 0.5 m above the floor) increased the performance of the FELB detection model compared to the ceiling camera (e.g., 3 m above the floor). A dusty environment and dusty camera could affect the detection accuracy; therefore, cleaning a camera is periodically recommended. Further works include model innovation with commercial CF house data and integration of the YOLOv5s-FELB model detector into autonomous for monitoring or collecting mislaid eggs.

Further reading:

Bist, R.B., Yang, X., Subedi, S., Chai, L (2023). Mislaying behavior detection in cage-free hens with deep learning technologies. Poultry Science, 102729.