  Anomaly detection, the technique of identifying abnormal samples using only
normal samples, has attracted widespread interest in industry. Existing
one-model-per-category methods often struggle with limited generalization
capabilities due to their focus on a single category, and can fail when
encountering variations in product. Recent feature reconstruction methods, as
representatives in one-model-all-categories schemes, face challenges including
reconstructing anomalous samples and blurry reconstructions. In this paper, we
creatively combine a diffusion model and a transformer for multi-class anomaly
detection. This approach leverages diffusion to obtain high-frequency
information for refinement, greatly alleviating the blurry reconstruction
problem while maintaining the sampling efficiency of the reverse diffusion
process. The task is transformed into image inpainting to disconnect the
input-output correlation, thereby mitigating the "identical shortcuts" problem
and avoiding the model from reconstructing anomalous samples. Besides, we
introduce category-awareness using dual conditioning to ensure the accuracy of
prediction and reconstruction in the reverse diffusion process, preventing
excessive deviation from the target category, thus effectively enabling
multi-class anomaly detection. Futhermore, Spatio-temporal fusion is also
employed to fuse heatmaps predicted at different timesteps and scales,
enhancing the performance of multi-class anomaly detection. Extensive
experiments on benchmark datasets demonstrate the superior performance and
exceptional multi-class anomaly detection capabilities of our proposed method
compared to others.
