acceptodds
Under review as a conference paper at ICLR 2027

IN-PLACE DEFECT EDITING VIA TIMESTEP-CONSISTENT MASK DIFFUSION

Abstract

Few‑shot defect generation mitigates the scarcity of labeled anomalies in industrial visual inspection by synthesizing realistic and diverse defects from a few real examples. Two paradigms emerge: good‑to‑defect diffusion renders a defect onto a clean template, carrying correspondence risk and domain gap; defect‑to‑defect editing preserves context but rearranges observed pixels. We find that neither fully preserves defect realism, and we recast augmentation as in‑place defect‑to‑defect editing, re‑synthesizing the defect at its original location under diffusion‑governed fidelity rather than template correspondence. Mask‑guided diffusion, however, trains a soft region weighting but samples a hard binary cut, so the imposed boundary is one the model never learned to respect. We couple the mask to the diffusion timestep: a Timestep‑adaptive Dynamic Mask Region (TDMR) loss softens the constraint at high noise and sharpens it at low noise, while stepwise blended sampling re‑anchors the background at every step with the same mask. Treating the mask as an evolving schedule shared between training and sampling, we identify a critical yet under‑explored principle: training‑sampling mask consistency, whose violation yields boundary artifacts even when the mask is exact, and whose hard boundary is the limit of the softened training schedule. On MVTec AD, a detector trained solely on our synthetic data attains the best localization accuracy among protocol‑matched augmentation baselines, consistent with this principle; mixing with real data yields further gains.

Primary area:
generative models
Keywords:
Few-shot defect generation, Industrial anomaly detection, Diffusion models, Mask-guided latent editing, Timestep-adaptive mask schedule, Training-sampling consistency

Reviews

Among:
Shape:
1234this paper, Bottom 10%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 1.67 over 3 reviews, above 10% of the others.
Reviewer_w45VOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
2
Soundness
2
Read review
Paper summary

This work addresses few‑shot industrial defect synthesis for visual inspection data augmentation. The authors propose TDMR for in‑place latent‑space defect‑to‑defect editing: given a defective input image and its binary defect mask, it re‑synthesizes defects within the original masked region while preserving the input background. To enforce consistency, this paper proposes TDMR loss, stepwise blended latent sampling, and lightweight per‑category LoRA fine‑tuning. Experiments on MVTec AD show that TDMR outperforms baselines across most localization‑focused metrics.

Critical strengths
  1. Well‑motivated training‑sampling mask‑consistency principle for mask‑guided diffusion. The paper identifies a pervasive, under‑discussed failure source: mismatch between soft timestep‑varying spatial loss weights at training and static hard‑binary masks used for inference. The proposed TDMR loss mathematically makes the inference hard mask the asymptotic limit of the training soft‑mask schedule.

  2. Comprehensive evaluation for industrial defect augmentation. All baselines are compared under strictly matched few‑shot data protocols, fixed detector architecture, generation quantity, and test splits. Results show TDMR achieves state‑of‑the‑art localization metrics when training purely on synthetic data. Mixing synthetic with real data brings consistent further improvements across nearly all MVTec AD categories.

Critical weaknesses
  1. All empirical validation is conducted only on MVTec AD. The paper mentions VisA and MVTec‑LOCO‑AD as future work, but there are no experimental results on datasets with logical constraints, complex multi‑object scenes or different defect statistics. It remains open whether the TDMR consistency mechanism and LoRA‑based in‑place editing retains its performance gains for these more challenging industrial settings.

  2. Hard‑mask assumption failure modes lack sufficiently deep mitigation analysis. The method relies on access to ground‑truth binary defect masks as input. The authors document failure cases: text glyph distortion on capsule/pill, specular highlight leakage across mask boundaries. The work provides only a simple heuristic down‑weighting trick for text regions. Additionally, all experiments assume availability of accurate defect masks. However, real industrial scenarios often have noisy or unavailable defect masks.

