Submitted:
21 June 2024
Posted:
04 July 2024
You are already at the latest version
Abstract
Keywords:
1. Introduction
2. Materials and Method
2.1. Machine Vision System


2.2. Multiple Domain Egg Samples Preparation
2.3. The architectures of multi-domain training method with NSFE-MMD
2.4. Proposed NSFE-MMD
2.4.1. Problem statement
2.4.2. Algorithm principle of NSFE-MMD
3. Experiment and Discussion
3.1. Model Metrics
3.2. Implementation Details
3.3. Training curve analysis
3.4. Quantitative Experimental Analysis
4. Conclusion
- 1)
- The multi-domain training approach with NSFE-MMD is proposed. The optimal match domain pair is obtained to promote to extract maximum domain invariant characteristics. The multi-domain training approach is integrated into the original YOLOv5 and YOLOv8 models. It can be simply and efficiently applied in practical large-quantity egg production for cracked egg detection, which does not need too complex network structure improving or parameters adjusting. Hence, the complexity and application difficulty of deep learning model applied in egg production is totally reduced.
- 2)
- The validation experiment and analysis of the proposed method and existing detect model on the unknown egg domain are conducted. The original YOLOV5 model trained by proposed multi-domain training method achieves a detection mAP of 86.6% on the unknown testing domain 4, surpassing the best performance of models trained individually on single domains. Similarly, the YOLOV8 model achieves a detection mAP of 88.8% on the unknown testing domain 4, demonstrating improvements of 8% and 4.4% respectively. Moreover, the mAP of our proposed method is 4.7% and 3.7% higher compared to models trained on all training domains. It demonstrated that the proposed multi-domain training method is robust and efficient in improving the performance of unknown cracked egg detection, which is common in practical large-quantity egg production.
- 3)
- A multi-domain dataset utilizing egg samples from different origins and different devices was constructed. It can be provided to other studies as a multi-domain training sample and as an unknown domain to test the robustness of the model.
References
- Sharaf Eddin, A.; Ibrahim, S.A.; Tahergorabi, R. Egg quality and safety with an overview of edible coating application for egg preservation. Food Chemistry 2019, 296, 29–39. [Google Scholar] [CrossRef] [PubMed]
- Ketta, M.; Tůmová, E. Eggshell structure, measurements, and quality-affecting factors in laying hens: a review. Czech J. Anim. Sci. 2016, 61, 299–309. [Google Scholar] [CrossRef]
- Perić, L.; Mitraković, M.; Vekić, M.; Đukić Stojčić, M.; Žikić, D.; Đorđe, Savić.; Meijerhof, R.; Jotanović, S. Improving the incubation results by sealing the eggshell of cracked hatching eggs with surgical tape. Poultry Science 2023, 102, 102466. [Google Scholar] [CrossRef] [PubMed]
- Dorn-In, S.; Daldrup, E.; Mang, S.; Esteban-Cuesta, I.; Gareis, M.; Schwaiger, K. Viable Campylobacter jejuni on Eggshells and Its Potential to Cross-contaminate Egg White and Yolk When Using a Manual Separation Technique, Determined by Culture and Propidium Monoazide (PMA) qPCR. Journal of Food Protection 2024, 87, 100246. [Google Scholar] [CrossRef] [PubMed]
- Conde, T.; Mulet, A.; Clemente, G.; Benedito, J. Detection of Internal Cracks in Manchego Cheese Using the Acoustic Impulse-Response Technique and Ultrasounds. Journal of Dairy Science 2008, 91, 918–927. [Google Scholar] [CrossRef] [PubMed]
- Sun, L.; Feng, S.; Chen, C.; Liu, X.; Cai, J. Identification of eggshell crack for hen egg and duck egg using correlation analysis based on acoustic resonance method. Journal of Food Process Engineering 2020, 43, e13430. [Google Scholar] [CrossRef]
- Kertész, I.; Zsom-Muha, V.; András, R.; Horváth, F.; Németh, C.; Felföldi, J. Development of a Novel Acoustic Spectroscopy Method for Detection of Eggshell Cracks. Molecules 2021, 26. [Google Scholar] [CrossRef] [PubMed]
- Guanjun, B.; Mimi, J.; Yi, X.; Shibo, C.; Qinghua, Y. Cracked egg recognition based on machine vision. Computers and Electronics in Agriculture 2019, 158, 159–166. [Google Scholar] [CrossRef]
- Botta, B.; Gattam, S.S.R.; Datta, A.K. Eggshell crack detection using deep convolutional neural networks. Journal of Food Engineering 2022, 315, 110798. [Google Scholar] [CrossRef]
- Krizhevsky, A.; Sutskever, I.; Hinton, G.E. ImageNet classification with deep convolutional neural networks. Commun. ACM 2017, 60, 84–90. [Google Scholar] [CrossRef]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep Residual Learning for Image Recognition. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.u.; Polosukhin, I. Attention is All you Need. Advances in Neural Information Processing Systems; Guyon, I.; Luxburg, U.V.; Bengio, S.; Wallach, H.; Fergus, R.; Vishwanathan, S.; Garnett, R., Eds. Curran Associates, Inc., 2017, Vol. 30.
- Turkoglu, M. Defective egg detection based on deep features and Bidirectional Long-Short-Term-Memory. Computers and Electronics in Agriculture 2021, 185, 106152. [Google Scholar] [CrossRef]
- Khatir, A.; Capozucca, R.; Khatir, S.; Magagnini, E.; Benaissa, B.; Le Thanh, C.; Abdel Wahab, M. A new hybrid PSO-YUKI for double cracks identification in CFRP cantilever beam. Composite Structures 2023, 311, 116803. [Google Scholar] [CrossRef]
- Lirong Xiong, Can Xie, Z.Z. An identification method based on multi-feature and Adaboosting-SVM of eggshell crack. Journal of Huazhong Agricultural University (Natural Science Edition) 2015, 34, 136–140. [Google Scholar]
- Huang, Y.; Luo, Y.; Cao, Y.; Lin, X.; Wei, H.; Wu, M.; Yang, X.; Zhao, Z. Damage Detection of Unwashed Eggs through Video and Deep Learning. Foods 2023, 12. [Google Scholar] [CrossRef] [PubMed]
- Yang, J.; Zhou, K.; Li, Y.; Liu, Z. Generalized Out-of-Distribution Detection: A Survey. ArXiv 2021, arXiv:abs/2110.11334. [Google Scholar] [CrossRef]
- Stacke, K.; Eilertsen, G.; Unger, J.; Lundström, C.F. A Closer Look at Domain Shift for Deep Learning in Histopathology. ArXiv 2019, arXiv:abs/1909.11575. [Google Scholar]
- Zhang, J.; Zhang, X.Y.; Wang, C.; Liu, C.L. Deep representation learning for domain generalization with information bottleneck principle. Pattern Recognition 2023, 143, 109737. [Google Scholar] [CrossRef]
- Mohanty, S.P.; Hughes, D.P.; Salathé, M. Using Deep Learning for Image-Based Plant Disease Detection. Frontiers in Plant Science 2016, 7. [Google Scholar] [CrossRef]
- Luo, Y.; Huang, Y.; Wang, Q.; Yuan, K.; Zhao, Z.; Li, Y. An improved YOLOv5 model: Application to leaky eggs detection. LWT 2023, 187, 115313. [Google Scholar] [CrossRef]
- Jiang, T.; Zhou, J.; Xie, B.; Liu, L.; Ji, C.; Liu, Y.; Liu, B.; Zhang, B. Improved YOLOv8 Model for Lightweight Pigeon Egg Detection. Animals 2024, 14. [Google Scholar] [CrossRef]
- Zhang, X.; Wang, C.; Tang, Y.; Zhou, Z.; Lu, X. A Survey of Few-Shot Learning and Its Application in Industrial Object Detection Tasks. International Workshop of Advanced Manufacturing and Automation. Springer, 2021, pp. 637–647.
- Huang, S.; Jin, H.; Yang, B.; Liu, H. Combining Virtual Sample Generation Based Data Enhancement and Multi-objective Optimization Based Selective Ensemble for Soft Sensor Modeling. 2022 IEEE 11th Data Driven Control and Learning Systems Conference (DDCLS). IEEE, 2022, pp. 287–293.
- Ma, X.; Lu, X.; Huang, Y.; Yang, X.; Xu, Z.; Mo, G.; Ren, Y.; Li, L. An Advanced Chicken Face Detection Network Based on GAN and MAE. Animals 2022, 12. [Google Scholar] [CrossRef] [PubMed]
- Wang, Y.; Gao, J.; Wang, W.; Yang, X.; Du, J. Curriculum learning-based domain generalization for cross-domain fault diagnosis with category shift. Mechanical Systems and Signal Processing 2024, 212, 111295. [Google Scholar] [CrossRef]
- Feng, H.; Tang, W.; Xu, H.; Jiang, C.; Ge, S.S.; He, J. Meta-learning based infrared ship object detection model for generalization to unknown domains. Applied Soft Computing 2024, 111633. [Google Scholar] [CrossRef]
- Tang, W.; Hu, J.; Wang, Q. High-Throughput Online Visual Detection Method of Cracked Preserved Eggs Based on Deep Learning. Applied Sciences 2022, 12. [Google Scholar] [CrossRef]
- Jie, D.; Wang, J.; Lv, H.; Wang, H. Research on duck egg recognition algorithm based on improved YOLOv4. British Poultry Science 2024, 1–10. [Google Scholar] [CrossRef] [PubMed]
- Subedi, S.; Bist, R.; Yang, X.; Chai, L. Tracking floor eggs with machine vision in cage-free hen houses. Poultry Science 2023, 102, 102637. [Google Scholar] [CrossRef] [PubMed]
- Binkowski, M.; Sutherland, D.J.; Arbel, M.; Gretton, A. Demystifying MMD GANs. ArXiv 2018, arXiv:abs/1801.01401. [Google Scholar]
- Ming, Y.; Bai, H.; Katz-Samuels, J.; Li, Y. HYPO: Hyperspherical Out-of-Distribution Generalization. arXiv 2024, arXiv:cs.LG/2402.07785. [Google Scholar]








