# Non-Invasive Painting Pigment Classification Through Supervised Machine Learning
## 4 Methodology  
To construct the dataset for classification, each pigment sample was initially cropped into a 100 x 500 pixel stripe. This stripe was subsequently subdivided into 20 smaller image patches, each measuring 32 x 32 pixels, as illustrated in Figure 3. This oversampling strategy enabled the generation of a more comprehensive feature set and contributed to increased robustness during the training phase. In total, the dataset comprised 200 distinct classes, corresponding to 40 unique pigments, each represented by five formulation variants. Figure 3: Visualization of the oversampling procedure used for training data preparation. Each pigment sample was cropped into a 100 x 500 pixel stripe, which was then subdivided into 20 image patches measuring 32 x 32 pixels, yielding individual training examples. Figure 2: Iron Oxide Red pigment sample in (left to right) VIS, UVFC (GBUV image), and IRFC (IRRG image) techniques. From each image patch, a set of features was extracted from the visible (VIS), ultraviolet false-color (UVFC), and infrared false-color (IRFC) images. For each RGB channel, the mean and standard deviation were computed, resulting in six statistical descriptors per image modality. These values were concatenated into a unified feature vector of 18 dimensions (3 channels \(\times\) 3 modalities \(\times\) 2 statistics). Given that all pixel values were in the range of 0 to 255, no additional normalization was applied. A comprehensive evaluation of classical machine learning algorithms was conducted using the scikit-learn library [26]. The tested classifiers included Support Vector Machine (SVM), Stochastic Gradient Descent (SGD), Decision Tree, AdaBoost, Bagging, Extra Trees, K-Nearest Neighbors (KNN), Random Forest, Logistic Regression, and Gaussian Naive Bayes (NB). All models were used with their default hyperparameter configurations unless otherwise stated (Table 1). Each classifier was trained on the 18-dimensional feature vectors using five-fold cross-validation with class stratification. The entire procedure was repeated twice, with shuffling of the dataset prior to each iteration to enhance the reliability of the performance estimates. The final evaluation metrics--accuracy, precision, recall, and F1 score--were averaged across all ten folds (2 repetitions \(\times\) 5 folds), and their respective standard deviations were also computed and reported. Given the limited size of the laboratory dataset, no separate holdout set was reserved. Instead, final validation was conducted using data from real-world painting-like samples to ensure greater diversity. For this purpose, domain experts annotated regions of interest (ROIs) in four modern reference paintings designed to emulate 14 th-15 th-century Italian panel painting techniques (Figure 4). These artworks were created with egg tempera using well-documented pigments sourced from Kremer Pigments GmbH & Co. KG (Aichstetten, Germany). As a result, the ground-truth labels for annotated regions were established based on the known materials used during their fabrication; no instrumental analyses (e.g., XRF or Raman spectroscopy) were conducted on these validation samples. The annotated regions were segmented into 32 \(\times\) 32 pixel patches, consistent with the training setup. The same feature extraction and classification pipeline was applied. The final classifier, selected based on cross-validation performance, was used to predict pigment labels within these ROIs. Evaluation metrics (accuracy, precision, recall, and F1 score) were computed to assess the model's performance on these external, practice-oriented samples (Figure 5), reflecting its real-world applicability in conservation contexts.