
In industrial manufacturing, particularly in the domain of quality control for metal components, visual inspection is paramount. The surface integrity of a casting part is a critical indicator of its structural soundness and functional reliability. Defects such as scratches, pits, sand holes, material shortages, and mixed irregularities must be detected with high precision to prevent downstream failures. Automated visual inspection systems often rely on high-resolution imagery to capture these subtle, yet critical, surface anomalies. However, acquiring such high-fidelity images consistently on a production line can be prohibitively expensive or technically challenging due to constraints in camera hardware, lighting variations, and required stand-off distances. Consequently, image super-resolution (SR) technology presents a compelling software-based solution to enhance image quality cost-effectively, potentially revealing defect details that are lost or obscured in low-resolution captures.
The core objective of single image super-resolution (SISR) is to reconstruct a high-resolution (HR) image from a single low-resolution (LR) observation. This is a classic ill-posed inverse problem, as infinitely many HR images can degrade to the same LR image. Traditional and deep learning-based methods have approached this problem through different paradigms, each with inherent trade-offs. Early convolutional neural network (CNN) based methods, such as SRCNN and EDSR, focused on minimizing pixel-wise distortion metrics like Peak Signal-to-Noise Ratio (PSNR). While they achieve impressive scores, the reconstructed images often suffer from excessive smoothness and lack high-frequency textural details, rendering them unsuitable for the meticulous inspection of casting part surfaces where edge sharpness and micro-texture fidelity are non-negotiable.
To improve perceptual quality, Generative Adversarial Network (GAN)-based frameworks like SRGAN and ESRGAN were introduced. These methods excel at generating realistic-looking textures, aligning better with human visual perception. However, their adversarial training process is notoriously unstable and can lead to the generation of hallucinated or artificial textures that do not correspond to the true physical surface of the casting part. In an industrial inspection context, such pseudo-textures are catastrophic, as they could be misinterpreted as actual defects (false positives) or obscure genuine flaws (false negatives), directly impacting the reliability of the quality assurance process.
More recently, diffusion models have emerged as a powerful generative framework, demonstrating superior capability in generating high-quality, detailed images. Diffusion-based SR models like SR3 and SRDiff iteratively denoise a random Gaussian distribution conditioned on the LR input to produce diverse and perceptually convincing HR samples. Nevertheless, their powerful generative capacity is a double-edged sword. Without stringent constraints, they are prone to the same issue of introducing perceptually plausible but physically inaccurate details. The fundamental challenge, therefore, lies in harnessing the detail-generation prowess of advanced models like diffusion models while strictly regulating their output to be faithful to the underlying structure of the original casting part surface. This is often framed as navigating the perception-distortion trade-off, but for industrial inspection, the trade-off must be resolved heavily in favor of distortion (faithfulness), with perception (detail) being a secondary benefit that must not compromise fidelity.
This paper proposes a novel super-resolution framework specifically designed for industrial casting part inspection, termed Comprehensive Null-Space Regularization (CNSR). The central thesis is that the uncontrolled generation of pseudo-textures stems from the excessive “freedom” or null-space of the SR mapping that generative models can exploit. Our method introduces a multi-tiered regularization strategy operating directly on this null-space to comprehensively constrain the diffusion process. The contributions are threefold:
1. We introduce a Null-Space Priori Extractor (NSPE) that explicitly decomposes image features into range (low-frequency structure) and null (high-frequency detail) spaces. The extracted null-space component serves as a targeted prior to guide the diffusion model, focusing its generative capacity on reconstructing valid high-frequency content present in the LR image rather than inventing new ones.
2. We design a Multi-Axis Domain Fusion Module (MADF) based on a Range Null-Space Decomposition (RND) formulation. This module acts as a post-diffusion filter, strategically fusing the diffusion model’s output with the deterministic LR information across different spatial axes to suppress any remaining pseudo-textures and ensure global consistency.
3. We propose a Null-Space Loss function that enforces similarity between the null-space components of the reconstructed and ground-truth HR images during training. This loss directly penalizes the model for generating details that deviate from the true distribution of high-frequency features expected on a casting part surface.
By applying this comprehensive regularization at the prior, generation, and training levels, CNSR successfully leverages the diffusion model’s strength for detail synthesis while drastically curtailing its tendency to hallucinate. Extensive experiments on a real-world industrial casting SR dataset (IndSR) demonstrate that CNSR achieves state-of-the-art performance in both distortion metrics (PSNR, SSIM) and no-reference perceptual metrics (NIQE, PIQE). Most importantly, downstream anomaly detection tasks performed on images super-resolved by CNSR show significantly higher accuracy (AUROC, AUPR) compared to those using other SR methods, validating its practical utility for enhancing automated inspection systems.
1. Methodology
1.1. Overall Architecture
The proposed CNSR framework is built upon a latent diffusion model (LDM) backbone due to its efficiency and stability. The core innovation lies in embedding comprehensive null-space constraints into this backbone. The overall pipeline, illustrated in the conceptual diagram, consists of three synergistic components working in tandem: the Null-Space Priori Extractor (NSPE), the conditioned diffusion U-Net with Spatio-Temporal Attention Modulation, and the Multi-Axis Domain Fusion Module (MADF).
Given a low-resolution input image $I_{LR}$, the process begins with the NSPE. The LR image is encoded into a feature map, which is then subjected to a Range-Null Space Decomposition (RND). The null-space component, representing the high-frequency prior, is extracted and formatted as a conditioning signal $p$:
$$ p = \text{PRJ}(\text{RND}(\mathcal{E}(I_{LR}))) \in \mathbb{R}^{m \times n}, $$
where $\mathcal{E}$ is a feature encoder, $\text{RND}(\cdot)$ performs the matrix decomposition, and $\text{PRJ}(\cdot)$ projects the resultant null-space basis into a usable matrix form.
This prior $p$, along with the timestep embedding $t$, is fed into a Spatio-Temporal Attention Modulation (STAM) block within the diffusion U-Net denoiser. The STAM block generates a modulation signal $h$ that adaptively controls the feature maps in the U-Net’s residual blocks via Spatial Feature Transform (SFT) layers:
$$ h = \text{STAM}(p, t, z). $$
Here, $z$ is the latent representation of $I_{LR}$. The intuition is that the null-space prior provides a strong, content-aware guide, especially in early denoising steps where the signal is noisy, helping to steer the generation towards reconstructing authentic details. The influence is adaptively weighted across timesteps.
The diffusion process outputs a super-resolved latent representation, which is then decoded to an image $I_{SR}$. To apply a final, strong constraint guaranteeing faithfulness, $I_{SR}$ and the upsampled $I_{LR}$ are processed by the MADF. The MADF implements a learned, multi-axis version of the fundamental RND consistency equation $I = A^{\dagger}y + (I – A^{\dagger}A)\hat{x}$, where $A$ is the degradation operator. It fuses information from the range-space (derived from $I_{LR}$) and the null-space (derived from $I_{SR}$) across different axial partitions to produce the final, pseudo-texture-suppressed output $I_{RES}$.
1.2. Null-Space Priori Extractor (NSPE) and Loss
The NSPE is designed to explicitly separate and leverage the high-frequency information inherently present in the LR image. Let $X = \mathcal{E}(I) \in \mathbb{R}^{m \times n}$ be the matrix-represented feature map of an image $I$. Its singular value decomposition (SVD) is given by:
$$ X = U \Sigma V^{T}. $$
The range space $\text{Range}(X)$, representing the principal, lower-dimensional structure, is spanned by the first $r$ columns of $U$, where $r = \text{rank}(X)$:
$$ \text{Range}(X) = \text{span}\{u_1, u_2, \ldots, u_r\}. $$
Conversely, the null space $\text{Null}(X)$, representing the orthogonal complement housing fine details and textures, is spanned by the last $n – r$ columns of $V$:
$$ \text{Null}(X) = \text{span}\{v_{r+1}, v_{r+2}, \ldots, v_n\}. $$
The NSPE extracts the basis vectors of $\text{Null}(\mathcal{E}(I_{LR}))$ as the prior $p$. To train the model to respect the true null-space distribution of casting part surfaces, we introduce the Null-Space Loss. It measures the distance between the null-space (and range-space) of the reconstructed image and the ground-truth HR image using a projection distance metric $\text{PD}(\cdot, \cdot)$:
$$ \mathcal{L}_{\text{Null}} = \text{PD}\left(\text{Range}(\mathcal{E}(I_{REC})), \text{Range}(\mathcal{E}(I_{HR}))\right) + \lambda \cdot \text{PD}\left(\text{Null}(\mathcal{E}(I_{REC})), \text{Null}(\mathcal{E}(I_{HR}))\right). $$
The hyperparameter $\lambda$ balances the emphasis on structural (range) versus textural (null) fidelity. This loss directly penalizes the generation of details that project onto an incorrect null-space, i.e., pseudo-textures not belonging to the authentic casting part surface.
1.3. Multi-Axis Domain Fusion Module (MADF)
The MADF provides the final, decisive layer of regularization. Its goal is to fuse the preliminary SR result $I_{SR}$ with the information from $I_{LR}$ in a way that strictly adheres to the image formation model while being robust to local artifacts. The classical solution is:
$$ I_{RES} = A^{\dagger}I_{LR} + (I – A^{\dagger}A)I_{SR}. $$
The first term, $A^{\dagger}I_{LR}$, is a deterministic reconstruction from the LR data (range-space). The second term, $(I – A^{\dagger}A)I_{SR}$, is the component from $I_{SR}$ that lies in the null-space of $A$. A simple summation, however, can allow artifacts from $I_{SR}$’s null-space component to persist.
The MADF refines this by processing the range-space and null-space components through separate yet interactive pathways. It splits the input features into two branches. In the null-space branch, features are divided into local windows of size $b \times b$ to capture fine-grained local textures. In the range-space branch, a global grid of size $d \times d$ is applied to capture broader structural context. Each branch then employs a gated Multi-Layer Perceptron (gMLP) operator along its primary axis (window dimension for null-space, grid dimension for range-space). This dual-axis processing allows the module to simultaneously refine local details based on their immediate context and harmonize them with the global structure. The outputs from both branches are concatenated and integrated through a $1 \times 1$ convolution to produce the final, clean high-resolution image $I_{RES}$.
1.4. Objective Function
The total loss function for training CNSR is a weighted combination that addresses the multifaceted requirements of industrial SR:
$$ \mathcal{L}_{\text{total}} = \alpha \cdot \mathcal{L}_{1} + \beta \cdot \mathcal{L}_{\text{Perceptual}} + \gamma \cdot \mathcal{L}_{\text{Null}}. $$
- $\mathcal{L}_{1}$: The pixel-wise L1 loss between $I_{RES}$ and $I_{HR}$. This ensures overall geometric and structural alignment, crucial for accurate defect localization on the casting part.
- $\mathcal{L}_{\text{Perceptual}}$: The perceptual loss based on deep features (e.g., from a pre-trained VGG network). It enhances the visual realism and naturalness of the reconstructed micro-textures.
- $\mathcal{L}_{\text{Null}}$: The proposed null-space loss, as defined in Section 1.2, which is the key to suppressing hallucinated details.
The hyperparameters $\alpha$, $\beta$, and $\gamma$ are tuned to find the optimal operating point for the casting part inspection task, prioritizing faithfulness ($\mathcal{L}_{1}$ and $\mathcal{L}_{\text{Null}}$) while maintaining sufficient perceptual quality.
2. Experiments and Results
2.1. Experimental Setup
We evaluate CNSR on the IndSR dataset, a real-world industrial dataset comprising paired high-resolution (600×600) and low-resolution images of engine casting part surfaces with various defects (scratches, sand holes, material shortage, pits, mixed defects). Scaling factors of ×2, ×3, and ×4 are considered. Models are pre-trained on the DIV2K dataset and fine-tuned on IndSR. We compare against a wide range of SR methods: traditional (Bicubic), CNN-based (EDSR, RCAN, MAFFSRN), Transformer-based (SwinIR, ESRT, CAMixerSR), and diffusion-based (DDNM, SAM-DiffSR, HIR-Diff). Evaluation uses full-reference metrics (PSNR, SSIM on Y channel), no-reference perceptual metrics (NIQE, PIQE), and task-oriented metrics—the anomaly detection performance (AUROC, AUPR) achieved by the RD4AD model when applied to the super-resolved images.
2.2. Quantitative and Qualitative Analysis
The quantitative results, presented in the tables below, demonstrate the superior performance of CNSR. It consistently achieves the best scores across all scaling factors for both distortion and perceptual metrics. Crucially, it also enables the highest anomaly detection accuracy, proving its direct benefit to the downstream industrial task.
| Method | ×2 | ×3 | ×4 | |||
|---|---|---|---|---|---|---|
| PSNR↑ | SSIM↑ | PSNR↑ | SSIM↑ | PSNR↑ | SSIM↑ | |
| Bicubic | 27.79 | 0.7851 | 26.50 | 0.7605 | 27.21 | 0.7979 |
| EDSR | 29.28 | 0.8408 | 29.45 | 0.8694 | 29.84 | 0.8610 |
| RCAN | 29.40 | 0.8526 | 29.04 | 0.8476 | 27.25 | 0.8319 |
| MAFFSRN | 29.26 | 0.8599 | 28.84 | 0.8539 | 28.75 | 0.8449 |
| SwinIR | 29.49 | 0.8533 | 28.53 | 0.8586 | 27.58 | 0.7942 |
| ESRT | 29.83 | 0.8709 | 29.58 | 0.8715 | 28.86 | 0.8341 |
| CAMixerSR | 29.23 | 0.8534 | 28.44 | 0.8532 | 27.35 | 0.7784 |
| DDNM | 25.24 | 0.7832 | 25.12 | 0.7623 | 24.59 | 0.7635 |
| SAM-DiffSR | 25.87 | 0.7652 | 25.84 | 0.7453 | 24.73 | 0.7562 |
| HIR-Diff | 26.25 | 0.7873 | 26.94 | 0.7776 | 25.98 | 0.7653 |
| CNSR (Ours) | 30.45 | 0.8923 | 30.27 | 0.8821 | 30.12 | 0.8791 |
| Method | ×2 | ×3 | ×4 | |||
|---|---|---|---|---|---|---|
| NIQE↓ | PIQE↓ | NIQE↓ | PIQE↓ | NIQE↓ | PIQE↓ | |
| Bicubic | 5.498 | 39.65 | 6.002 | 55.98 | 6.975 | 100.0 |
| EDSR | 6.320 | 56.57 | 7.269 | 87.69 | 6.879 | 78.55 |
| RCAN | 6.961 | 76.64 | 8.194 | 80.51 | 7.116 | 96.96 |
| MAFFSRN | 6.366 | 90.36 | 7.282 | 90.02 | 7.113 | 98.99 |
| SwinIR | 5.728 | 78.67 | 7.941 | 38.27 | 6.169 | 40.66 |
| ESRT | 6.584 | 74.44 | 7.046 | 73.17 | 6.146 | 59.93 |
| CAMixerSR | 5.827 | 77.84 | 7.728 | 72.34 | 6.485 | 60.21 |
| DDNM | 5.123 | 44.23 | 5.232 | 46.93 | 5.349 | 47.99 |
| SAM-DiffSR | 4.983 | 48.98 | 4.233 | 48.88 | 4.977 | 49.89 |
| HIR-Diff | 4.972 | 48.22 | 5.039 | 40.89 | 5.098 | 45.99 |
| CNSR (Ours) | 4.582 | 38.22 | 4.543 | 40.43 | 4.589 | 44.94 |
| Method | ×2 | ×3 | ×4 | |||
|---|---|---|---|---|---|---|
| AUROC↑ | AUPR↑ | AUROC↑ | AUPR↑ | AUROC↑ | AUPR↑ | |
| Bicubic | 0.907 | 0.856 | 0.893 | 0.826 | 0.727 | 0.832 |
| EDSR | 0.863 | 0.862 | 0.871 | 0.798 | 0.812 | 0.871 |
| RCAN | 0.872 | 0.867 | 0.843 | 0.822 | 0.678 | 0.854 |
| MAFFSRN | 0.870 | 0.886 | 0.852 | 0.824 | 0.700 | 0.853 |
| SwinIR | 0.887 | 0.897 | 0.839 | 0.879 | 0.760 | 0.876 |
| ESRT | 0.870 | 0.898 | 0.860 | 0.820 | 0.735 | 0.845 |
| CAMixerSR | 0.860 | 0.898 | 0.813 | 0.835 | 0.793 | 0.876 |
| DDNM | 0.827 | 0.814 | 0.782 | 0.862 | 0.803 | 0.887 |
| SAM-DiffSR | 0.821 | 0.843 | 0.816 | 0.824 | 0.803 | 0.807 |
| HIR-Diff | 0.901 | 0.881 | 0.841 | 0.876 | 0.832 | 0.840 |
| CNSR (Ours) | 0.967 | 0.907 | 0.920 | 0.891 | 0.890 | 0.895 |
Qualitatively, CNSR’s advantage is stark. On scratch defects, CNN/Transformer methods produce overly smooth results that blur the scratch endpoints, while some diffusion methods introduce moiré patterns. CNSR reconstructs clear, sharp scratch boundaries. For subtle sand holes, other methods lose depth information, flattening the defect, whereas CNSR preserves the crucial 3D appearance. On larger pits at high upscaling factors (×4), CNSR maintains sharp edges and internal texture, while others exhibit significant blurring or loss of detail. These visual results confirm that CNSR successfully generates rich, authentic details specific to the casting part surface while effectively suppressing unrealistic artifacts.
2.3. Ablation Studies
We conduct ablation studies to validate the contribution of each core component. The baseline is a standard conditioned latent diffusion model. Adding the NSPE, the STAM modulation, or the MADF individually improves performance. Combining any two brings further gains. The full CNSR model, integrating all three components, achieves the optimal result, proving that comprehensive regularization across different stages is essential for high-fidelity casting part SR.
| Exp. | NSPE | STAM | MADF | PSNR | SSIM |
|---|---|---|---|---|---|
| 1 | – | – | – | 25.03 | 0.7523 |
| 2 | ✓ | – | – | 26.33 | 0.7622 |
| 3 | – | ✓ | – | 28.23 | 0.7879 |
| 4 | – | – | ✓ | 27.47 | 0.7812 |
| 5 | – | ✓ | ✓ | 28.47 | 0.8523 |
| 6 | ✓ | ✓ | – | 28.73 | 0.8421 |
| 7 | ✓ | – | ✓ | 29.03 | 0.8237 |
| 8 (Full) | ✓ | ✓ | ✓ | 30.12 | 0.8791 |
An ablation on the loss function components also confirms the necessity of the proposed $\mathcal{L}_{\text{Null}}$. While $\mathcal{L}_{1}$ is crucial for structural metrics, adding $\mathcal{L}_{\text{Perceptual}}$ or $\mathcal{L}_{\text{Null}}$ individually improves detail generation. The combination of all three yields the best performance, with $\mathcal{L}_{\text{Null}}$ playing the definitive role in aligning the high-frequency content with the true casting part surface characteristics.
3. Conclusion
This paper addresses the critical challenge of faithful detail reconstruction in industrial image super-resolution, with a focus on casting part surface inspection. We identified that the uncontrolled null-space of generative models like diffusion models leads to the hallucination of pseudo-textures, which is unacceptable in precision manufacturing contexts. To solve this, we proposed the Comprehensive Null-Space Regularization (CNSR) framework. CNSR systematically constrains the diffusion model’s freedom through a novel Null-Space Priori Extractor, a Spatio-Temporal Attention Modulation mechanism, and a Multi-Axis Domain Fusion Module, all regularized by a dedicated Null-Space Loss. This multi-level approach ensures that the model’s powerful generative capability is harnessed exclusively for reconstructing authentic, physically present details on the casting part surface.
Experimental results on a real-world industrial dataset demonstrate that CNSR sets a new state-of-the-art, outperforming existing CNN, Transformer, and diffusion-based methods in both quantitative metrics and qualitative visual assessment. Most significantly, it provides a substantial boost to the performance of downstream automated anomaly detection systems, confirming its direct practical value for enhancing quality control pipelines. Future work will focus on developing more lightweight variants of CNSR for real-time deployment on edge devices and exploring its generalization to other industrial inspection domains beyond casting part surfaces.
