Share
Embed
JSAI2025発表資料 "拡散モデルを用いた画像インペインティングによる教師なし異常検知"
JSAI2025 2日目に発表した "拡散モデルを用いた画像インペインティングによる教師なし異常検知"の発表資料です.
Shunsuke Sakai
June 01, 2025
Transcript
43 slides
-
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #2 異常検知とは アンナ・カレーニナの法則 すべての幸せな家庭は似ている. 不幸な家庭は,それぞれ異なる理由で不幸である. 実際,多くのデータで上記のような性質が見られる. e.g., 不整脈の検出
[1], 製品の欠陥 [2], 深層NN [3]. 異常検知 ≜ 正常の概念から外れたデータ点の検出 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #4 教師なし異常検知 -概要- Q. どうやって正常サンプルのみから異常を検出するか? A. 正常サンプルを生成する分布の低確率密度領域を異常とみなす.[4] 𝑞normal(𝑥)
𝑥 異常 正常分布の近似なら多様なアプローチがある. e.g., 混合ガウスモデル,深層生成モデル(NF [5], VAE [6], Diffusion [7,8], …) -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #6 拡散モデル x 異常検知 拡散モデルの持つ高い分布近似能力を異常検知に活用できないか? “Removing Anomalies as
Noises” [12] 正常画像で訓練した拡散モデルで,異常特徴をノイズとともに除去. 誤差は各逆拡散過程における 真の事後分布との KLダイバージェンスで評価. -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #7 拡散モデル x 異常検知 その後もいくつかの方向性で発展. 2023 2024 2025
RemoveAsNoise [12] DiAD [13] DiffusionAD [14] DDAD [15] CAGEN [16] ScoreDD [17] DiffAD [18] GLAD [19] 再構成フリー 擬似異常の生成 正常特徴を条件づける 補助識別器の導入 適応的なノイズ強度の選択 InversionAD [20] 再構成フリー -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #9 主要な課題 -ノイズ強度の選択- ノイズ強度の選択はトレードオフを引き起こす. (i) ノイズ強度が大きすぎる (ii) ノイズ強度が小さすぎる
拡散 異常特徴がデノイジングも残り続け,再 現率(Recall)が低下. 拡散 正常特徴の再構成誤差が増加し, 適合率(Precision)が低下. -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #11 本研究の着想に至った経緯 一方で,画像補完モデルは訓練時に用いたマスク分布に過学習する. 推論時にのみマスクを適用して画像補完できるだろうか? 【訓練時】 正常画像上で拡散モデルを学習(マスク不要) (本研究の提案2)推論時のみマスクを条件づけて画像補完 【推論時】
拡散モデルの事前分布に従い,マスク領域を補完 マスク分布に依存しない画像補完ベースの異常検知を実現 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #15 DDPM [詳細は割愛] 𝒙0 𝒙1 𝒙2 𝒙𝑇 𝑞
𝒙1 𝒙0 𝑞 𝒙2 𝒙1 𝑞 𝒙𝑇 𝒙𝑇−1 𝑝𝜃 𝒙𝑇−1 𝒙𝑇 𝑝𝜃 𝒙1 𝒙2 𝑝𝜃 𝒙0 𝒙1 逆拡散過程 拡散過程 拡散過程 各拡散過程は既知の ガウシアンカーネルで表現 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #16 DDPM [詳細は割愛] 𝒙0 𝒙1 𝒙2 𝒙𝑇 𝑞
𝒙1 𝒙0 𝑞 𝒙2 𝒙1 𝑞 𝒙𝑇 𝒙𝑇−1 𝑝𝜃 𝒙𝑇−1 𝒙𝑇 𝑝𝜃 𝒙1 𝒙2 𝑝𝜃 𝒙0 𝒙1 逆拡散過程 拡散過程 逆拡散過程 逆拡散過程も同じ関数形で表現 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #17 DDPM [詳細は割愛] DDPMの学習 負の変分下限を最小化することで逆拡散過程のパラメータを学習(導出略). 1本研究では, とする. 1
任意の時点の拡散過程の計算 𝒙0 , 𝑡が与えられた下で,ある時刻𝑡の潜在変数𝒙𝑡 は以下のように求まる. -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #19 DDRM ー 拡散モデルを用いて,任意の線形逆問題を解くために考案された. Denoising Diffusion Restoration Models
(DDRM) [25] 線形逆問題 観測𝒚が真の信号𝒙の線形変換にノイズを加えたものであると仮定. 観測行列 観測ノイズ(ノイズ分布は既知) この時,観測から真の信号を推定する問題を線形逆問題という. -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #21 DDRM DDRMの考え方 1. 拡散モデル𝒑𝜽 (𝒙)を用いて,𝒙のデータ分布を近似する. 単純にDDPMを学習 2.
真の信号の事後分布は,以下のように表せる. ここは学習済み この部分がどう求まるか (次ページ) -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #22 DDRM DDRMの考え方(続き) 3. 測定行列を特異値分解し,観測によって潰れる次元を特定. 4. スペクトル空間での逆拡散過程を考える. スペクトル空間の各次元𝒊に対応する固有値𝒔𝒊
で場合分けする. (𝒔𝒊 = 𝟎) 観測によりその次元の情報は失われているため,そのまま推論 (𝒔𝒊 ≠ 𝟎) 見えている画素については,同じ時刻まで拡散してから推論 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #25 反復的マスク更新 異常検知のためのマスク要件 【要件1】 画像全体をカバーする(異常の位置は未知) 【要件2】 正常部を不必要にマスクしない(予測不確実性の低減) 【要件3】
多様な形状を取ること(異常の形状は未知) 画像の大部分を覆うランダムマスクで初期化1 再構成誤差に基づく反復的マスク更新の導入 推論時のみ条件付けるため,任意のマスクを使用可能 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #27 異常度の算出 (i) 拡散モデルは事前訓練したVAE [9]の潜在空間で学習 これは潜在空間拡散モデル [30]と同様. VAE
Encoder DDPM Training (ii) 再構成誤差はEfficientNet [27]の特徴空間上で評価 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #28 実験設定 本研究ではあくまでSoTAではなく,アプローチの比較検証を実施. ・評価ベンチマーク; MVTecAD [32] ドメイン:製造業,食品,薬 タスク数:15種類
訓練データ:正常画像200枚(Avg.) 評価データ:正常画像 + 異常画像 計100枚以上 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #29 実験設定 拡散モデル ・訓練時の目的関数,(逆)拡散過程の定義: DDPM [8] ・モデル構造:U-Net [28]
・ステップ数: 1000 (訓練時)・100(推論時) 最適化 ・最適化器: AdamW ・学習エポック数: 2000 (単一クラス設定) ・学習率: 1e-4固定 -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #39 引用文献 [1] Jiang et al., , “Anomaly
Detection in Electrocardiograms: Advancing Clinical Diagnosis Through Self- Supervised Learning”, Arxiv preprint, 2024. link [2] Liu et al., “Deep Industrial Image Anomaly Detection: A Survey”, Machine Intelligence Research, 2024, link [3] Huh et al., “The Platonic Representation Hypothesis”, 42nd International Conference on Machine Learning (ICML), 2024, link [4] Ruff et al., “A Unifying Review of Deep and Shallow Anomaly Detection”, Proceedings of the IEEE, 2020, link [5] Rezende et al., “Variational Inference with Normalizing Flows”, Proceedings of the 32nd International Conference on Machine Learning (ICML), 2015, link [6] Kingma et al., “Auto-Encoding Variational Bayes”, 2nd International Conference on Learning Representations (ICLR), 2013, link [7] Shol-Dickstein et al., “Deep Unsupervised Learning using Nonequilibrium Thermodynamics”, Proceedings of the 32nd International Conference on Machine Learning (ICML), 2015, link [8] Ho et al., “Denoising Diffusion Probabilistic Models”, Proceedings of the 34th International Conference on Neural Information Processing Systems (NeurIPS), 2020, link -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #40 引用文献 [9] Rombach et al., “High-Resolution Image
Synthesis with Latent Diffusion Models”, 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022, link [10] Google DeepMind, “Veo3”, link [11] Google DeepMind, “Gemini Diffusion”, link [12] Lu et al., “Removing Anomalies as Noises for Industrial Defect Localization”, 2023 IEEE/CVF International Conference on Computer Vision (ICCV), 2023, link [13] He et al., “A Diffusion-Based Framework for Multi-Class Anomaly Detection”, Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), 2023, link [14] Zhang et al., “DiffusionAD: Denoising Diffusion for Anomaly Detection”, IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2023, link [15] Mousakahan et al., “Anomaly Detection with Conditioned Denoising Diffusion Models”, Proceedings of the 46th German Conference on Pattern Recognition (GCPR 2024), 2024, link [16] Jiang et al., “CAGEN: Controllable Anomaly Generator using Diffusion Model”, 2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2024, link -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #41 引用文献 [17] Teng et al., “Unsupervised Visual
Defect Detection with Score-Based Generative Mode”, Arxiv Preprint, 2022, link [18] Zhang et al., “Unsupervised Surface Anomaly Detection with Diffusion Probabilistic Model”, 2023 IEEE/CVF International Conference on Computer Vision (ICCV), 2023, link [19] Yao et al., “GLAD: Towards Better Reconstruction with Global and Local Adaptive Diffusion Models for Unsupervised Anomaly Detection”, The 18th European Conference on Computer Vision (ECCV), 2024, link [20] Sakai et al., “Reconstruction-Free Anomaly Detection with Diffusion Models via Direct Latent Likelihood Evaluation”, Arxiv Preprint, 2025, link [21] Batzner et al., “EfficientAD: Accurate Visual Anomaly Detection at Millisecond-Level Latencies”, Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), 2024, link [22] Lu et al., “Hierarchical vector quantized transformer for multi-class unsupervised anomaly detection”, Proceedings of the 37th International Conference on Neural Information Processing Systems (NeurIPS), 2023, link [23] Yan et al., “Learning Semantic Context from Normal Samples for Unsupervised Anomaly Detection”, Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), 2021, link -
2025/5/29 拡散モデルを用いた画像インペインティングによる教師なし異常検知 #42 引用文献 [24] Huang et al., “Self-Supervised Masking
for Unsupervised Anomaly Detection and Localization”, IEEE Transactions on Multimedia (TMM), 2023, link [25] Kawar et al., “Denoising Diffusion Restoration Models”, Proceedings of the 36th International Conference on Neural Information Processing Systems (NeurIPS), 2022, link [26] Lugmayr et al., “RePaint: Inpainting using Denoising Diffusion Probabilistic Models”, IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023, link [27] Tan et al., “EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks”, Proceedings of the 36-th International Conference on Machine Learning (ICML), 2019, link [28] Ronneberger et al., “U-Net: Convolutional Networks for Biomedical Image Segmentation”, Medical Image Computing and Computer-Assisted Intervention (MICCAI), 2015, link [29] DDRMの論文を読んだ際のメモ,link