Next Article in Journal
Spatial Mismatch Between Agricultural Heritage Systems and Eco-Cultural Service Provision in Zhejiang Province, China
Previous Article in Journal
Impact of Soil Development and Land Use on Concentrations of Potentially Toxic Elements in Soils: Insights from a Multi-Scale Study
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Non-Invasive Sex Identification of Early-Stage Poultry Eggs Using Machine Vision

Department of Computer Science, Kristianstad University, 291 88 Kristianstad, Sweden
*
Author to whom correspondence should be addressed.
Current address: Husqvarna Group, 561 82 Huskvarna, Sweden.
Current address: Sigma Lundinova, 224 60 Lund, Sweden.
Agriculture 2026, 16(11), 1196; https://doi.org/10.3390/agriculture16111196
Submission received: 27 February 2026 / Revised: 21 April 2026 / Accepted: 24 May 2026 / Published: 29 May 2026
(This article belongs to the Section Farm Animal Production)

Abstract

The routine culling of day-old male chicks represents a major ethical concern in the poultry industry. This practice has been banned in Germany, and a similar ban is being considered by the European Union. Each year, hundreds of millions of day-old male chicks are culled in the EU, with several billion culled worldwide. Various methods have been developed to determine the sex of chicks before hatching; however, most are invasive and identify sex relatively late, potentially after the onset of pain perception in embryos. Existing approaches include polymerase chain reaction analysis, spectroscopy, analysis of volatile organic compounds, morphological analysis, and machine vision. Previous studies have shown that machine vision can achieve accuracies of up to 89.25% by analyzing blood vessel patterns during early incubation. Despite this potential, research remains limited, particularly regarding different chicken breeds and the temporal development of embryos. In this study, we investigate the impact of both breed variation and temporal information on early-stage sex identification. Image data were collected on incubation days 4, 5, and 6 from a total of 208 chicken eggs. A convolutional neural network (CNN) and a hybrid convolutional neural network–recurrent neural network (CNN–RNN) model were evaluated to analyze spatial and temporal features. The results show that the CNN model achieved an accuracy of up to 71.43%, while the hybrid CNN–RNN model reached 67.85%. These findings indicate that incorporating temporal information did not improve performance compared to the baseline CNN. However, due to the limited size and quality of the dataset, no definitive conclusions can be drawn.

1. Introduction

The routine culling of day-old male chicks represents a major ethical challenge in modern poultry production, affecting millions of animals annually [1]. This has motivated the development of early-stage, non-invasive sex identification methods that can be applied before hatching.
Several approaches have been proposed, including spectroscopic techniques, molecular analysis, and hormone-based methods, many of which achieve high accuracy but are invasive, costly, or limited to later stages of incubation [2,3,4]. More recently, machine vision has emerged as a promising non-invasive alternative, capable of identifying sex at early stages based on embryonic blood vessel patterns [5,6,7]. Embryonic blood vessels become clearly visible around days 4–6 of incubation, making this stage suitable for image-based analysis.
Previous studies have demonstrated encouraging results using deep learning models, with reported accuracies approaching 90% under controlled conditions [5]. However, these studies typically rely on homogeneous datasets collected in laboratory or industrial hatchery environments, where variability in eggshell characteristics, lighting conditions, and image quality is limited. As a result, the generalizability of such models to more realistic settings remains largely untested under more variable, real-world conditions.
In addition, while embryonic development is inherently a temporal process, the potential benefit of incorporating temporal information into machine vision-based sex identification has received limited attention in previous work.
In this study, we address these limitations by investigating early-stage sex identification under more realistic conditions. Specifically, this work (i) uses a heterogeneous dataset collected from multiple chicken breeds under real farm conditions, (ii) evaluates the impact of temporal information using a hybrid convolutional neural network–recurrent neural network (CNN–RNN) approach, and (iii) assesses the generalizability of machine vision models beyond controlled experimental environments.

2. Materials and Methods

This section is organized into four subsections: Data Collection, Built System for Data Collection, Preprocessing, and Machine Learning (ML) Models. Together, these describe the acquisition of the dataset, the technical setup used for imaging, the data preparation steps, and the modeling strategies applied in this study.

2.1. Data Collection

