# Exploring the ViDiDetect Tool for Automated Defect Detection in Manufacturing with Machine Vision
## 4 Results and Discussion  
In the next stage of work, the ViDiDetect tools were configured, starting from defining the ROI. The results of training the neural network are shown in Figure 10. The dataset used for training and testing the neural network consisted of 500 labeled images of tested surfaces. Each image was classified as good, bad, or unspecified, based on the presence or absence of defects. The dataset was divided into three subsets:  
* Training Set: This subset, comprising 80% of the data, was used to train the neural network;
* Validation Set: A portion of the data, typically 10%, was set aside for validation. The validation set was used during training to monitor the model's performance and prevent overfitting;
* Testing Set: The remaining data, around 10%, was reserved for testing the trained model's performance. The model was evaluated on this set to assess its ability to classify images accurately. To analyze the results, the GetScore and GetPassed functions were used, returning the result of the found defect (in mm\({}^{2}\)) and a Boolean answer regarding the correctness of the detail, respectively. The Score graph lists all images that were labeled and scored as well as the two thresholds (T1, T2) for the graph. These thresholds are the localized defect area, expressed in mm\({}^{2}\). The first threshold determines the maximum value a True Negative (truly lacking a defect) can have before it is unsure about its value. The second threshold determines the minimum value a result must have before it is considered a True Positive (truly containing a defect). Values in between are considered False Positives or False Negatives, depending on their label, and are assigned to the Inter column of the confusion matrix. The study shows that, out of 41 images, 35 were marked as good or bad detail. Eight (8) details  
Figure 10: Results of defect recognition on the tested surface—first attempt. were marked as good; in five cases, the network was not sure of the solution. Finally, 10 images were flagged as bad; in this case, 12 were flagged as unsafe (out of 22 tested). The network was trained in such a way that it did not classify details with emulsion residues as bad; most of the details that had visible emulsion were considered by the network as incorrect in the process of processing. For this purpose, a mask was placed on the tested surface in such a way that only the edge of the surface was tested (Figure 11). The application of the mask is intended to ignore parts of the analyzed area from the region of interest. The mask was added manually as part of the image processing and analysis workflow. It is used to precisely define a region of interest (ROI) within an image, which narrows the focus of the machine vision system to a specific area for further analysis. This allows the deep learning tool to focus on a narrower area, which improves classification results. In the learning process, the same sequence of actions was used as in the previous case, but an appropriate mask was additionally applied. The results of the operation of the neural network with the mask applied are shown in Figure 12.  
The obtained results show that, out of 22 labelled images, 14 were considered good and 8 were bad. Only one image was marked as unspecified. The limit values are 6.32 mm\({}^{2}\) for good classification and 6.65 mm\({}^{2}\) for bad classification. The use of an appropriate mask, narrowing the ROI to the edge of the examined surface, clearly improved the classification results and the efficiency of the algorithm. [PERSON] et al. [31] reached similar results in their publication, proving that machine vision systems can use pattern recognition and machine learning algorithms to automatically recognize and classify objects in an image. This allows the system to adapt to various conditions and increase the effectiveness of the analysis. [PERSON] et al. [32] have focused on a variety of machine vision systems for the assessment of machining parameters.