# Real-Time Detection of Hole-Type Defects on Industrial Components Using Raspberry Pi 5
## 5 Discussion  
The evaluation of lightweight deep learning models--MobileNetV3-Large, EfficientNet-B3, and ResNet50--on the Raspberry Pi 5 revealed critical trade-offs between model complexity, inference speed, and deployment feasibility under industrial conditions. Deployed within a webcam-based inspection setup processing 100 real-time samples, each model exhibited distinct performance characteristics. MobileNetV3-Large achieved the highest throughput (~8 FPS, ~125 ms inference time) and a 96% accuracy, making it highly suitable for real-time defect detection on resource-constrained edge devices. This combination of speed, size, and accuracy highlights its robustness, particularly under diverse lighting and surface conditions. EfficientNet-B3 offered a balanced performance profile with ~4.7 FPS and an inference time of ~213 ms. It achieved 95% classification accuracy and consistently high confidence levels (0.98-1.00), suggesting it is well-suited for scenarios where interpretability and robustness to defect variations are prioritized over speed. ResNet50, while yielding near-perfect offline accuracy (99.98%) and superior feature extraction capabilities, encountered practical deployment limitations. Although executable on Raspberry Pi 5, its inference speed was considerably lower (~3.87 FPS, ~248 ms), and attempts to apply 8-bit post-training quantization (PTQ) failed due to unsupported operations or severe accuracy degradation. These issues stem from architectural complexity (~25 million parameters) and lack of compatibility with edge hardware, underscoring the need for model  
Figure 16: Real-time inference results using the EfficientNet-B3 model for binary defect classification. The model accurately detects defective plates with high confidence (Defect: 0.98-1.00). The green overlay displays the predicted class and confidence score. These results demonstrate the model’s robustness in identifying defect patterns under varied lighting and positioning. specific optimization techniques. Without quantization-aware training or targeted pruning, ResNet50 remains impractical for real-time use on embedded systems. Beyond performance metrics, interpretability was assessed using Grad-CAM heatmaps to visualize the regions that influenced model decisions. All models generally focused on semantically relevant areas--typically around visible hole defects--validating that CNNs were learning meaningful features. In instances of incorrect predictions, Grad-CAM helped reveal confounding factors such as glare or surface texture irregularities that misled the model. This diagnostic capability enhances trust in AI predictions, a critical requirement for industrial deployment where decisions must be explainable. An interesting behavioral trend observed during real-time testing was a tendency among MobileNetV3-Large and EfficientNet-B3 to frequently predict the \"Defect\" class, even in borderline or clean samples. This bias likely reflects residual class imbalance in the training data or environmental factors in the test setup. Such conservative prediction behavior, while reducing false negatives, may increase false positives, highlighting the importance of dataset balancing and adaptive thresholding strategies in future work. While class weighting and data augmentation were used to mitigate dataset imbalance during training, these approaches may not fully eliminate bias, particularly in edge deployment scenarios where environmental noise exacerbates uncertainty. To further address this issue, future work will explore more advanced imbalance handling strategies such as Focal Loss, which dynamically down-weights easy examples to focus training on harder, minority-class samples. Additionally, synthetic oversampling techniques, including SMOTE and GAN-based augmentation, will be investigated to enrich minority-class diversity without duplicating existing patterns.