The study was conducted at the Ekebo Fjäderfä farm [8] over an eight-week period in 2024. Three breeds were included: Welsumer, Cream Legbar, and a crossbreed between Smålandshönan and Cream Legbar. These breeds were selected because their sex-specific plumage patterns facilitate post-hatch sex identification, as illustrated in Figure 1.
Welsumer chickens, originating from the Netherlands, produce dark brown eggs, often with speckled shells (Figure 2, right). They lay approximately 230 eggs per year, with an average egg weight of around 60 g. Female chicks can typically be identified by a more pronounced stripe near the eye and a clearer head pattern. Cream Legbar chickens, developed in Great Britain as a crossbreed, produce eggs with a characteristic blue tint (Figure 2, left). On average, they lay about 250 eggs per year, with each egg weighing 55–60 g. Sex differentiation in this breed is possible based on plumage, as males display much lighter coloring compared to females.
The crossbreed used in this study, developed at Ekebo Fjäderfä farm, incorporates the Swedish Smålandshöna breed, which originates from the Leghorn and Rhode Island Red. The eggs of this crossbreed resemble those of the Cream Legbar, and male chicks can be identified by the same plumage characteristics as in the Cream Legbar.
For the experiments, the eggs were incubated using a Brinsea OvaEasy 190 Advance incubator (Brinsea Products Ltd., Weston-super-Mare, UK) [9] in batches of 25–50, each marked with a batch number and egg ID on the blunt end. To preserve natural conditions, the eggs were not cleaned prior to incubation. The incubator was set to 37.7 °C with 40% relative humidity and rotated every 60 min. The temperature settings were selected based on recommendations from previous studies. In total, eight batches were incubated for this investigation.
Images were captured on days 4, 5, and 6 of incubation, which is one day later than in most comparable studies, where day 3 is typically used as the first observation point [5,6,10]. This adjustment was necessary because, in the Welsumer eggs, neither the embryo nor the vascular structures were clearly visible on day 3. Since the analysis also considered temporal aspects using recurrent neural networks (RNNs), the eggs were photographed at 24 h intervals with a precision of ±60 min.
During image acquisition, approximately one-third of each batch was temporarily removed from the incubator. This procedure reflects the natural behavior of brooding hens, which leave their nests intermittently during incubation [11]. To minimize the risk of cooling and maintain appropriate thermal conditions, the eggs were placed on a heating mat while being imaged. Figure 3 illustrates representative images from days 4, 5, and 6, highlighting the progressive development of the embryos and their vascular structures.
The eggs used in this study varied in quality, as they were obtained from a small-scale farm rather than an industrial breeding facility. Some eggs displayed noticeable light and dark shell spots. Approaching the expected hatching day (day 21 of incubation), approximately one third of the eggs from each batch were removed from the incubator for imaging. To maintain appropriate thermal conditions during this process, the eggs were placed on a heating mat. For accurate labeling, all eggs were transferred to nylon mesh bags on day 21 and marked with their respective batch number and egg ID. The sex of the chicks was determined at hatching (day 21) by trained personnel at Ekebo Fjäderfä farm and subsequently documented by the authors.
In total, 271 eggs were incubated across eight batches. Eggs that showed no signs of development were excluded from further observation, and 43 eggs were not assigned a definitive sex due to incomplete development. Eggs without verified sex labels or without complete image series across all three days were omitted from the final dataset. After this filtering, 208 eggs with 624 images (from an initial 790 captured images) remained for analysis. The distribution of incubated eggs across the three breeds is presented in Table 1.

2.2. Built Camera Equipment

To capture images during incubation, a prototype imaging system was developed. The system consisted of three main components: a camera, an egg mount, and an LED array for illumination (Figure 4). The camera was connected to a Raspberry Pi, which transmitted the images to a computer for storage in a database. The database included information on breed, timestamp, and batch. In addition, the Raspberry Pi was used to receive control commands and forward the acquired images to the computer for subsequent analysis.
The plastic components of the imaging device were fabricated using 3D printing with polylactic acid (PLA). The external dimensions of the device were 86 × 172 mm. The distance from the egg holder to the light source was 56 mm, and the distance between the egg holder and the camera lens was 86 mm. The egg holder was designed with an egg-shaped opening to ensure consistent placement of the eggs during image acquisition. Egg positioning was partially standardized using this holder, which helped maintain a similar placement between images. However, egg orientation, including rotation and horizontal alignment, was not strictly controlled across all samples. While images within the same acquisition session were generally consistent, variations occurred between sessions, introducing additional variability in the dataset. For image acquisition, a Raspberry Pi High Quality Camera was connected to a Raspberry Pi Zero 2W (Raspberry Pi Ltd., Cambridge, UK) together with an LED array. The array consisted of a current-dimmable circuit with 12 green LEDs (GT PSLR31.13, OSRAM Opto Semiconductors GmbH, Regensburg, Germany) providing a total luminous flux of 2112 lumens and emitting light at a wavelength of 540 nm. As noted in previous studies, exposure to green light during incubation can promote favorable embryonic development [12,13,14].

2.3. Preprocessing