Questions for authors
  1. For the training‑sampling mask consistency principle, your proposition proves point‑wise convergence of softened training mask to hard binary mask as t→0. Could you elaborate what practical gap remains between this mathematical limit and the actual model behaviour during inference?

  2. Your pipeline assumes ground‑truth defect masks as input. How would TDMR performance degrade when masks are perturbed (e.g. mask dilation/erosion, random boundary noise) mimicking imperfect real‑world annotations?

  3. In Table 3, mixing real defects with TDMR synthetic data brings large gains for categories such as transistor and toothbrush. Could you explain why the performance degrades slightly for several categories (cable, carpet, grid) under mixed training? Is this due to distribution mismatch between real and synthetic defects, or other optimization‑related factors?

Reviewer_GBWtOpenReview ↗
Rating
1
Confidence
4
Informativeness
1
Presentation
1
Soundness
1
Read review
Paper summary

This article generates industrial defects by using Stable Diffusion to edit existing defect images. It combines the masked loss related to time step with stepwise background mixing, and evaluates the generated data through downstream detection of MVTec AD.

Critical strengths

None

Critical weaknesses

1.Figure 1 is technically unreliable. Basic connection missing: Noisy latents are not connected to the training U-Net, and the noise prediction is separated from the network that generated it. The VAE decoder also appears to output a defect mask, although this method provides the mask separately. These are substantive errors in the central method diagram.

2.The mechanism shown contradicts equation (1). Applying pointwise sigmoid to binary masks will result in two weight values; It will not generate the spatially smooth transition band described and claimed in the paper.

3.The consistency statement has been exaggerated. Training uses soft weights that depend on the time step, while sampling uses a fixed hard mask at each step. Sharing the original mask does not establish consistency between these operations.

4.Novelty and limited experimental coverage: This method combines established components, tests a dataset, and only compares with two augmentation methods.

Questions for authors

A paper with an unchecked central diagram and contradictions between its equations and claimed mechanism should not have been submitted to ICLR in this form.

Reviewer_s8EaOpenReview ↗
Rating
2
Confidence
3
Informativeness
2
Presentation
3
Soundness
1
Read review
Paper summary

The paper studies few-shot defect generation for industrial anomaly detection and proposes TDMR, an in-place diffusion editing approach. Instead of generating a defect on a clean template, the method starts from an observed defective image and its ground-truth mask, then re-synthesizes the defect at approximately the same location while preserving the surrounding background. The main technical idea is presented as a training-sampling mask consistency principle. During training, a timestep-dependent transformation of the binary defect mask weights the diffusion loss. At inference, stepwise blended latent sampling repeatedly restores the background using the original hard mask. Category-specific LoRA adapters are trained on top of a frozen Stable Diffusion backbone. Experiments are conducted on MVTec AD. TDMR outperforms CutPaste and AnomalyDiffusion on most localization metrics and obtains 0.6459 pixel AP, 0.6477 pixel F1, 0.5035 IoU, and 0.8143 PRO. Mixing the generated samples with the real few-shot data improves localization further.

Critical strengths

S1. The in-place editing formulation is relevant for industrial defect augmentation. Starting from an actual defective sample avoids some of the correspondence problems of good-to-defect synthesis. It also gives the method a straightforward mechanism for preserving the original background. This is particularly appropriate for industrial inspection, where small background changes can easily become spurious cues for the downstream detector.

S2. The experimental analysis is extensive and generally well controlled. The paper reports downstream detection metrics, per-category results, background-preservation controls, diversity measurements, and several mechanism ablations. In particular, stepwise blending consistently reduces boundary-region error, with an average reduction of 12.5% across the 15 categories.

I also appreciate that the authors explicitly discuss failure cases rather than presenting only favorable qualitative examples.

Critical weaknesses

