## 4 Discussion  
The proposed solution outperformed the state-of-the-art solutions by a significant margin on average, especially for the DIBCO 2019 dataset, which proved to be exceedingly difficult for all the compared solutions. The performance of the proposed solution on DIBCO 2019 was remarkably close to the average over all the datasets, making our solution the most robust method presented in this study. Although D2 BFormer outperformed the proposed solution on the first nine DIBCO datasets, its performance on DIBCO 2019 was so low that, on average, the proposed solution performed better in three of the four scenarios. The poor performance of previous state-of-the-art solutions on the DIBCO 2019 dataset is most likely caused by bleed-through on 6 of the 20 images (see Figure 1) and by missing paper sections on 10 of the 20 images (see Figure 2). The proposed method uses a decision tree ensemble, which is significantly less demanding to train compared with any deep learning architecture, being able to run in low memory conditions and using only CPU. Thus, the user is able to quickly and easily incorporate any additional datasets in the training phase, making the tuning of the model to specific use cases more accessible. A deep learning architecture incorporating the  
Figure 2: Comparison of binarization results. Left to right, top to bottom: original image, ground-truth, Otsu binarization, Sauvola binarization, GDB binarization, proposed solution binarization. same features might yield better results, but finding a suitable architecture and tuning the hyperparameters would likely take much longer. Further experimentation is required. Refitting the model to the full dataset produced significantly better results. However, this may have been caused by overfitting. Therefore, further investigations are required. In practical applications, we would recommend using the model fitted on the whole dataset. However, if it performs poorly, one of the cross-validation models could be used, or they could all be combined using a voting system, minimizing the risk of overfitting, therefore guaranteeing similar performance on new data. The practical application we would recommend would be using the proposed model to binarize images as part of an OCR pipeline. However, the proposed method is not limited to this use case. It can easily be adapted to deploy practical applications in other fields, such as industrial counting, medical imaging, pattern recognition, etc., by training on data specific to those fields. Future work could include using more datasets or adding more features to the model, such as higher-order moments, higher-order generalized bimodality coefficients [43], other local thresholding algorithms, and global thresholding algorithms. The proposed method is not limited to document images; other uses of binarization may be tested using domain-specific datasets. Another viable way to improve the results would be to use nested cross-validation [44] to increase the confidence that the best model found is not prone to overfitting, allowing us to retrain the model on the entire dataset for even better results. However, this would multiply the training time by the number of outer cross-validation folds, making it very time-consuming. A more straightforward method of improving the results would be to run the experiment on a machine with more memory and a faster processor, or to increase the time limit. Conceptualization, N.T., C.-A.B. and M.-L.V. ; Data curation, C.-A.B. ; Formal analysis, N.T., C.-A.B. and M.-L.V. ; Investigation, N.T. ; Methodology, N.T. and M.-L.V. ; Project administration, C.-A.B. ; Resources, C.-A.B. ; Software, N.T. ; Supervision, C.-A.B. ; Validation, N.T., C.-A.B. and M.-L.V. ; Visualization, N.T., C.-A.B. and M.-L.V. ; Writing--original draft, N.T. ; Writing--review and editing, N.T., C.-A.B. and M.-L.V. All authors have read and agreed to the published version of the manuscript. The APC has been supported by Politehnica University of Bucharest, through the PubArt program. Not applicable.