Several challenges needed to be addressed during preprocessing, particularly the issue of unbalanced lighting resulting from variations in eggshell characteristics. Image preprocessing was carried out using OpenCV (version 4.9.0) and Scikit-image (version 0.23.2).
The main preprocessing workflow, illustrated in Figure 5, comprised four steps:
  • Resizing and padding;
  • Background removal;
  • Histogram matching;
  • Noise reduction and contrast-limited adaptive histogram equalization (CLAHE) [15].
The first step was to resize and pad the images to match the input dimensions of the pretrained models described later in this study. Background removal was then performed using a segmentation model specifically trained for this task.
To account for variations in eggshell appearance, histogram matching was applied. Some eggs exhibited an orange hue, while others appeared dark green; in addition, certain images were slightly overexposed, whereas others were underexposed. To address these differences, the CIELAB color space was employed, which separates the image into L* (luminance), a* (green–red), and b* (blue–yellow) components. Histogram matching was then used to standardize image color and lighting conditions.
Many eggs displayed significant noise in the form of small dark spots or areas where light penetrated the shell unevenly. To mitigate this effect, morphological opening and closing operations were applied, followed by a median blur filter. After noise reduction, CLAHE was applied at a smaller scale to enhance vessel visibility while limiting the amplification of residual noise [15]. Because of the high noise levels in some images, CLAHE could not be applied directly, as it would otherwise amplify noise to the same degree as meaningful features.
Since parts of the dataset contained severe noise in the form of light and dark spots that obscured the embryo, a cleaning step was performed (Figure 6). Images in the top row of the figure illustrate examples that were excluded, while the bottom row shows representative images that were retained in the cleaned dataset.
As shown in Table 2, a total of 21 image series (corresponding to 72 images) were removed because the embryos were obscured by dark or light spots. This filtering was conducted through manual visual inspection. Only eggs with complete image series were included in the machine learning analysis. Although some images in the dataset still contained noise, several were sufficiently clear for use, as illustrated in Figure 6. Notably, data collected from the Welsumer breed showed a particularly high level of noise.

2.4. ML Models

The ML models were implemented in TensorFlow (version 2.13.0) [16] with the Keras API [17]. Image preprocessing was carried out using OpenCV (version 4.9.0) [18] and Scikit-image (version 0.23.2) [19]. To analyze both the spatial and temporal features of the image sequences, a combination of convolutional neural network (CNN) backbone models and a recurrent neural network (RNN) was employed. Given the relatively small dataset, pretrained models with fewer parameters were selected to reduce the risk of overfitting and to leverage transfer learning from large-scale image datasets. The CNN backbones were initialized pretrained on ImageNet [20] and subsequently fine-tuned to the dataset. The models evaluated were ResNet50V2 [21], InceptionV3 [22], and DenseNet121 [23], containing approximately 25.6, 23.9, and 8.1 million parameters, respectively, as illustrated in Figure 7. Multiple CNN architectures were evaluated to assess the impact of model choice on performance, rather than to combine them into a single model. Multiple CNN architectures were used to evaluate model performance across different backbone designs rather than combining them into a single predictive model.
Data augmentation was applied during training to improve model robustness. The augmentation pipeline included random horizontal and vertical flips, rotations, zooming, and translations, introducing variability in image orientation and scale. This was particularly relevant given the variability in egg orientation.
Eggs from the different breeds varied in shell color and surface characteristics. In particular, the sex of the Welsumer breed was more difficult to determine accurately based on plumage. To address this, two datasets were created: one including all three breeds and another excluding the Welsumer eggs. All three baseline models were evaluated on both datasets.
Following the evaluation of the baseline CNNs, each model was extended with an RNN in a cascaded architecture, similar to previously proposed CNN–RNN frameworks. This approach was motivated by earlier studies that highlighted the temporal dimension of embryonic development as a promising avenue for future research. The final feature map output from the backbone CNNs was processed using a GlobalAveragePooling2D layer. For InceptionV3 and ResNet50, an additional bottleneck 1 × 1 Conv2D layer was applied to ensure dimensional consistency.
In this design, the CNN extracted feature maps consisting of 1024 features, which were then provided to the RNN as a sequence of three feature maps, yielding a total of 3072 features.
To evaluate the effectiveness of the different backbone models in combination with the RNN, identical parameters were applied to the CNN backbones, while the RNN hyperparameters were tuned empirically during preliminary experiments. The dataset was divided into 70% for training, 15% for validation, and 15% for testing. The split was performed at the egg level to ensure that images from the same egg were not present in multiple subsets.
Model performance was evaluated using accuracy, confusion matrix analysis, F1-score, and the Matthews Correlation Coefficient (MCC).

3. Results

