簡易檢索 / 詳目顯示

研究生: 陳政嘉
Chen, Jheng-Jia
論文名稱: 結合ViT與特徵重建於非監督式異常檢測:基於動態層級選擇之空間瓶頸自編碼器
Bridging Vision Transformers and Feature Reconstruction for Unsupervised Anomaly Detection: Spatial Bottleneck Autoencoders with Dynamic Layer Selection
指導教授: 蔡家齊
Tsai, ChiaChi
學位類別: 碩士
Master
系所名稱: 電機資訊學院 - 電機工程學系
Department of Electrical Engineering
論文出版年: 2026
畢業學年度: 114
語文別: 英文
論文頁數: 109
中文關鍵詞: 異常檢測重建器機器學習電腦視覺
外文關鍵詞: Anomaly Detection, Reconstructor, Machine Learning, Computer Vision
相關次數: 點閱:13下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 工業表面瑕疵檢測高度仰賴非監督式異常檢測 (UAD)。由於在實際生產線中,幾乎不可能全面蒐集與標註各類罕見與未知的瑕疵變體,模型必須僅從純淨、無瑕疵的樣本中學習正常分佈。儘管導入預訓練的視覺基礎模型 (如 DINOv2) 已大幅推進特徵表示的能力,且基於特徵重建 (Feature Reconstruction) 的架構也因其優異的泛化能力而成為當前的主流範式,但現有方法仍面臨兩大嚴峻的瓶頸。
    首先,當處理現代基礎模型所萃取出的「極高維度」特徵時,傳統架構過度依賴標準的空間混合操作(例如 3×3 或更大的卷積核)。這種設計會引發通道運算量的爆炸性成長,產生極度龐大的乘加運算量 (MACs),嚴重拖垮模型在邊緣設備上的推論效率。其次,毫無篩選地融合所有多尺度的特徵階層,會引入大量冗餘的語意雜訊。這種未受限制的資訊流使得網路容易利用作弊捷徑,導致異常特徵被直接「恆等映射 (Identity Mapping)」,從而癱瘓其偵測未知瑕疵的能力。
    為克服上述限制,我們提出了一個以「空間瓶頸自編碼器 (Spatial Bottleneck Autoencoder)」為核心的高效框架。據我們所知,這是首個成功將巨型視覺變換器 (ViT) 基礎模型與特徵重建技術整合,並應用於工業異常檢測的代表性工作。為了解決這類大規模特徵通常伴隨的運算瓶頸,我們的重建器徹底放棄了傳統的空間混合卷積,轉而採用嚴格的「逐點特徵壓縮 (Point-wise Feature Compression)」策略。藉由將運算嚴格限制在通道維度上,此設計從根本上規避了龐大的算力負擔,在極致最小化 MACs 的同時達成精準的特徵重建。此外,為了應對語意冗餘並防止恆等映射,我們引入了「數據驅動的層級分析 (Data-Driven Layer Sampling)」機制。有別於採用靜態配置,該機制在訓練前對特徵的區分能力進行量化評估,為特定物件類別動態挑選出最具鑑別力的特徵階層。這確保了從源頭建立嚴格的資訊瓶頸,使重建器能專注於最核心的語意訊號。
    此外,我們設計了一套專屬的最佳化策略,並充分利用有機生成的合成異常。我們提出的「自適應重建損失 (Adaptive Reconstruction Loss)」能動態加權梯度的貢獻,藉此平衡不同特徵階層間內在的尺度差異。同時,「潛在空間正規化 (Latent Space Regularization)」會對壓縮後的特徵表示進行主動懲罰,有效防止網路對合成雜訊產生過度擬合 (Over-fitting)。
    廣泛的實驗充分證明了我們方法的優越性。在極具挑戰性的 MVTec AD 2 基準測試中,我們的架構展現了極具競爭力的定位效能,在公開測試集上達到了平均 42.9% 的像素級 F1-Score。而在標準的 MVTec AD 資料集上,它亦保持了強健的表現,取得了 98.5% 的影像 AUROC。更重要的是,在達成上述空間精度的同時,本模型僅需 940 G MACs 的算力——與 SuperAD 等最先進的記憶體庫範式 (Memory-bank paradigms) 相比,大幅減少了 94% 以上 的運算開銷。這成功地為實際的工業部署提供了一個極致高效的架構,並在「高檢測準確度」與「低運算開銷」之間取得了卓越的平衡。

    Industrial surface defect detection relies heavily on Unsupervised Anomaly Detection (UAD). Since it is practically impossible to comprehensively collect and annotate all variations of rare and unknown defects in real-world production lines, models must learn the normal distribution exclusively from pristine, defect-free samples. Although the integration of pre-trained visual foundation models (e.g., DINOv2) has significantly advanced feature representation, and Feature Reconstruction architectures have emerged as a dominant paradigm due to their superior generalization capabilities, existing methods still suffer from two critical bottlenecks.
    First, when processing the extremely high-dimensional features extracted by modern foundation models, traditional architectures over-rely on standard spatial mixing operations (such as 3×3 or larger convolutional kernels). This design provokes an explosive increase in channel-wise computation, resulting in a massive overhead of Multiply-Accumulate Operations (MACs) that severely impedes inference efficiency on edge devices. Second, the indiscriminate fusion of all multi-scale feature hierarchies introduces a substantial amount of redundant semantic noise. Such an unrestricted information flow allows the network to exploit trivial shortcuts, leading to the direct "identity mapping" of anomalous features, thereby paralyzing its ability to detect unseen defects.
    To overcome these limitations, we propose a highly efficient framework centered on a Spatial Bottleneck Autoencoder. To the best of our knowledge, we are the first to successfully integrate massive Vision Transformer (ViT) foundation models with feature reconstruction techniques for industrial anomaly detection. To resolve the computational bottleneck typically associated with such large-scale features, our reconstructor abandons traditional spatial mixing convolutions in favor of a strictly point-wise feature compression strategy. By confining operations exclusively to the channel dimension, this design fundamentally circumvents the massive computational burden, achieving precise feature reconstruction with drastically minimized MACs. Furthermore, to address semantic redundancy and prevent identity mapping, we introduce a Data-Driven Layer Sampling mechanism. Rather than utilizing static configurations, this mechanism quantitatively evaluates feature separability prior to training, dynamically selecting only the most discriminative hierarchical levels for each specific object category. This ensures a strict information bottleneck at the source, empowering the reconstructor to focus solely on essential semantic signals.
    Furthermore, we design a tailored optimization strategy leveraging organically generated synthetic anomalies. The proposed Adaptive Reconstruction Loss dynamically weights gradient contributions to balance intrinsic scale discrepancies across different feature hierarchies. Simultaneously, a Latent Space Regularization actively penalizes the compressed feature representations, effectively preventing the network from over-fitting to synthetic noise.
    Extensive experiments demonstrate the superiority of our approach. On the highly challenging MVTec AD 2 benchmark, our architecture achieves a highly competitive localization performance, yielding an average Pixel-level F1-Score of 42.9% on the test public set. For the standard MVTec AD dataset, it also maintains robust performance with an image-AUROC of 98.5%. More importantly, it accomplishes this spatial precision while demanding only 940 G MACs—a drastic reduction of over 94% in computational overhead compared to state-of-the-art memory-bank paradigms such as SuperAD. This successfully delivers an exceptionally efficient architecture that strikes an outstanding balance between high detection accuracy and low computational overhead for practical industrial deployment.

    Abstract v CONTENTS ix LIST OF TABLES xi LIST OF FIGURES xii Introduction 1 1.1 Background 1 1.2 Motivation 5 1.3 Contribution 7 Related Works 12 2.1 Visual Anomaly Detection 14 2.1.1 Reconstruction-Based Methods 15 2.1.2 Feature-Embedding and Knowledge Distillation Methods 18 2.1.3 Memory-Bank and Distribution-Based Methods 21 2.2 Vision Foundation Models and Generative Anomaly Synthesis 24 2.2.1 Self-Supervised Vision Transformers (ViTs) 24 2.2.2 Anomaly Synthesis as Restorative Proxy Tasks 29 Methodology 36 3.1 Overview of the Proposed Method 36 3.2 Training Phase: Proxy Denoising Task 38 3.3 Data-Driven Layer Sampling 39 3.4 Reconstructor 43 3.5 Adaptive Reconstruction Loss 45 3.6 Inference Phase: Discrepancy-Based Localization 53 Experiment 55 4.1 Evaluation Metrics 55 4.1.1 The Primary Metric: Pixel-Level F1-Score 55 4.1.2 The Secondary Metric: AUROC 57 4.2 Experiment setup 58 4.3 Dataset 60 4.4 Main Results 63 4.5 Ablation Studies 75 Conclusion 90 5.1 Conclusions 90 5.2 Future work 91 REFERENCES 92

    [1] Roth, K., Pemula, L., Zepeda, J., Schölkopf, B., Brox, T., & Gehler, P. (2022). Towards total recall in industrial anomaly detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 14318-14328).
    [2] Pang, G., Shen, C., Cao, L., & Hengel, A. V. D. (2021). Deep learning for anomaly detection: A review. ACM computing surveys (CSUR), 54(2), 1-38.
    [3] Bergmann, P., Fauser, M., Sattlegger, D., & Steger, C. (2019). MVTec AD--A comprehensive real-world dataset for unsupervised anomaly detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 9592-9600).
    [4] Saito, T., & Rehmsmeier, M. (2015). The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PloS one, 10(3), e0118432.
    [5] Defard, T., Setkov, A., Loesch, A., & Audigier, R. (2021, January). Padim: a patch distribution modeling framework for anomaly detection and localization. In International conference on pattern recognition (pp. 475-489). Cham: Springer International Publishing.
    [6] Batzner, K., Heckler, L., & König, R. (2024). Efficientad: Accurate visual anomaly detection at millisecond-level latencies. In Proceedings of the IEEE/CVF winter conference on applications of computer vision (pp. 128-138).
    [7] Liu, Z., Zhou, Y., Xu, Y., & Wang, Z. (2023). Simplenet: A simple network for image anomaly detection and localization. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 20402-20411).
    [8] Bergmann, P., Löwe, S., Fauser, M., Sattlegger, D., & Steger, C. (2018). Improving unsupervised defect segmentation by applying structural similarity to autoencoders. arXiv preprint arXiv:1807.02011.
    [9] Zavrtanik, V., Kristan, M., & Skočaj, D. (2021). Draem-a discriminatively trained reconstruction embedding for surface anomaly detection. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 8330-8339).
    [10] Oquab, M., Darcet, T., Moutakanni, T., Vo, H., Szafraniec, M., Khalidov, V., ... & Bojanowski, P. (2023). Dinov2: Learning robust visual features without supervision. arXiv preprint arXiv:2304.07193.
    [11] Lin, M., Chen, Q., & Yan, S. (2013). Network in network. arXiv preprint arXiv:1312.4400.
    [12] Howard, A. G., Zhu, M., Chen, B., Kalenichenko, D., Wang, W., Weyand, T., ... & Adam, H. (2017). Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861.
    [13] Kendall, A., Gal, Y., & Cipolla, R. (2018). Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 7482-7491).
    [14] Schlegl, T., Seeböck, P., Waldstein, S. M., Langs, G., & Schmidt-Erfurth, U. (2019). f-AnoGAN: Fast unsupervised anomaly detection with generative adversarial networks [J]. Medical image analysis, 54, 30-44.
    [15] Yu, J., Zheng, Y., Wang, X., Li, W., Wu, Y., Zhao, R., & Wu, L. (2021). Fastflow: Unsupervised anomaly detection and localization via 2d normalizing flows. arXiv preprint arXiv:2111.07677.
    [16] Gudovskiy, D., Ishizaka, S., & Kozuka, K. (2022). Cflow-ad: Real-time unsupervised anomaly detection with localization via conditional normalizing flows. In Proceedings of the IEEE/CVF winter conference on applications of computer vision (pp. 98-107).
    [17] Salehi, M., Sadjadi, N., Baselizadeh, S., Rohban, M. H., & Rabiee, H. R. (2021). Multiresolution knowledge distillation for anomaly detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 14902-14912).
    [18] Zhang, X., Li, S., Li, X., Huang, P., Shan, J., & Chen, T. (2023). Destseg: Segmentation guided denoising student-teacher for anomaly detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 3914-3923).
    [19] Reiss, T., Cohen, N., Bergman, L., & Hoshen, Y. (2021). Panda: Adapting pretrained features for anomaly detection and segmentation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 2806-2814).
    [20] Cohen, N., & Hoshen, Y. (2020). Sub-image anomaly detection with deep pyramid correspondences. arXiv preprint arXiv:2005.02357.
    [21] He, K., Zhang, X., Ren, S., & Sun, J. (2016). Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 770-778).
    [22] Lee, S., Lee, S., & Song, B. C. (2022). Cfa: Coupled-hypersphere-based feature adaptation for target-oriented anomaly localization. IEEE Access, 10, 78446-78454.
    [23] Deng, H., & Li, X. (2022). Anomaly detection via reverse distillation from one-class embedding. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 9737-9746).
    [24] Ronneberger, O., Fischer, P., & Brox, T. (2015, October). U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention (pp. 234-241). Cham: Springer international publishing.
    [25] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., ... & Houlsby, N. (2020). An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929.
    [26] Caron, M., Touvron, H., Misra, I., Jégou, H., Mairal, J., Bojanowski, P., & Joulin, A. (2021). Emerging properties in self-supervised vision transformers. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 9650-9660).
    [27] He, K., Chen, X., Xie, S., Li, Y., Dollár, P., & Girshick, R. (2022). Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 16000-16009).
    [28] Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., ... & Sutskever, I. (2021, July). Learning transferable visual models from natural language supervision. In International conference on machine learning (pp. 8748-8763). PmLR.

    [29] Jiang, L., Dai, B., Wu, W., & Loy, C. C. (2021). Focal frequency loss for image reconstruction and synthesis. In Proceedings of the IEEE/CVF international conference on computer vision (pp. 13919-13929).
    [30] Bergmann, P., Batzner, K., Fauser, M., Sattlegger, D., & Steger, C. (2022). Beyond dents and scratches: Logical constraints in unsupervised anomaly detection and localization. International Journal of Computer Vision, 130(4), 947-969.
    [31] Zhang, H., Chen, H., Cheng, Y., Wu, S., Sun, L., Han, L., ... & Qi, L. (2025). Superad: A training-free anomaly classification and segmentation method for cvpr 2025 vand 3.0 workshop challenge track 1: Adapt & detect. arXiv preprint arXiv:2505.19750.
    [32] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., ... & Chintala, S. (2019). Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32.
    [33] Kingma, D. P., & Ba, J. (2014). Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
    [34] Cimpoi, M., Maji, S., Kokkinos, I., Mohamed, S., & Vedaldi, A. (2014). Describing textures in the wild. In Proceedings of the IEEE conference on computer vision and pattern recognition (pp. 3606-3613).
    [35] Zhou, Y., Xu, X., Song, J., Shen, F., & Shen, H. T. (2024). Msflow: Multiscale flow-based framework for unsupervised anomaly detection. IEEE transactions on neural networks and learning systems.

    [36] Zavrtanik, V., Kristan, M., & Skočaj, D. (2022, October). Dsr–a dual subspace re-projection network for surface anomaly detection. In European conference on computer vision (pp. 539-554). Cham: Springer Nature Switzerland.
    [37] Davis, J., & Goadrich, M. (2006, June). The relationship between Precision-Recall and ROC curves. In Proceedings of the 23rd international conference on Machine learning (pp. 233-240).
    [38] Li, C. L., Sohn, K., Yoon, J., & Pfister, T. (2021). Cutpaste: Self-supervised learning for anomaly detection and localization. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition (pp. 9664-9674).
    [39] Li, H., Hu, J., Li, B., Chen, H., Zheng, Y., & Shen, C. (2024). Target before shooting: Accurate anomaly detection and localization under one millisecond via cascade patch retrieval. IEEE Transactions on Image Processing, 33, 5606-5621.
    [40] Chen, Q., Luo, H., Lv, C., & Zhang, Z. (2024, September). A unified anomaly synthesis strategy with gradient ascent for industrial anomaly detection and localization. In European Conference on Computer Vision (pp. 37-54). Cham: Springer Nature Switzerland.

    QR CODE