DHS-CNN: A Defect-Adaptive Hierarchical Structure CNN Model for Detecting Anomalies in Contact Lenses
Abstract
:1. Introduction
1.1. Research Background
1.2. Types of Abnormalities in Contact Lenses
- (a), (b): These two images represent the normal patterns of contact lenses, showing different types of normal contact lenses that meet the standard product quality.
- (c) no_lens: This image shows a situation where the lens has not been properly captured, indicating a scenario in which the lens was either missed during the pick-up process or incorrectly captured during imaging.
- (d) etc_abnormal: This image depicts a lens in an unidentifiable shape owing to improper positioning or camera malfunction. Such instances occur when irregular images are produced for various reasons.
- (e) broken: This image shows a partially detached lens, indicating breakage or damage. This reflects a serious defect in the product.
- (f) burr: This image shows a lens with edges that were not properly trimmed but remain intact, indicating a defect in the cutting process that affects the lens finish.
- (g) Bubble defect (b_bubble): This image shows a lens with bubbles formed inside during the molding process, a quality issue that may arise during manufacturing.
- (h) Edge defect (b_edge): This image displays a lens with a crack, which can occur due to physical damage or material defects, directly affecting product safety.
1.3. Purpose and Contributions of the Research
2. Related Works
2.1. Related Research on Contact Lenses
2.2. Deep Learning-Based Image-Processing Techniques
3. Defect-Adapted Hierarchical Deep Learning Model
3.1. Hierarchical Design Based on Characteristics of Anomaly Types
3.2. Proposed Defect-Adapted Hierarchical Deep Learning Model
3.3. Adjustment of Balanced Weights for Loss Function
4. Experiment Results
4.1. Dataset
4.2. EfficientNet Optimal Parameter Search
4.3. Experiment Setup
4.3.1. Evaluation Methodology
- Basic structure evaluation: First, the performance of the basic structures of the InceptionV4, EfficientNet, and ViT models was evaluated. This step was important for establishing the baseline performance of the models.
- Application of DHS-CNN: Next, the performance of both models with DHS-CNN applied was evaluated. This approach was crucial for understanding the impact of DHS-CNN on model performance.
- Changes in the loss function: Finally, the effect of modifying the loss function on the performance of both models was evaluated. This analysis helped determine how applying different weights to specific abnormal types influenced the results.
4.3.2. Experiment Environment and Setting
4.4. Experimental Results
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Çınar, Z.M.; Abdussalam Nuhu, A.; Zeeshan, Q.; Korhan, O.; Asmael, M.; Safaei, B. Machine Learning in Predictive Maintenance towards Sustainable Smart Manufacturing in Industry 4.0. Sustainability 2020, 12, 8211. [Google Scholar] [CrossRef]
- Ha, H.; Jeong, J. CNN-based defect inspection for injection molding using edge computing and industrial IoT systems. Appl. Sci. 2021, 11, 6378. [Google Scholar] [CrossRef]
- Kitsios, F.; Kamariotou, M. Artificial intelligence and business strategy towards digital transformation: A research agenda. Sustainability 2021, 13, 2025. [Google Scholar] [CrossRef]
- Sankowski, D.; Nowakowski, J. (Eds.) Computer Vision in Robotics and Industrial Applications; World Scientific: Singapore, 2014. [Google Scholar]
- Ercan, M.F.; Wang, R.B. Computer Vision-Based Inspection System for Worker Training in Build and Construction Industry. Computers 2022, 11, 100. [Google Scholar] [CrossRef]
- Kuric, I.; Klarák, J.; Bulej, V.; Sága, M.; Kandera, M.; Hajdučík, A.; Tucki, K. Approach to automated visual inspection of objects based on artificial intelligence. Appl. Sci. 2022, 12, 864. [Google Scholar] [CrossRef]
- Ercan, M.F. A Video Demonstration of the Computer Vision Based Assessment System. 2022. Available online: https://youtu.be/rGezHIx01uU (accessed on 6 February 2025).
- Chien, J.-C.; Wu, M.-T.; Lee, J.-D. Inspection and classification of semiconductor wafer surface defects using CNN deep learning networks. Appl. Sci. 2020, 10, 5340. [Google Scholar] [CrossRef]
- Imoto, K.; Nakai, T.; Ike, T.; Haruki, K.; Sato, Y. A CNN-based transfer learning method for defect classification in semiconductor manufacturing. IEEE Trans. Semicond. Manuf. 2019, 32, 455–459. [Google Scholar] [CrossRef]
- Masci, J.; Meier, U.; Ciresan, D.; Schmidhuber, J.; Fricout, G. Steel defect classification with max-pooling convolutional neural networks. In Proceedings of the 2012 International Joint Conference on Neural Networks (IJCNN), Brisbane, QLD, Australia, 10–15 June 2012; pp. 1–6. [Google Scholar]
- Ren, Z.; Fang, F.; Yan, N.; Wu, Y. State of the art in defect detection based on machine vision. Int. J. Precis. Eng. Manuf. Green Technol. 2022, 9, 661–691. [Google Scholar] [CrossRef]
- Herrera, J.A.; Vilaseca, M.; Düll, J.; Arjona, M.; Torrecilla, E.; Pujol, J. Iris color and texture: A comparative analysis of real irises, ocular prostheses, and colored contact lenses. Color Res. Appl. 2011, 36, 373–382. [Google Scholar] [CrossRef]
- Hsu, M.Y.; Hong, P.Y.; Liou, J.C.; Wang, Y.P.; Chen, C. Assessment of ocular surface response to tinted soft contact lenses with different characteristics and pigment location. Int. J. Optomechatronics 2020, 14, 119–130. [Google Scholar] [CrossRef]
- Raghavendra, R.; Raja, K.B.; Busch, C. Contlensnet: Robust iris contact lens detection using deep convolutional neural networks. In Proceedings of the 2017 IEEE Winter Conference on Applications of Computer Vision (WACV), Santa Rosa, CA, USA, 24–31 March 2017; pp. 1160–1167. [Google Scholar]
- Choudhary, M.; Tiwari, V.; Venkanna, U. An approach for iris contact lens detection and classification using ensemble of customized DenseNet and SVM. Future Gener. Comput. Syst. 2019, 101, 1259–1270. [Google Scholar] [CrossRef]
- Kim, G.N.; Kim, S.H.; Joo, I.; Yoo, K.H. Detection of Contact Lens Defects using a Modified GoogLeNet. Korea Computer Congress 2022, 6, 894–896. [Google Scholar]
- Parzianello, L.; Czajka, A. Saliency-guided textured contact lens-aware iris recognition. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Waikoloa, HI, USA, 4–8 January 2022; pp. 330–337. [Google Scholar]
- Kim, G.; Kim, S.; Joo, I.; Yoo, K.H. Measurement of Center Point Deviation for Detecting Contact Lens Defects. BIGDAS 2022, 10, 125–130. [Google Scholar]
- Kim, G.N.; Kim, S.H.; Joo, I.; Kim, G.B.; Yoo, K.H. Center Deviation Measurement of Color Contact Lenses Based on a Deep Learning Model and Hough Circle Transform. Sensors 2023, 23, 6533. [Google Scholar] [CrossRef]
- Chang, C.-L.; Wu, W.-H.; Hwang, C.-C. Automatic optical inspection method for soft contact lenses. Int. Conf. Opt. Photonic Eng. 2015, 9524, 952402. [Google Scholar]
- Elliott, C.J. Automatic optical measurement of contact lenses. Autom. Opt. Insp. 1986, 654, 125–129. [Google Scholar]
- Kim, T.Y.; Park, D.; Moon, H.; Hwang, S.S. A Deep Learning Technique for Optical Inspection of Color Contact Lenses. Appl. Sci. 2023, 13, 5966. [Google Scholar] [CrossRef]
- Szegedy, C.; Ioffe, S.; Vanhoucke, V.; Alemi, A. Inception-v4, inception-resnet and the impact of residual connections on learning. Proc. AAAI Conf. Artif. Intell. 2017, 31. [Google Scholar] [CrossRef]
- Kimura, G.Y.; Lucio, D.R.; Britto, A.S., Jr.; Menotti, D. CNN hyperparameter tuning applied to iris liveness detection. arXiv 2020, arXiv:2003.00833. [Google Scholar]
- Romero-Garces, A.; Ruiz-Beltrán, C.; Marfil, R.; Bandera, A. Lightweight Cosmetic Contact Lens Detection System for Iris Recognition at a Distance. In International Conference on Soft Computing Models in Industrial and Environmental Applications; Springer Nature: Cham, Switzerland, 2023; pp. 246–255. [Google Scholar]
- Kim, G.N.; Kim, S.H.; Joo, I.; Yoo, K.H. Detection of Color Contact Lens Defects using Various CNN Models. J. Korea Contents Assoc. 2022, 22, 160–170. [Google Scholar] [CrossRef]
- Ioffe, S. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv 2015, arXiv:1502.03167. [Google Scholar]
- Huang, G.; Zhuang, L.; van der Maaten, L.; Weinberger, K.Q. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Honolulu, HI, USA, 21–26 July 2017; pp. 4700–4708. [Google Scholar]
- Howard, A.G. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv 2017, arXiv:1704.04861. [Google Scholar]
- Roy, D.; Panda, P.; Roy, K. Tree-CNN: A hierarchical deep convolutional neural network for incremental learning. Neural Netw. 2020, 121, 148–160. [Google Scholar] [CrossRef] [PubMed]
- Tan, M.; Le, Q. Efficientnet: Rethinking model scaling for convolutional neural networks. Int. Conf. Mach. Learn. 2019, 97, 6105–6114. [Google Scholar]
- He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognitionm, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
- Dosovitskiy, A. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv 2020, arXiv:2010.11929. [Google Scholar]
- Khan, S.; Naseer, M.; Hayat, M.; Zamir, S.W.; Khan, F.S.; Shah, M. Transformers in vision: A survey. ACM Comput. Surv. 2022, 54, 1–41. [Google Scholar] [CrossRef]
- Zhang, M.-L.; Zhou, Z.-H. A review on multi-label learning algorithms. IEEE Trans. Knowl. Data Eng. 2013, 26, 1819–1837. [Google Scholar] [CrossRef]
- Ultralytics. YOLOv8: Implementation and Documentation. Available online: https://docs.ultralytics.com/ko/models/yolov8/ (accessed on 6 February 2025).
- Varghese, R.; Sambath, M. YOLOv8: A Novel Object Detection Algorithm with Enhanced Performance and Robustness. In Proceedings of the 2024 International Conference on Advances in Data Engineering and Intelligent Computing Systems (ADICS), Chennai, India, 18–19 April 2024; pp. 1–6. [Google Scholar]
- Ultralytics. YOLOv11: Implementation and Documentation. Available online: https://docs.ultralytics.com/models/yolo11/ (accessed on 6 February 2025).
Total Number of Images | Original Image Size | Input Image Size | Data Split (Train: Validation: Test) |
---|---|---|---|
2800 | 1500 × 1500 (pixel) | 640 × 640 (pixel) | 6:2:2 |
Class | Number of Labeled Images |
---|---|
b_edge | 483 |
burr | 411 |
broken | 431 |
b_bubble | 427 |
etc_abnormal | 423 |
no_lens | 400 |
Width | Depth | Resolution | Train Accuracy | Train Loss | Validation Accuracy | Validation Loss |
---|---|---|---|---|---|---|
1.4 | 1 | 640 | 0.998375 | 0.015735 | 0.952546 | 0.154295 |
1.6 | 1 | 640 | 0.996971 | 0.003325 | 0.958912 | 0.165796 |
1.8 | 1 | 640 | 0.99867 | 0.013629 | 0.958912 | 0.143445 |
2.0 | 1 | 640 | 0.999705 | 0.002596 | 0.959491 | 0.154562 |
2.2 | 1 | 640 | 0.999188 | 0.002179 | 0.965856 | 0.124817 |
2.4 | 1 | 640 | 0.999778 | 0.004105 | 0.953704 | 0.150497 |
2.8 | 1 | 640 | 0.999777 | 0.005866 | 0.967857 | 0.142077 |
3.3 | 1 | 640 | 0.999851 | 0.001127 | 0.965476 | 0.143372 |
4.3 | 1 | 640 | 0.999852 | 0.009339 | 0.960697 | 0.140015 |
Width | Depth | Resolution | Train Accuracy | Train Loss | Validation Accuracy | Validation Loss |
---|---|---|---|---|---|---|
2.2 | 1 | 640 | 0.999188 | 0.002179 | 0.965856 | 0.124817 |
2.2 | 1.5 | 640 | 0.998289 | 0.047659 | 0.956548 | 0.141712 |
2.2 | 1.8 | 640 | 0.976717 | 0.070334 | 0.955969 | 0.118954 |
2.2 | 2.2 | 640 | 0.989583 | 0.011818 | 0.958929 | 0.133038 |
Environment | |
---|---|
Hardware | Intel Xeon(R) Silver 4216 RAM 240 GB GeForce RTX 3090 24 GB x2 |
Software | Ubuntu 20.04 Python 3.10.4 Cuda 11.3 Pytorch 1.11 |
Models | Batch Size | Epoch | Loss Function | Optimizer | Learning Rate |
---|---|---|---|---|---|
InceptionV4 | 16 | 200 | Binary Cross Entropy Loss (per output) | Adam | 0.0005 |
EfficientNet | 16 | 200 | Adam | 0.0005 | |
ViT | 16 | 200 | Adam | 0.0005 | |
DHS-CNN | 16 | 200 | Adam | 0.0005 | |
DHS-CNN with balanced weights | 16 | 200 | Adam | 0.0005 |
Models | Accuracy (Validation) | Hyperparameters | Training Time (Seconds/Epoch) |
---|---|---|---|
InceptionV4 | 95.31% | 82,304,076 | 45 |
EfficientNet | 96.59% | 169,226,088 | 342 |
ViT | 91.17% | 177,495,564 | 57 |
DHS-CNN | 96.70% | 160,830,540 | 73 |
DHS-CNN with balanced weights | 97.39% | 160,830,540 | 73 |
Models | Precision | Recall | F1-Score | Accuracy |
---|---|---|---|---|
InceptionV4 original | 0.80000 | 0.63566 | 0.70842 | 0.65357 |
EfficientNet original | 0.83193 | 0.66744 | 0.74066 | 0.71929 |
ViT original | 0.80702 | 0.48421 | 0.60526 | 0.53929 |
DHS- InceptionV4 | 0.88614 | 0.69380 | 0.77826 | 0.70357 |
DHS- InceptionV4 with custom loss | 0.88038 | 0.71318 | 0.78801 | 0.73214 |
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. |
© 2025 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 (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Kim, S.-H.; Joo, S.-J.; Yoo, K.-H. DHS-CNN: A Defect-Adaptive Hierarchical Structure CNN Model for Detecting Anomalies in Contact Lenses. Appl. Sci. 2025, 15, 2697. https://doi.org/10.3390/app15052697
Kim S-H, Joo S-J, Yoo K-H. DHS-CNN: A Defect-Adaptive Hierarchical Structure CNN Model for Detecting Anomalies in Contact Lenses. Applied Sciences. 2025; 15(5):2697. https://doi.org/10.3390/app15052697
Chicago/Turabian StyleKim, Sung-Hoon, Seong-Jong Joo, and Kwan-Hee Yoo. 2025. "DHS-CNN: A Defect-Adaptive Hierarchical Structure CNN Model for Detecting Anomalies in Contact Lenses" Applied Sciences 15, no. 5: 2697. https://doi.org/10.3390/app15052697
APA StyleKim, S.-H., Joo, S.-J., & Yoo, K.-H. (2025). DHS-CNN: A Defect-Adaptive Hierarchical Structure CNN Model for Detecting Anomalies in Contact Lenses. Applied Sciences, 15(5), 2697. https://doi.org/10.3390/app15052697