Ahmad Banakar, Seyed Mohamad Javidan, Fatemeh Kazemi, Maryam Ahmadi Ghavidelan, Hooman Rajabipour
Early and non-invasive egg sex determination remains a significant challenge in poultry production due to ethical concerns and economic limitations. To address this problem, this study proposes an interpretable hybrid framework combining hyperspectral imaging, machine learning, and feature selection for in-ovo sex classification at day one of incubation. Hyperspectral data in the 400–950 nm range were used to extract both spectral and textural features representing intensity, variability, and spatial structure. Dimensionality reduction and feature selection were applied to identify the most informative descriptors for classification. The proposed approach enables accurate and scalable early sex determination in a non-invasive manner. For classification, Random Forest achieved the highest performance with an accuracy of 96.7%, reaching 93.8% precision for male samples and 100% for female samples, demonstrating strong stability and balanced predictive capability. Support Vector Machine followed with 93.33% accuracy, while k-Nearest Neighbors and Decision Tree achieved 90% and 80% accuracy, respectively. Feature Selection analysis showed that discriminative information is concentrated in specific spectral regions, particularly in the red–near-infrared transition zone (620–680 nm), with additional contributions in 700–850 nm. In the visible range (450–550 nm), features mainly reflect eggshell surface characteristics, while near-infrared features are more sensitive to internal structural variations. In addition to spectral descriptors, GLCM-based texture features followed a clear ranking in terms of discriminative importance. Variance and Homogeneity showed the strongest separation between classes, indicating differences in spatial heterogeneity and local intensity uniformity. Energy and Contrast provided intermediate discrimination, reflecting differences in spatial regularity and local intensity variations. Entropy captured the level of spatial complexity, while IDM reflected local smoothness of reflectance patterns. Correlation showed the lowest discriminative contribution, indicating limited sensitivity to long-range spatial dependencies in this dataset. These ordered contributions suggest that spatial organization of reflectance patterns carries class-related information, with higher-ranked features being more sensitive to local structural differences. The results confirm that the integration of hyperspectral imaging with machine learning and feature selection provides a robust, non-invasive, and interpretable framework for early in-ovo egg sex determination.