## 3 Results
### Azure Custom Vision and NIA Results  
Azure Custom Vision detects defects in cast wheels, leveraging ML to classify images based on their features. In this project, we used its classification capabilities to differentiate between cast and defects. This process involved training the model with two distinct groups: one containing images of defect-free casts and the other containing images of casts with defects. The classification task focused on identifying common defects such as cracks or surface irregularities. A carefully curated dataset of labeled images was prepared, consisting of high-quality images for both defective and non-defective casts. The training dataset uses 4440 images: 2220 for cast and 2220 for defect class. The dataset used for training the model was downloaded from the Kaggle platform [64]. The images used for evaluation were captured using the ESP32-CAM module, which features an OV2640 camera sensor capable of resolutions up to 1600 \(\times\) 1200 pixels. We opted for a High-Definition (HD) resolution of 1280 \(\times\) 720 pixels to balance image quality with processing efficiency. The model's ability to correctly identify highlights its capacity to generalize the distinguishing features between the two categories. It should be mentioned that the model does not perform pixel-by-pixel analysis but instead performs a feature-level generalization, which is not limited to a specific image size. Figures 6 and 7 depict two examples with different dimensions and angles. The two figures demonstrate that the dimensions of the images do not affect the service's ability to classify correctly. The parts in the images have the same defect, marked by the red ellipse. The Azure Custom Vision correctly classifies the defect in both figures, as graphically highlighted in a blue rectangle. During training, Azure Custom Vision's interface allowed us to upload images, assign them to categories (cast or defect), and label them accordingly. The platform's automated model training used these inputs to learn distinct visual patterns that separate the two classes. Figure 6: Example of an image with 1280 \(\times\) 720 pixels resolution correctly classified. Figure 8 displays the performance metrics of the ML model trained to classify images into two categories: defect and cast. The model's performance has been evaluated based on standard metrics (_Precision_, _Recall_, and _AP_). The model was tested using 706 images labeled as ok or nok. Next, the standard evaluation metrics were applied (_Accuracy_, _Precision_, _Recall_, and _F\({}_{1}\)-Score_). The _Precision_ presented in Figure 8 indicates that 98.5% of the images predicted to show defects were correctly identified as defects. This highlights the model's reliability in avoiding FP, ensuring that most defect predictions are accurate. The _Recall_ of 98.5% demonstrates the model's effectiveness in capturing most defect cases. The _AP_ of 93.9% reflects the model's strong ability to rank its predictions correctly across different thresholds. This high _AP_ score signifies that the model consistently maintains a good balance between _Precision_ and _Recall_, showing excellent performance when identifying and prioritizing defect cases. As depicted in Figure 8, the \"Landmarks\" domain from Azure Custom Vision was selected for training the model intended for defect detection on cast parts due to its superior ability to recognize distinct visual features, such as shapes, textures, and structural details. Figure 8: Performance metrics for the trained multiclass image classification model on ok (defect-free cast) and nok (defect cast) categories. Figure 7: Example of images with 512 \(\times\) 512 pixels resolution correctly classified. This domain is optimized for visible and prominent features, making it ideal for the visual analysis of cast parts, where subtle variations, such as cracks or scratches, must be identified.