A comparative case study on the impact of architecture, loss function, and augmentation on CNN robustness using the NEU-CLS dataset
摘要
Convolutional Neural Network (CNN) models often report high accuracy on controlled, curated datasets, such as the NEU steel surface defect dataset; however, this performance frequently fails to translate to robust real-world applications. This study investigates this gap by conducting a comprehensive comparative study of 36 model configurations, spanning six distinct architectures (VGG19, ResNet50, DenseNet121, InceptionV3, EfficientNetB0, and MobileNetV3Small). We examined the interplay between these backbones and hybrid combinations of three loss functions: Sparse Categorical Cross-Entropy (SCCEL), Focal Loss (FL), and Supervised Contrastive Loss (SCL). The models were evaluated for robustness against synthetic corruptions (noise, blur, illumination), cross-domain generalization to an out-of-distribution (OOD) dataset, and deployment efficiency. Our results challenge the validity of clean accuracy as a sole performance metric: while ResNet50 achieved perfect in-distribution accuracy (100%), it exhibited severe fragility under distributional shifts, highlighting the tendency of standard Cross-Entropy minimization to induce overfitting in high-capacity models. In contrast, EfficientNetB0 configurations demonstrated the highest resilience to environmental corruptions (mCE of 0.043). Critically, we found that loss function design is a primary driver of generalization. The VGG19 architecture, when trained with a hybrid SCL+FL loss, achieved superior cross-domain generalization (F1-score of 0.92) on the target OOD class. This demonstrates that decoupling representation learning (via SCL) from classification objectives (via FL) enables simpler architectures to learn more transferable feature embeddings than deeper models relying on standard losses. This study provides empirical evidence that for small-data industrial tasks, combining modern efficient architectures (like EfficientNet) or simpler networks (like VGG19) with contrastive-hybrid loss mechanisms offers the optimal pathway to industrial robustness.