The results of the baseline CNN and the hybrid CNN–RNN models were broadly similar, as summarized below.

3.1. Baseline CNN Model

Overall, the accuracy of the baseline CNN models for the full dataset was only slightly above random chance, while performance on the reduced dataset (excluding Welsumer eggs) was even lower. Among the baseline models, InceptionV3 trained on the full day-6 dataset achieved the highest mean accuracy, reaching 64.3%. This model also obtained an F1 score of 67.9%, indicating a balanced performance between precision and recall. The best individual run among all baseline CNN variants was likewise InceptionV3 trained on the full day-6 dataset, which reached 71.4% accuracy on the test set (Figure 8).

3.2. Hybrid CNN-RNN Model

The mean accuracies of the CNN-RNN models did not show any substantial improvement over the baseline CNNs. Similar to the CNN results, InceptionV3 and DenseNet121 achieved higher performance on the full dataset, whereas ResNet50 performed better on the subset excluding Welsumer eggs. The best-performing model overall was DenseNet121, although the InceptionV3-based models exhibited more consistent performance across runs, resulting in a higher mean accuracy.
The performance of the hybrid CNN–RNN models varied considerably. On the full dataset, ResNet50 reached only 50% accuracy, largely because it classified nearly all eggs as male. This is further reflected by an MCC value close to zero, confirming the absence of meaningful predictive capability. In contrast, on the reduced dataset, ResNet50 achieved higher accuracies, while DenseNet121 showed a tendency to overclassify eggs as male (Figure 9).
To provide a more detailed evaluation of model performance, the confusion matrix for the best-performing model is shown in Figure 10. Based on this matrix, the Matthews Correlation Coefficient (MCC) was approximately 0.31, indicating modest but non-random predictive performance. Some imbalance in the class predictions can also be observed.

4. Discussion

This study explored the feasibility of early-stage chicken egg sex classification using convolutional neural networks (CNNs) and a hybrid CNN-RNN architecture. While several models achieved accuracies around 60%, the positive MCC value (≈0.31) further supports that the best-performing model captures meaningful patterns in the data, although overall performance remains modest compared to prior literature. This outcome necessitates a deeper examination of the dataset, methodology, and implications. The results should be interpreted as exploratory and reflect the difficulty of the task under realistic conditions.
The best-performing model was the InceptionV3 CNN trained on Day 6 images, reaching an accuracy of 71.4% and an F1 score of 67.9%. However, incorporating temporal information via RNNs did not improve performance—in fact, the CNN-RNN models performed worse on average. This suggests that for early-stage imaging (days 4–6), static spatial features may be more informative than temporal progression. The limited size and quality of the dataset, including noise from natural egg variability and inconsistent lighting conditions, likely constrained model performance. Although a controlled light source with a fixed wavelength was used during image acquisition, variations in eggshell color and structure affect how light is transmitted through the egg. Darker or more heterogeneous shells absorb and scatter more light, reducing the visibility of embryonic structures and increasing image variability. This effect was particularly noticeable for the Welsumer breed, which exhibited higher noise levels due to its darker and more variable shell appearance. Given these constraints, the results should be interpreted as exploratory, reflecting the feasibility of the approach under realistic and heterogeneous conditions rather than optimized performance. Collecting larger, more balanced datasets and performing external validation remain important directions for future work.
Despite the inclusion of multiple breeds, removing Welsumer from the dataset did not significantly alter accuracy, suggesting the classification task may be generalizable across breeds. However, conclusions remain tentative due to the relatively small sample sizes and limited number of complete image series. A more detailed analysis of potential breed-related differences, for example using principal component analysis (PCA), was not feasible due to the limited sample size per breed and is left for future work. The dataset is slightly imbalanced, with more male than female samples, which may influence model performance. However, the confusion matrix indicates a relatively balanced classification performance between the two classes for the best-performing model.
Compared to existing studies on in ovo sex determination [2,5,6,10,24], this study introduces a unique dataset that broadens the scope of previous research. Most prior work has focused on commercial breeds and single-day imaging; in contrast, our dataset includes heritage and crossbred chickens—specifically Welsumer, Cream Legbar, and a Cream Legbar/Smålandshöna cross—adding valuable genetic and eggshell variability. Additionally, images were collected on three consecutive days (days 4, 5, and 6), enabling temporal analysis via CNN-RNN architectures. While this temporal modeling did not improve performance over baseline CNNs, the dataset structure offers a rare opportunity to study embryonic development over time.
The imaging setup, based on a Raspberry Pi camera and green LED array, was low-cost and highly replicable, making the approach feasible for decentralized or small-scale hatcheries. Importantly, data were collected under near-commercial incubation conditions, and chick sex was determined post-hatch through plumage characteristics, ensuring both ethical compliance and labeling accuracy. These features position the dataset as a useful resource for future research aiming to generalize sex classification methods across breeds, imaging conditions, and temporal scales.
Our results are comparable to those of a recent Turkish study that used ResNet and Inception models on a similarly sized dataset, achieving 67.6% accuracy with ResNet and 75.5% with Inception [6]. In contrast, our hybrid CNN-RNN model achieved a best-case accuracy of 66.7%, with an average of 62.7% on the breed-excluded subset. These differences may stem from variations in preprocessing, image clarity, and network tuning. Other studies reporting higher accuracies (up to 89.0%) often employed larger, more controlled datasets or advanced image processing, such as hyperspectral imaging or morphological analysis of blood vessels [5,10,14,24,25,26,27].
The early, non-invasive nature of this approach remains promising despite its current limitations. The ability to classify sex as early as day 4, without opening the egg or affecting viability, aligns well with emerging EU regulations banning chick culling [1,2]. While accuracy must improve to meet commercial standards, our findings reinforce machine vision as a viable and humane alternative worth further development. Previous studies suggest that embryonic blood vessel development may differ between sexes due to variations in metabolic activity and growth dynamics during early incubation. These differences may manifest as variations in vessel density, branching patterns, and spatial organization, which can be captured through image-based analysis. While the precise biological mechanisms remain incompletely understood, this provides a plausible basis for using vascular patterns as input features for sex classification [5].
Future research should focus on improving image quality and dataset size. This could include automated image acquisition systems to ensure consistent lighting, as well as multispectral or hyperspectral imaging to enhance vessel contrast. Additionally, exploring real-time object detection algorithms, such as YOLOv7 variants [28], could enable practical deployment in hatchery environments. Finally, narrower sampling intervals between imaging days may allow more effective use of temporal data, potentially enhancing RNN-based performance.
In summary, while the temporal aspect did not yield performance improvements in this study, the baseline CNN model showed encouraging results. With a cleaner and larger dataset, and continued refinement of model architectures, early-stage non-invasive sex identification via machine vision remains a compelling avenue of research.

