## 2 Materials and Methods
### Techniques for Explainable AI (XAI)
#### 2.4.1 Local Interpretable Model-Agnostic Explanations (LIME)  
Interpreting the predictions made by deep neural networks can be quite challenging due to their inherent complexity. Local Interpretable Model-Agnostic Explanations (LIME) is a technique developed to shed light on the reasons behind the classification decisions of deep neural networks [53; 78; 79; 80; 81; 82; 83]. Deep neural networks are often likened to \"black boxes\" due to the complexity and opacity of their decision-making processes. To mitigate this, LIME approximates the behavior of these intricate networks with a model that is simpler and more interpretable, such as a regression tree. This approach makes it easier to understand which features in the input data are significant in influencing the decisions made by the network. LIME is particularly beneficial in the realm of image classification. It enables the creation of feature importance maps using the following key steps:  
1. Segmenting features--the input image is divided into segments based on similar pixel characteristics such as color, texture, or intensity. 2. Creating segment masks--a binary mask is generated for each segment, indicating whether the segment is included (1) or excluded (0) in the synthetic image. 3. Generating synthetic images--synthetic images are produced by modifying the original image according to the segment masks, where excluded segments are replaced with average pixel values to obscure their information. 4. Identifying synthetic images--every synthetic image undergoes analysis through the neural network to ascertain how the presence or lack of specific segments influences the result of the classification. 5. Fitting an interpretable model--to establish a simpler, understandable model like a regression tree, the link between the presence of segments and their classification scores is leveraged. 6. Determining feature importance--the simpler model helps identify the significance of each segment, which is then mapped back to the original image to highlight influential regions. 7. Mapping feature importance--the significant values identified from segments are applied back to the initial image. This process generates a map that highlights the areas of the image that were crucial for the model's decision-making. By applying LIME in our image classification tasks, we gain a clearer understanding of how our Convolutional Neural Network (CNN) models classify drilled holes in melamine-faced chipboard. This insight is crucial for validating the models' performance and ensuring they focus on the relevant features of the images. In our study, with the VGG19 model, LIME was utilized to explain both correct and incorrect classifications. Figures 5 and 6 display the LIME-generated explanations for the VGG19 model's predictions on images of drilled holes. These visualizations are invaluable for identifying the critical regions in the images that the model considered, thus allowing us to assess its reliability and identify areas for potential improvement. Figure 5: LIME-generated explanations for accurate predictions made by the VGG19 model on images featuring drilled holes are presented. The first row (**a**–**c**) displays the original images, while the second row (**d**–**f**) presents the LIME explanations corresponding to these images: (**a**) true class: Green, predicted class: Green; (**b**) true class: Yellow, predicted class: Yellow; (**c**) true class: Red, Predicted class: Red; (**d**) LIME explanation for image (**a**); (**e**) LIME explanation for image (**b**); (**f**) LIME explanation for image (**c**). Figure 6: Explanations generated by LIME for misclassified predictions by the VGG19 model on images of drilled holes.