# Deep Learning-Based Crack Detection on Cultural Heritage Surfaces
## 2 Materials and Methods
### Image Preprocessing  
Image preprocessing is a fundamental component of deep learning applications in image analysis. The first preprocessing step in this study involved converting color images to grayscale. Since color images consist of red, green, and blue channels, converting them to grayscale, which contains only a single channel, significantly reduces data volume and computational demand. This reduction is especially beneficial in resource-constrained environments, as it enhances both training and inference efficiency. As highlighted by [37], grayscale conversion improves numerical analysis reliability and enhances geometric representation in structural analysis. Simple preprocessing techniques, such as contrast enhancement, facilitate the extraction of crack features. [PERSON] et al. [38] demonstrated that color-independent features are crucial for crack detection in deep learning, suggesting that grayscale images can enhance model performance. In this study, grayscale conversion was applied to help models focus on essential crack features. Figure 1 illustrates crack patterns in images before and after grayscale conversion.  
The second preprocessing step involved standardizing image dimensions, a crucial requirement for deep learning models, as they typically require fixed-size input images. Variability in input dimensions can hinder effective model training and negatively impact generalization and accuracy. [PERSON] et al. [38] demonstrated that image resizing and standardization can enhance analytical efficiency while improving accuracy, precision, and F1-score. Although numerous studies have reported that higher image resolution generally yields more accurate results [39; 40; 41], the processing capacity of most deep learning models is constrained by hardware limitations, typically restricting input image sizes to below 500,000 pixels. In the present study, all images were uniformly resized to 224 \(\times\) 224 pixels. As such, the resolution offered by most commercially available smartphone cameras is sufficient to fulfill the image requirements for the proposed methodology.  
The third preprocessing step was image annotation, which entails accurately labeling specific objects or regions within an image by defining object boundaries or assigning categorical labels. These annotations provide deep learning models with essential ground truth data, enabling accurate identification and classification of new image data. [PERSON] et al. [42] demonstrated that marking boundary boxes in crack images improves model accuracy and detection speed. In this study, the Image Labeler tool in MATLAB R2022a was used for image annotation.  
The final preprocessing step involved data augmentation (DA), which applies transformations such as flipping, rotation, and translation to increase dataset variability. This process not only enhances image quality but also exposes the model to a broader range of scenarios, reducing the risk of overfitting. Data augmentation strengthens the model's adaptability to dynamic environments and broadens its experiential scope, allowing for better generalization to new or unfamiliar contexts. Additionally, it reduces reliance on specific image characteristics, thereby further improving generalization. In this study, the imageDataAugmenter function in MATLAB was employed to introduce a series of random transformations to the input images.