5. Conclusions

This study investigated whether incorporating temporal information—via multi-day image series and a CNN-RNN hybrid architecture—could improve early-stage, non-invasive sex identification in chicken eggs. Despite the novelty of this approach, results showed that the baseline CNN model outperformed the hybrid model, achieving up to 71.43% accuracy compared to 67.85% for the CNN-RNN. The modest performance is likely due to the small dataset size and considerable noise in the image data.
A distinctive contribution of this work lies in its use of heritage and crossbred chicken lines, rather than industrial broilers, and the collection of longitudinal image data across three incubation days. These choices introduce natural variability and more closely reflect conditions outside controlled industrial settings, offering a valuable test case for generalizability.
Future work should focus on building a larger, higher-quality dataset, with more consistent lighting and fewer artifacts. Additionally, narrower imaging intervals and real-time object detection models may better exploit temporal changes in vascular patterns. While the CNN-RNN approach did not yield performance gains in this study, the overall findings reinforce the potential of machine vision as a non-invasive, scalable, and ethically sound method for early chick sexing. Future work should also include the use of explainability methods, such as Grad-CAM or SHAP, to better understand which image features contribute to the model’s predictions.

Author Contributions

Conceptualization, J.A. and P.M.; methodology, J.A. and P.M.; software, J.A., P.M. and F.F.; validation, J.A., P.M. and F.F.; formal analysis, J.A. and P.M.; investigation, J.A. and P.M.; resources, J.A. and P.M.; data curation, J.A. and P.M.; writing—original draft preparation, J.A. and P.M.; writing—review and editing, F.F.; visualization, J.A., P.M. and F.F.; supervision, F.F.; project administration, F.F. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Ethical review and approval were waived for this study due to this article is based a Bachelor’s degree thesis. Research made during undergraduate studies are excluded from ethical approval in Sweden. Furthermore, the methodology employed in this study was designed with the wellbeing of the animals in mind. Measures were taken to ensure that no harm was done to the eggs or potential embryos during the research process. The eggs were only temporarily removed from incubation conditions and were kept on a heating mat during imaging to maintain a consistent temperature, thus ensuring that our data collection process did not interfere with normal embryo development. Also, special care was taken to ensure that the lighting used for image capture did not affect the viability or development of the embryos.

Data Availability Statement

The data presented in this study are available on request from the corresponding author.

Acknowledgments

The authors gratefully acknowledge Ekebo Fjäderfä for providing access to facilities and for their cooperation during data collection.

Conflicts of Interest