| Dataset | Origin | Cleaning Status | Acquisition System |
|---|---|---|---|
| Domain1 | Wuhan | washed | static |
| Domain2 | Wuhan | unwashed | dynamic |
| Domain3 | Wuhan | washed | dynamic |
| Domain4 | Qingdao | unwashed | dynamic |
| Domain5 | Nanyang | unwashed | dynamic |
| Domain Pair | NSFE-MMD |
|---|---|
| Domain1 – Domain2 | 0.94 |
| Domain2 – Domain3 | 0.55 |
| Domain1 – Domain3 |
| Configuration | Parameter |
|---|---|
| Development environment | Anaconda3+Jupyter |
| CPU | 8*Xeon Gold 6330 |
| GPU | RTX A6000 |
| Operating system | Ubuntu 18.04 |
| Accelerated environment | CUDA 11.3, cuDNN 8.3.0 |
| Method | Domain1 | Domain2 | Domain3 | Precision | Recall | mAP.5 |
|---|---|---|---|---|---|---|
| SDT | ✓ | 0.012 | 0.006 | 0.006 | ||
| SDT | ✓ | 0.316 | 0.381 | 0.229 | ||
| SDT | ✓ | 0.781 | 0.768 | 0.786 | ||
| MDT | ✓ | ✓ | 0.846 | 0.802 | 0.856 | |
| MDT | ✓ | ✓ | 0.856 | 0.780 | 0.847 | |
| OURs | ✓ | ✓ | 0.838 | 0.828 | 0.866 | |
| ADT | ✓ | ✓ | ✓ | 0.866 | 0.739 | 0.819 |
| Method | Domain1 | Domain2 | Domain3 | Precision | Recall | mAP.5 |
|---|---|---|---|---|---|---|
| SDT | ✓ | 0.000 | 0.000 | 0.000 | ||
| SDT | ✓ | 0.711 | 0.846 | 0.846 | ||
| SDT | ✓ | 0.738 | 0.709 | 0.800 | ||
| MDT | ✓ | ✓ | 0.801 | 0.797 | 0.854 | |
| MDT | ✓ | ✓ | 0.833 | 0.854 | 0.871 | |
| OURs | ✓ | ✓ | 0.844 | 0.885 | 0.879 | |
| ADT | ✓ | ✓ | ✓ | 0.242 | 1.00 | 0.373 |
| Method | Domain1 | Domain2 | Domain3 | Precision | Recall | mAP.5 |
|---|---|---|---|---|---|---|
| SDT | ✓ | 0.230 | 0.563 | 0.218 | ||
| SDT | ✓ | 0.775 | 0.791 | 0.831 | ||
| SDT | ✓ | 0.754 | 0.793 | 0.844 | ||
| OURs | ✓ | ✓ | 0.852 | 0.806 | 0.888 | |
| ADT | ✓ | ✓ | ✓ | 0.832 | 0.759 | 0.851 |
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. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).