TL;DR
This paper explores effective strategies for training Convolutional Neural Networks (CNNs) to identify and segment rare medieval "notarial instruments" within massive document archives. By combining random minority oversampling, a novel "symbol swap" data augmentation technique, and specialized loss functions like class-weighted Dice loss, the authors successfully overcome severe class imbalance to detect tiny notary signs with high precision.
What Problem Does This Paper Address?
Historians interested in the development of medieval monasteries often look for "notarial instruments"—legal documents authenticated by a unique, hand-drawn notary sign (see Figure 1). However, automating the search for these documents presents three major computer vision challenges:
- Severe Class Imbalance: In typical archives, notarial instruments are vastly outnumbered by other document types (a ratio of roughly 1:32 in this study).
- Scale Imbalance: The notary sign is a tiny, localized feature within a much larger document, making it a "needle in a haystack" for segmentation models.
- Data Quality: Medieval documents suffer from centuries of wear, including water damage, faded ink, and stains, which can confuse standard recognition algorithms.
Methods
The authors evaluated a variety of techniques to counter class imbalance for both binary classification (is this a notary document?) and multi-class segmentation (where is the text, ornament, and notary sign?).
- Architectures: They used ResNet50 and DenseNet121 for classification and a 5-layer U-Net for segmentation.
- Sampling Strategies: They compared Random Minority Oversampling (ROS)—repeatedly showing the network the rare notary documents—against Random Majority Undersampling (RUS).
- Novel Augmentation (Notary Symbol Swap): To create more diverse training data, the authors introduced a technique where notary signs were digitally "swapped" from one document to another or added to arbitrary locations in non-notary documents (see Figure 3).
- Algorithmic Countermeasures: They tested Focal Loss, which focuses training on "hard" examples, and Class-weighted Dice Loss, which penalizes errors on small, rare classes more heavily than on the dominant background.
Datasets
The study utilized a collection from the Monasterium project, a digital archive of medieval documents.
- Classification Set: 31,836 documents (974 notarial instruments, 30,862 others) from 800 CE to 1499 CE.
- Segmentation Set: 887 images with pixel-level ground truth labels for background, text, ornaments, and notary signs.
Key Insights and Ideas
- Oversampling is King for CNNs: Unlike traditional machine learning where oversampling often leads to overfitting, the authors found that for CNNs, oversampling the minority class (especially when paired with data augmentation) significantly boosted performance without detrimental overfitting.
- DenseNet > ResNet for Imbalance: DenseNet121 consistently outperformed ResNet50, likely due to its feature-reuse architecture which provides better stability and parameter efficiency when learning from limited minority samples.
- Augmentation has a "Sweet Spot": While "moderate" augmentation helped the models generalize, "heavy" augmentation (which introduced extreme noise and distortions) actually degraded performance as the synthetic images became too dissimilar from real historical documents.
- Dice Loss is Essential for Tiny Features: Standard loss functions like Binary Cross Entropy (BCE) and even Focal Loss failed to segment the tiny notary signs effectively. Only class-weighted Dice loss provided the necessary signal to force the U-Net to pay attention to these small regions.
Key Results
- Classification: The best model (DenseNet with ROS, moderate augmentation, and symbol swapping) achieved an F1-score of 96.9%. In contrast, a baseline ResNet model trained without any imbalance countermeasures failed completely, identifying zero notarial instruments.
- Segmentation: Combining Dice and BCE loss yielded the best results, achieving a mean Intersection over Union (IoU) of 0.7264. Without class-weighting, the IoU for notary signs was effectively zero.
Limitations and Future Work
The authors noted that Focal Loss performed surprisingly poorly in the segmentation task. They hypothesize this is because the manual ground truth labels for notary signs often have non-distinct boundaries; Focal Loss may have over-focused on these ambiguous edge pixels as "hard examples," leading to poor overall segmentation.
Future work will involve testing these strategies against varying levels of class imbalance and refining the "symbol swap" technique to include more realistic blending and noise to further improve synthetic data quality.
Summary updated