The authors declare no conflicts of interest. Joel Andersson and Per Magnusson are currently affiliated with Husqvarna Group and Sigma Lundinova, respectively; however, the work reported in this manuscript was conducted while they were students at Kristianstad University. These current affiliations had no role in the design of the study, data collection, analysis, interpretation of results, or preparation of the manuscript.

References

  1. Coppola, F.; Paci, G.; Profeti, M.; Mancini, S. Stop culling male layer-type chick: An overview of the alternatives and public perspective. World’s Poult. Sci. J. 2024, 80, 611–631. [Google Scholar] [CrossRef]
  2. Krautwald-Junghanns, M.-E.; Cramer, K.; Fischer, B.; Förster, A.; Galli, R.; Kremer, F.; Mapesa, E.U.; Meissner, S.; Preisinger, R.; Preusse, G.; et al. Current approaches to avoid the culling of day-old male chicks in the layer industry, with special reference to spectroscopic methods. Poult. Sci. 2018, 97, 749–757. [Google Scholar] [CrossRef] [PubMed]
  3. Steiner, G.; Bartels, T.; Stelling, A.; Krautwald-Junghanns, M.-E.; Fuhrmann, H.; Sablinskas, V.; Koch, E. Gender determination of fertilized unincubated chicken eggs by infrared spectroscopic imaging. Anal. Bioanal. Chem. 2011, 400, 2775–2782. [Google Scholar] [CrossRef] [PubMed]
  4. Galli, R.; Preusse, G.; Uckermann, O.; Bartels, T.; Krautwald-Junghanns, M.-E.; Koch, E.; Steiner, G. In ovo sexing of domestic chicken eggs by Raman spectroscopy. Anal. Chem. 2016, 88, 8657–8663. [Google Scholar] [CrossRef] [PubMed]
  5. Jia, N.; Li, B.; Zhao, Y.; Fan, S.; Zhu, J.; Wang, H.; Zhao, W. Exploratory study of sex identification for chicken embryos based on blood vessel images and deep learning. Agriculture 2023, 13, 1480. [Google Scholar] [CrossRef]
  6. Asil, U.; Nasibov, E. Sex detection in the early stage of fertilized chicken eggs via image recognition. Int. J. Comput. Sci. Inf. Technol. 2023, 15, 19–26. [Google Scholar]
  7. Xie, C.; Wang, T.; Yang, C. A review of recent advances in in ovo sexing of chicken embryos using optical sensing techniques. Poult. Sci. 2023, 102, 102906. [Google Scholar] [CrossRef] [PubMed]
  8. Ekebo Fjäderfä. Available online: https://www.ekebofjaderfa.com/ (accessed on 26 June 2024).
  9. Brinsea Products Ltd. Ova-Easy 190 Advance Series II Incubator; Brinsea Products Ltd.: Weston-Super-Mare, UK, 2024. [Google Scholar]
  10. Zhu, Z.; Ye, Z.F.; Tang, Y. Nondestructive identification for gender of chicken eggs based on GA-BPNN with double hidden layers. J. Appl. Poult. Res. 2021, 30, 100203. [Google Scholar] [CrossRef]
  11. Archer, G.S.; Mench, J.A. Natural incubation patterns and the effects of exposing eggs to light at various times during incubation on post-hatch fear and stress responses in broiler chickens. Appl. Anim. Behav. Sci. 2014, 152, 44–51. [Google Scholar] [CrossRef]
  12. Rozenboim, I.; Piestun, Y.; Mobarkey, N.; Barak, M.; Hoyzman, A.; Halevy, O. Monochromatic light stimuli during embryogenesis enhance embryo development and posthatch growth. Poult. Sci. 2004, 83, 1413–1419. [Google Scholar] [CrossRef] [PubMed]
  13. Sobolewska, A.; Elminowska-Wenda, G.; Bogucka, J.; Szpinda, M.; Walasik, K.; Dankowiakowska, A.; Jóźwicki, W.; Wiśniewska, H.; Bednarczyk, M. The effect of two different green lighting schedules during embryogenesis on myogenesis in broiler chickens. Eur. Poult. Sci. 2019, 83, 1–14. [Google Scholar] [CrossRef]
  14. El-Sabrout, K.; Khalil, M.H. Effect of LED lighting on hatchability and chick performance of chicken eggs. Pak. J. Zool. 2017, 49, 2323–2325. [Google Scholar] [CrossRef]
  15. Zuiderveld, K. Contrast limited adaptive histogram equalization. In Graphics Gems IV; Heckbert, P.S., Ed.; Academic Press: San Diego, CA, USA, 1994; pp. 474–485. [Google Scholar]
  16. TensorFlow. Available online: https://www.tensorflow.org/ (accessed on 27 June 2024).
  17. Chollet, F. Keras: The Python Deep Learning API. Available online: https://keras.io (accessed on 27 June 2024).
  18. OpenCV. Open Source Computer Vision Library. Available online: https://opencv.org (accessed on 5 September 2025).
  19. van der Walt, S.; Schönberger, J.L.; Nunez-Iglesias, J.; Boulogne, F.; Warner, J.D.; Yager, N.; Gouillart, E.; Yu, T. Scikit-Image: Image Processing in Python. Available online: https://scikit-image.org (accessed on 5 September 2025).
  20. Deng, J.; Dong, W.; Socher, R.; Li, L.-J.; Li, K.; Li, F.-F. ImageNet: A large-scale hierarchical image database. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Miami, FL, USA, 20–25 June 2009. [Google Scholar]
  21. He, K.; Zhang, X.; Ren, S.; Sun, J. Identity mappings in deep residual networks. In Proceedings of the European Conference on Computer Vision (ECCV), Amsterdam, The Netherlands, 11–14 October 2016. [Google Scholar]
  22. Szegedy, C.; Vanhoucke, V.; Ioffe, S.; Shlens, J.; Wojna, Z. Rethinking the Inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016. [Google Scholar]
  23. Huang, G.; Liu, Z.; van der Maaten, L.; Weinberger, K.Q. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Honolulu, HI, USA, 21–26 July 2017. [Google Scholar]
  24. Tang, Y.; Hu, Q.; Wang, Q.; Zhu, Z. Sex identification of chicken eggs based on blood line texture features and GA-BP neural network. J. Huazhong Agric. Univ. 2018, 37, 130–135. [Google Scholar]
  25. Weissmann, A.; Reitemeier, S.; Hahn, A.; Gottschalk, J.; Einspanier, A. Sexing domestic chicken before hatch: A new method for in ovo gender identification. Theriogenology 2013, 80, 199–205. [Google Scholar] [CrossRef] [PubMed]
  26. Göhler, D.; Fischer, B.; Meissner, S. In-ovo sexing of 14-day-old chicken embryos by pattern analysis in hyperspectral images. Poult. Sci. 2017, 96, 1–4. [Google Scholar] [CrossRef] [PubMed]
  27. Alin, K.; Fujitani, S.; Kashimori, A.; Suzuki, T.; Ogawa, Y.; Kondo, N. Non-invasive broiler chick embryo sexing based on opacity value of incubated eggs. Comput. Electron. Agric. 2019, 158, 30–35. [Google Scholar] [CrossRef]
  28. Wang, C.-Y.; Bochkovskiy, A.; Liao, H.-Y.M. YOLOv7: Trainable Bag-of-Freebies Sets New State-of-the-Art for Real-Time Object Detectors. Available online: https://github.com/WongKinYiu/yolov7 (accessed on 14 September 2025).