W1. The central "timestep-consistent soft mask" interpretation does not seem to follow from the actual formulation. This is my main concern. The latent mask is binary after nearest-neighbor downsampling. The proposed transformation then applies

\sigma((m_z-0.5)/\tau(t))

pointwise. For a binary input, this does not soften the spatial boundary. All foreground pixels receive one weight and all background pixels receive another. Changing (\tau(t)) changes the contrast between these two weights, but it does not produce the claimed wider or narrower transition region around the mask contour. This matters because several central statements are formulated in terms of boundary softness, a coarse-to-fine transition band, and convergence of that boundary toward the sampling mask. To obtain the behavior described in the paper, I would expect the sigmoid to operate on something like a signed distance field, blurred mask, or another spatially continuous representation.

There is an additional mathematical problem. Proposition 1 claims exact convergence of the training mask to the binary mask as (t\rightarrow0), but (\tau(t)\rightarrow\tau_{\min}=0.05). Consequently, the argument remains finite. For mask values 0 and 1 it approaches approximately (-10) and (+10), respectively. The result is numerically close to binary, but it is not the stated limit, and the proof's divergence argument is incorrect. The empirical method may still be useful as a timestep-dependent foreground/background weighting scheme. But this would be a different and substantially weaker interpretation than the central principle currently claimed.

W2. The empirical comparison is too narrow for a paper centered on few-shot diffusion-based defect generation. The quantitative comparison contains only CutPaste and AnomalyDiffusion. The paper discusses several much closer recent approaches, including DefectFill and other mask-conditioned or diffusion-based defect generators, but does not compare against them. The stated reason is reproducibility under an identical protocol. I understand the desire for protocol matching, but this leaves the empirical positioning incomplete. Beating CutPaste and one diffusion baseline is not sufficient to establish the state of the art in a rapidly developing area, especially when the paper itself cites several stronger and more recent methods. The evaluation is also restricted to MVTec AD. The authors acknowledge this and mention VisA and MVTec LOCO as future work. Given that the proposed principle is claimed to extend beyond defect generation to mask-guided diffusion more generally, I would expect broader empirical evidence.

Questions for authors

My main concern is with the mathematical and conceptual basis of the central contribution. The paper repeatedly describes the training mask as spatially softened, with a transition region that progressively sharpens toward a hard boundary. However, the mask entering the proposed transformation is explicitly binary. Applying a pointwise sigmoid to values in {0,1} simply produces two constant weights, one inside and one outside the mask. It does not create a spatial transition band around the defect boundary. There is also a concrete error in Proposition 1. The temperature schedule has a strictly positive minimum, (\tau_{\min}=0.05). Therefore, as (t \rightarrow 0), the temperature converges to 0.05, not to zero. The sigmoid argument does not diverge to plus or minus infinity as claimed, and the softened mask does not exactly converge to the binary mask. These points directly affect the claimed training-sampling consistency principle.Q1. Could the authors clarify how the pointwise sigmoid of a binary mask produces the spatial transition band described throughout the paper? As written, it appears to implement timestep-dependent foreground/background loss weighting rather than spatial mask softening. If I am missing an additional spatial operation, it should be made explicit.

Q2. How should Proposition 1 be interpreted given that (\tau_{\min}=0.05)? With the stated schedule, (\tau(t)) does not tend to zero when (t\rightarrow0), and therefore the proof's divergence argument does not hold. Is the intended statement an approximate numerical correspondence rather than exact convergence?

Q3. Can the authors provide a comparison with at least one recent mask-conditioned diffusion baseline such as DefectFill under the proposed protocol? This would materially affect my assessment of the empirical contribution. At present, the comparison against only CutPaste and AnomalyDiffusion makes it difficult to judge how much improvement comes from TDMR relative to current approaches.

1 comment
Reviewer_s8EaOpenReview ↗

Is there any rebuttal for this paper?

I think it would be nice to have a discussion for this paper in any case... is there any rebuttal?

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.