DFNet for Industrial Defect Classification
- DFNet is a two-stage network for surface defect classification that integrates segmentation-based perception fine-tuning with decision-level fusion.
- It employs a Decision Fusion Module and a Perception Fine-tuning Module to mitigate challenges like background interference, low-contrast defects, and label edge uncertainty.
- The architecture demonstrates robust performance, achieving 96.1% AP on KolektorSDD2 and 94.6% mAP on Magnetic-tile datasets.
D3FNet, in the context of industrial inspection, corresponds to the model formally named DFNet in the paper “Decision Fusion Network with Perception Fine-tuning for Defect Classification” (Jiang et al., 2023). DFNet is a two-stage network for surface defect classification in which a segmentation stage produces defect-focused semantic and feature representations, and a classification stage fuses them to make the final decision. Its design addresses three difficulties emphasized in the paper: background interference, low-contrast defects, and label edge uncertainty. The method combines a Decision Fusion Module (DFM), a Perception Fine-tuning Module (PFM), and an inner-outer separation weight matrix for segmentation supervision, and it is reported on publicly available datasets including KolektorSDD2 and Magnetic-tile-defect-datasets (Jiang et al., 2023).
1. Task setting and motivating failure modes
DFNet is proposed for industrial surface defect classification, namely deciding whether an image of a surface is defective or defect-free and, in the magnetic tile setting, which defect category it belongs to (Jiang et al., 2023). The motivating examples include electrical commutator imagery in KolektorSDD2 and magnetic tile imagery in Magnetic-tile-defect-datasets.
The paper isolates three recurrent causes of misjudgment. The first is background interference / background-like defects: some background patterns are visually similar to defects, especially when defects are small, and complex, uneven backgrounds with random lighting and texture can look defect-like. The stated consequence is false positives, in which a normal image is falsely labeled as defective. The second is low-contrast defects: fine scratches and other subtle anomalies are visually submerged in the background, their edges are blurred, and the classifier may miss them, producing false negatives. The third is label edge uncertainty in segmentation: when dilation-based augmentation expands defect regions to obtain more positive pixels, boundaries become ambiguous, and incorrect treatment of those dilated edges can degrade segmentation precision and, consequently, classification (Jiang et al., 2023).
Against this background, the paper contrasts DFNet with two conventional families. Single-stage classification networks such as GoogLeNet, EfficientNetV2, ConvNeXt, and Swin-v2 rely only on image-level labels, learn global features, and have no explicit mechanism to identify where the defect is. Segmentation-based or two-stage methods such as SBDA and MDD use pixel-level labels, but the paper argues that they do not explicitly handle low contrast and strong background similarity, treat segmentation output rather naively in classification, and remain vulnerable to edge uncertainty introduced by label dilation. DFNet is positioned as a response to these specific deficiencies (Jiang et al., 2023).
2. Two-stage network organization
DFNet is a two-stage architecture composed of a segmentation stage and a classification stage (Jiang et al., 2023). The segmentation stage uses a backbone feature extractor based on the first stage of MDD and outputs a high-dimensional feature map with 1152 channels. This stage is augmented by the Perception Fine-tuning Module, which produces initial and refined segmentation maps together with refined foreground and background features. The classification stage is built around the Decision Fusion Module, which receives both the refined feature representation and a segmentation-derived semantic representation.
The data flow is described explicitly. A raw surface image is mapped by the backbone to a feature tensor
A single-channel convolution then generates an initial segmentation map and a foreground/background weight map . The weight map is used to separate the backbone feature map into foreground and background components. After refinement, the resulting feature maps are merged as
In parallel, complementary segmentation maps derived from refined foreground and background features are combined with to produce the final segmentation result . The classification stage consumes in a feature decision branch and in a semantic decision branch, and then outputs either a binary defect/non-defect decision or a multi-class defect category prediction (Jiang et al., 2023).
This organization encodes the paper’s central premise: classification should depend jointly on where the defect is, via semantic segmentation, and what it looks like, via feature maps. A plausible implication is that the architecture uses segmentation not merely as an auxiliary task, but as a structured decision input.
3. Decision Fusion Module
The Decision Fusion Module (DFM) is the classification-stage component that fuses a semantic decision vector with a feature decision vector (Jiang et al., 2023). Its feature decision branch takes as input and applies a sequence of convolution and max-pooling operations: 0, then 1, then 2, each followed by max-pooling. Global max pooling and global average pooling are then applied to obtain vectors
3
The semantic decision branch takes a one-channel segmentation map, such as 4, and applies an analogous conv+pool sequence to produce a 32-channel semantic feature map. Global max pooling and global average pooling yield
5
The fusion mechanism is simple concatenation:
6
The concatenated vector is passed through a fully connected layer,
7
followed by Sigmoid for binary classification or Softmax for multi-class classification (Jiang et al., 2023).
The classification loss is cross-entropy:
8
and in the paper’s notation,
9
The paper does not describe an explicit weighted-sum or attention-based fusion inside DFM; instead, the fully connected layer learns how to weigh the concatenated semantic and feature components. This is a notable design choice because the fusion mechanism is intentionally simple, with the architectural novelty concentrated in the dual-branch decision decomposition and the segmentation-side perception refinement.
4. Perception Fine-tuning Module
The Perception Fine-tuning Module (PFM) operates in the segmentation stage and is intended to fine-tune the network’s perception of foreground defects versus background (Jiang et al., 2023). Starting from the backbone feature map 0, PFM first generates an initial segmentation map and a weight map, then separates features into foreground and background streams:
1
with the background stream described conceptually as
2
The foreground and background streams are refined by separate modules, each consisting of 4 stacked 3 convolution layers, with the last two using dilation rates 2 and 5. These modules produce 4 and 5. The refined features are merged with the original backbone feature map to form 6, which is sent to DFM’s feature decision branch. In parallel, complementary segmentation maps are produced from the refined foreground and background features and combined with the initial segmentation to yield the final segmentation map 7. Both 8 and 9 are supervised with segmentation ground truth (Jiang et al., 2023).
Conceptually, PFM serves two purposes. First, it enhances defect-related patterns and suppresses background interference by explicitly separating foreground and background features. Second, the use of dilated convolutions with rates 2 and 5 enlarges the effective contextual field around each pixel, which the paper links to better perception of low-contrast defects. The reported heat-map visualizations indicate that, without PFM, the network tends to highlight larger areas and often mixes background, whereas with PFM, attention is more concentrated on actual defect regions and background activation is suppressed (Jiang et al., 2023).
5. Inner-outer separation weighting for segmentation supervision
To address ambiguity introduced by dilation-based data augmentation, the paper introduces an inner-outer Separation Weight Matrix (SWM) for segmentation loss weighting (Jiang et al., 2023). The problem is that expanding defect masks with kernels such as 0 or 1 increases positive pixels and can improve class balance, but larger dilation reduces segmentation accuracy because the outer expanded pixels are uncertain. The paper also argues that prior distance-based attenuation methods reduce weights of true inner defect areas, which is undesirable.
The separation weight matrix is defined pixel-wise as
2
where 3 is the Euclidean distance transform value of the pixel, 4 is the maximum distance in the dilated defect region, and 5 is the threshold separating inner and outer regions. Under this scheme, the inner region keeps weight 6, while the outer dilated border is attenuated proportionally to distance (Jiang et al., 2023).
The weighted segmentation loss is
7
with overall loss
8
This weighting is applied to both the initial segmentation loss 9 and the refined segmentation loss 0. The stated intent is to preserve the benefits of dilation-based augmentation while reducing misjudgment at ambiguous defect edges (Jiang et al., 2023).
6. Training strategy, losses, and reported results
The implementation is reported in PyTorch on a single GPU (RTX 3060Ti) with the Adam optimizer (Jiang et al., 2023). Training is end-to-end with mixed supervision from pixel-level segmentation labels and image-level classification labels. An important strategy is gradient truncation initially: gradients from the classification network are not propagated back to the segmentation network in early epochs, so that segmentation can converge first without destabilization from noisy classification gradients. To handle class imbalance, positive and negative samples are alternated during training, and one epoch is defined as all positive samples having been used once (Jiang et al., 2023).
The paper defines three losses: 1, 2, and 3. With pixel-wise weighting,
4
and the total loss is given by an epoch-dependent combination:
5
where 6 is the current epoch and 7 is the total number of epochs (Jiang et al., 2023).
Dataset-specific hyperparameters are also reported. For KolektorSDD2, training uses 100 epochs, learning rate 0.01, batch size 1, and a 8 dilation kernel because many defects are minute and larger dilation improves classification. For Magnetic-Tile, the classification network uses 200 epochs, learning rate 0.001, batch size 1, and a 9 dilation kernel because defects are often larger and smaller dilation is sufficient (Jiang et al., 2023).
The abstract reports 96.1% AP on KolektorSDD2 and 94.6% mAP on Magnetic-tile-defect-datasets. Within the paper’s framing, these results are presented as evidence that joint use of DFM, PFM, and SWM improves robustness under complex backgrounds and low-contrast defect conditions (Jiang et al., 2023).
7. Terminological ambiguity and distinction from similarly named models
A recurrent point of confusion is nomenclature. The paper itself names the method DFNet, not explicitly D3FNet (Jiang et al., 2023). The available description states that, if “D3FNet” is used in this context, it likely refers to this Decision Fusion Network with Perception Fine-tuning. This suggests that the label “D3FNet” is, here, an informal alias rather than the formal model name.
That distinction matters because orthographically similar names refer to different systems in other parts of the literature. D3 denotes a dynamic DNN decomposition system for lossless synergistic inference across device, edge, and cloud tiers (Zhang et al., 2021). D3Net denotes a densely connected multidilated DenseNet for dense prediction tasks such as semantic segmentation and audio source separation (Takahashi et al., 2020). A later and unrelated model explicitly named D3FNet is a Differential Attention Fusion Network for Fine-Grained Road Structure Extraction in Remote Perception Systems, built on D-LinkNet for road segmentation in high-resolution remote sensing imagery (Liu et al., 21 Aug 2025). These models address different tasks, use different architectures, and should not be conflated with DFNet for defect classification.
Within the defect-inspection literature, therefore, the technically precise designation is DFNet, with “D3FNet” functioning only as an external or secondary label for the system introduced in (Jiang et al., 2023).