Figure 1. Hatched Welsumer chicks (left) and hatched Cream Legbar chicks (right; male on the left).
Figure 1. Hatched Welsumer chicks (left) and hatched Cream Legbar chicks (right; male on the left).
Agriculture 16 01196 g001
Figure 2. Egg from a Cream Legbar or a Cream Legbar/Smålandshöna crossbreed (left) and egg from a Welsumer (right).
Figure 2. Egg from a Cream Legbar or a Cream Legbar/Smålandshöna crossbreed (left) and egg from a Welsumer (right).
Agriculture 16 01196 g002
Figure 3. Representative images of eggs at different incubation days: day 4 (left), day 5 (middle), and day 6 (right). The top row shows Welsumer eggs, and the bottom row shows Cream Legbar eggs. All images were acquired using a single green LED light source (540 nm). Differences in color appearance are due to variations in eggshell properties affecting light transmission.
Figure 3. Representative images of eggs at different incubation days: day 4 (left), day 5 (middle), and day 6 (right). The top row shows Welsumer eggs, and the bottom row shows Cream Legbar eggs. All images were acquired using a single green LED light source (540 nm). Differences in color appearance are due to variations in eggshell properties affecting light transmission.
Agriculture 16 01196 g003
Figure 4. Prototype imaging device consisting of three main components: a camera, an egg mount with an egg, and an LED array. A Raspberry Pi was connected to the camera for image storage and data transmission to the database.
Figure 4. Prototype imaging device consisting of three main components: a camera, an egg mount with an egg, and an LED array. A Raspberry Pi was connected to the camera for image storage and data transmission to the database.
Agriculture 16 01196 g004
Figure 5. Image preprocessing pipeline. Two representative candled egg images are shown across the preprocessing steps, including background removal, histogram matching, and contrast enhancement using CLAHE. Color differences between panels reflect variations in eggshell light transmission and the effects of the preprocessing steps. They do not represent separate experimental groups.
Figure 5. Image preprocessing pipeline. Two representative candled egg images are shown across the preprocessing steps, including background removal, histogram matching, and contrast enhancement using CLAHE. Color differences between panels reflect variations in eggshell light transmission and the effects of the preprocessing steps. They do not represent separate experimental groups.
Agriculture 16 01196 g005
Figure 6. Examples of image cleaning. The top row shows images excluded after manual visual inspection due to severe noise or obscured embryos, while the bottom row shows representative images from day 5 that were retained in the analyzed dataset.
Figure 6. Examples of image cleaning. The top row shows images excluded after manual visual inspection due to severe noise or obscured embryos, while the bottom row shows representative images from day 5 that were retained in the analyzed dataset.
Agriculture 16 01196 g006
Figure 7. Architecture of the hybrid CNN–RNN model, illustrating the combination of spatial feature extraction and temporal sequence modeling. The models were evaluated independently and were not combined into a single architecture.
Figure 7. Architecture of the hybrid CNN–RNN model, illustrating the combination of spatial feature extraction and temporal sequence modeling. The models were evaluated independently and were not combined into a single architecture.
Agriculture 16 01196 g007
Figure 8. Compiled results across all three CNN models (ResNet50V2, InceptionV3, DenseNet121) and all incubation days for the full dataset including all three breeds.
Figure 8. Compiled results across all three CNN models (ResNet50V2, InceptionV3, DenseNet121) and all incubation days for the full dataset including all three breeds.
Agriculture 16 01196 g008
Figure 9. Accuracy of the three hybrid CNN–RNN models across five independent runs. Symbols represent individual runs for each model architecture: crosses indicate InceptionV3-RNN, dots indicate DenseNet121-RNN, and the triangle indicates ResNet50-RNN. The dashed line connects the mean accuracy values for each model.
Figure 9. Accuracy of the three hybrid CNN–RNN models across five independent runs. Symbols represent individual runs for each model architecture: crosses indicate InceptionV3-RNN, dots indicate DenseNet121-RNN, and the triangle indicates ResNet50-RNN. The dashed line connects the mean accuracy values for each model.
Agriculture 16 01196 g009
Figure 10. Confusion matrix for the best-performing model, evaluated on the test set.
Figure 10. Confusion matrix for the best-performing model, evaluated on the test set.
Agriculture 16 01196 g010
Table 1. Distribution of incubated eggs across the three breeds. The last two columns indicate the number of male and female chicks with verified sex labels. In total, 208 eggs were included in the final dataset, corresponding to 624 images.
Table 1. Distribution of incubated eggs across the three breeds. The last two columns indicate the number of male and female chicks with verified sex labels. In total, 208 eggs were included in the final dataset, corresponding to 624 images.
BreedMaleFemaleNo True Label
Welsumer362310
Cream Legbar706524
Crossbreed18169
Sum12410443
Table 2. Number of image series (eggs) with verified male and female labels included in the machine learning analysis after the removal of 21 series (72 images) through manual visual inspection. The percentage of removed series is shown for each breed and sex.
Table 2. Number of image series (eggs) with verified male and female labels included in the machine learning analysis after the removal of 21 series (72 images) through manual visual inspection. The percentage of removed series is shown for each breed and sex.
BreedMalePercent RemovedFemalePercent Removed
Welsumer3113.9%1630.4%
Cream Legbar5915.7%5220.0%
Crossbreed1611.1%1412.5%
Sum10614.5%8221.2%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Andersson, J.; Magnusson, P.; Frisk, F. Non-Invasive Sex Identification of Early-Stage Poultry Eggs Using Machine Vision. Agriculture 2026, 16, 1196. https://doi.org/10.3390/agriculture16111196

AMA Style

Andersson J, Magnusson P, Frisk F. Non-Invasive Sex Identification of Early-Stage Poultry Eggs Using Machine Vision. Agriculture. 2026; 16(11):1196. https://doi.org/10.3390/agriculture16111196

Chicago/Turabian Style

Andersson, Joel, Per Magnusson, and Fredrik Frisk. 2026. "Non-Invasive Sex Identification of Early-Stage Poultry Eggs Using Machine Vision" Agriculture 16, no. 11: 1196. https://doi.org/10.3390/agriculture16111196

APA Style

Andersson, J., Magnusson, P., & Frisk, F. (2026). Non-Invasive Sex Identification of Early-Stage Poultry Eggs Using Machine Vision. Agriculture, 16(11), 1196. https://doi.org/10.3390/agriculture16111196

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop