4.2.1. Performance of Geometric Normalization
The geometric normalization stage was evaluated on the test partition using robust statistics, specifically the median and interquartile range (IQR), in order to characterize variability across samples. First, the alignment success rate reached 100% (200/200 test documents), defined as the proportion of samples for which a valid homography was estimated and an aligned output was correctly generated. In addition, considering the full aligned and curated dataset, all selected samples were successfully normalized, with no failures recorded during dataset construction.
Second, the inlier ratio was quantified, defined as
, which directly reflects the geometric consistency of the correspondences retained by RANSAC. In the test set, this ratio had a median of 0.7958 and an IQR from 0.7499 to 0.8213. Complementarily, the number of inliers showed a median of 410.5 (IQR: 317.0–518.25), while the number of retained valid matches reached a median of 524.5 (IQR: 411.0–631.0) (see
Table 4).
Figure 5 shows an example of the result on a test-set case.
4.2.2. Restoration Results and OCR Utility
Figure 6 and
Table 5 summarize the qualitative and quantitative comparison between the proposed method and the considered baselines, including a no-restoration reference (Noisy input) and a classical restoration pipeline (CRP). The results in
Table 5 correspond to the fixed-budget scenario, in which all learned models were trained for 50 epochs and 500 steps per epoch, ensuring a controlled comparison across architectures. The evaluation was performed on the test set aligned in canonical space, allowing all methods to be compared under the same geometry. Therefore, the results in
Table 5 should be interpreted as a comparison focused on the restoration stage, under favorable and homogeneous conditions for all learned models. In this scenario, PSNR and SSIM quantify radiometric and structural fidelity with respect to the clean reference, while F-measure and DRD evaluate the preservation of the document foreground after binarization. To measure functional utility, CER and WER were computed from OCR on the identification region of the form, comparing the recognized text with the synthetic reference content available in the dataset JSON files. In particular, these metrics were aggregated as micro-averages, in order to reflect the total character and word error over the full evaluated set.
First, the results show that both Noisy input and CRP remain clearly below the learned models. Although CRP slightly improves over the degraded input image (PSNR: 15.4991 vs. 14.5045; CER: 0.1455 vs. 0.1538), its performance remains limited across all metrics, confirming that a classical pipeline is insufficient under complex degradations in structured tax documents. In contrast, all deep learning-based methods produce a substantial improvement in visual fidelity, structural consistency, and OCR legibility.
Among the learned baselines, U-Net + prior achieved the best performance in the visual and structural metrics, reaching the highest PSNR (28.3218 ± 2.3118), the highest SSIM (0.9841 ± 0.0079), the best F-measure (0.9243 ± 0.0261), and the lowest DRD (183.1854 ± 97.3021). This result indicates that, once the geometry is fixed through prealignment, explicitly incorporating the canonical format as a prior provides a clear advantage over purely end-to-end restoration. Indeed, U-Net + prior outperforms both the U-Net baseline and the Attention baseline, suggesting that, in this problem, explicit document structure is more beneficial than only increasing architectural complexity or introducing attention mechanisms without geometric constraints.
However, when the comparison shifts to the functional level, the most relevant behavior corresponds to the proposed hybrid method. Although it does not achieve the best PSNR or SSIM, it obtains the best OCR utility results, with the lowest CER (0.1091) and the lowest WER (0.3495) in the entire comparison. This is particularly important because the objective of the problem is not only to restore the global appearance of the form, but also to correctly preserve and recover the variable content inserted into a rigid template. In this sense, the hybrid method shows a better balance between visual restoration and semantic text recovery, which is consistent with its design: the canonical template resolves the fixed structure, while the network focuses on reconstructing useful content within the informative regions.
On the other hand, the DE-GAN baseline showed the worst performance among the learned models (CER: 0.3928; WER: 0.9353), even with structural results below several non-adversarial baselines. This behavior suggests that, for this type of form, adversarial optimization does not offer a clear advantage and may even affect the stability of the restoration. Similarly, the Attention baseline improves over Noisy input and CRP, but remains below the prior-guided variants, reinforcing the central hypothesis of this work: in documents with a rigid layout, learned attention alone does not replace the explicit incorporation of structural information.
This allows two main conclusions to be drawn. First, canonical prealignment followed by supervised restoration constitutes an effective strategy for this problem. Second, the best visual quality does not necessarily coincide with the best OCR utility: while U-Net + prior dominates in fidelity and structural preservation, the proposed hybrid method provides the best textual recovery, which is ultimately the most relevant property in automatic reading and document-processing scenarios.
As a complementary analysis,
Table 6 reports a convergence-oriented scenario based on early stopping.
Table 5 should be interpreted as the main comparison under a fixed and homogeneous training budget, whereas
Table 6 presents a convergence-based scenario in which each learned model is evaluated at the best checkpoint determined by the evolution of the validation criterion. In this configuration, early stopping was applied with a patience of 5 epochs and a maximum of 120 epochs, while keeping the same dataset, validation split, and 500 steps per epoch used in the fixed-budget setting. The results show that this configuration preserves the general ranking trends: U-Net + prior remains the strongest method in terms of visual and structural fidelity, whereas the proposed hybrid model achieves the best OCR-oriented performance (CER = 0.1072, WER = 0.3175). This result suggests that, when training is allowed to adapt to convergence, the hybrid formulation better supports the objective of improving the functional legibility of the document, rather than optimizing only global image similarity.
Figure 7.
Improvement in validation metric (from epoch 1) over training epochs under early stopping.
Figure 7.
Improvement in validation metric (from epoch 1) over training epochs under early stopping.
4.2.3. Computational Cost and Practical Efficiency
Table 7 compares the computational cost of the evaluated methods in terms of number of parameters, arithmetic complexity, peak GPU memory, training time, and inference latency. This analysis complements the restoration and OCR results, since in real document-processing applications, not only output quality matters, but also the practical feasibility of the method under time and resource constraints.
First, the U-Net-based models show a very similar computational profile. The U-Net baseline, U-Net + prior, and the proposed hybrid model have around 7.76 M parameters and 27.3 G FLOPs, with memory requirements close to 1.5 GB and training times per epoch between 74 and 77 s. This indicates that incorporating the canonical prior and the hybrid scheme does not introduce a severe computational penalty compared with the base model. In particular, using the 1600 training images, the proposed method requires 77.02 ± 0.69 s per epoch and 64.18 ± 0.57 min to complete 50 epochs, representing only a moderate increase compared with the U-Net baseline (61.82 ± 0.40 min) and U-Net + prior (62.97 ± 1.12 min).
The DE-GAN baseline has the lowest number of parameters (1.810 M) and the lowest theoretical complexity (0.428/0.214 G FLOPs/MACs), as well as the lowest inference latency among the learned models (2.67 ± 0.12 ms). However, this cost advantage does not translate into better restoration quality, since it was one of the worst-performing methods in the previously reported metrics. This suggests that low arithmetic complexity alone is not sufficient to adequately restore degraded rigid forms.
In contrast, the Attention baseline represents the least favorable case in terms of practical efficiency. Although its number of parameters (3.293 M) is lower than that of the U-Net variants, its peak memory reaches 3.188 ± 0.019 GB, more than twice that of the other learned models, and its inference latency reaches 20.61 ± 0.73 ms, well above the rest. It also records the highest training time per epoch (91.14 ± 0.33 s). Consequently, this model does not offer an attractive cost-benefit ratio for real deployment scenarios.
Finally, CRP does not require training, but its inference latency (132.17 ± 9.21 ms) is the highest among all evaluated methods. This indicates that avoiding training cost does not necessarily imply greater operational efficiency when large volumes of documents must be processed.
The proposed hybrid method offers a favorable trade-off between performance and computational cost. Although it is not the lightest method, it maintains memory requirements, training time, and latency very close to U-Net + prior, while improving the final utility for OCR. From a practical perspective, this suggests that the functional gain of the hybrid approach is achieved without introducing prohibitive computational overhead.
4.2.4. Component Ablation
Table 8 presents the results of the ablation study of the proposed method on the test set, with the aim of isolating the effect of three key components: the content-oriented masked loss, the structural fusion with the canonical template, and the explicit visual template prior. In all cases, the variants were retrained under the same experimental protocol as the full model, so that the observed differences could be attributed primarily to the removed component.
The most consistent result corresponds to the w/o template prior variant, which produces the largest overall degradation in the visual and structural metrics. Compared with Hybrid full, this ablation reduces PSNR from 26.4961 to 24.2217, SSIM from 0.9607 to 0.9438, and F-measure from 0.9113 to 0.8701, while increasing DRD from 297.3505 to 325.9923. This behavior indicates that the explicit canonical prior is a central component of the method, since it provides a stable structural reference that improves restoration in documents with a fixed layout. In other words, when the model loses access to the visual template of the form, its ability to preserve the global organization of the document is clearly reduced.
The other two ablations show a more subtle behavior. Both w/o masked content loss and w/o template fusion obtain higher values than the full model in PSNR, SSIM, F-measure, and DRD. In particular, w/o template fusion achieves the best visual results in the table, with PSNR = 28.3505 ± 2.3779, SSIM = 0.9827 ± 0.0082, and DRD = 146.0933 ± 90.4275. However, this improvement does not translate into better textual utility: its OCR metrics (CER = 0.1124, WER = 0.3588) remain below those of the full model. A similar pattern is observed for w/o masked content loss, which improves the visual restoration metrics but worsens text recovery (CER = 0.1142, WER = 0.3627).
This result is particularly relevant for interpreting the behavior of the proposed method. The full variant is not optimized solely to maximize global image similarity, but rather to correctly recover the variable content of the form. The masked loss and template fusion appear to act as functional regularization mechanisms, sacrificing part of the global visual fidelity to favor the preservation and legibility of useful content. Therefore, although the simplified variants may produce images closer to the GT in terms of PSNR/SSIM, the full model remains the one with the best OCR performance, achieving the lowest CER (0.1091) and WER (0.3495) in the ablation study.
Therefore, first, the template prior is the most critical component for maintaining the structural quality of the method. Second, the combination of content-oriented loss and template fusion does not necessarily maximize classical visual metrics, but it does improve the final utility of the restored document for automatic reading.