Nondestructive In-Ovo Sexing of Hy-Line Sonia Eggs by EggFormer Using Hyperspectral Imaging
Chengming Ji,Ke Song,Zixin Chen,Shanyong Wang,Huanliang Xu,Kang Tu,Leiqing Pan,Junxian Huang
DOI: https://doi.org/10.1016/j.compag.2024.109298
IF: 8.3
2024-01-01
Computers and Electronics in Agriculture
Abstract:Early identification of egg gender during incubation is crucial for animal welfare and commercial poultry production, as nowadays day-old male chicks are often culled due to low economic value. Hyperspectral imaging (HSI) recognition presents a swift, non-destructive, and cost-effective solution for in-ovo sexing compared to traditional methods such as Polymerase Chain Reaction (PCR), Volatile Organic Compounds (VOC), and Raman spectroscopy. In this study, we collected spectral images of Hy-Line Sonia chicken eggs even-numbered day from day 0 to 14, with a focus on day 10 for detailed analysis. We introduced the EggFormer model, incorporating channel attention and transformer self-attention mechanisms. To assess model performance, significant wavelengths were extracted by machine learning algorithms, including Random Forest(RF), Principal Component Analysis(PCA), Successive Projections Algorithm (SPA), and Competitive Adaptive Reweighted Sampling Algorithm (CARS). The channel images of these significant wavelengths were then employed with ViT-Base(Vision Transformer) for prediction and comparison. The EggFormer model demonstrated superior results, with accuracy of 95.4% , recall of 98.6%, F1 score of 0.958 and Kappa of 0.908. Furthermore, by interpreting the channel attention block, 22 wavelengths were selected, maintaining optimal results, with 4 bands achieving an accuracy of 94.6%. This outperformance positions it as a promisingly efficient and economical solution for industrial applications. The code of this work is available at https://github.com/quietbamboo/EggFormer for reproducibility.