• X0_371388
  • 1.8MB
  • zip
  • 0
  • VIP专享
  • 0
  • 2022-04-03 03:10
工业视觉异常检测框架 目录 语境 该存储库包含与我们的异常检测框架相关的代码,该框架使用针对在我们的污点状噪声损坏的图像上训练的自动编码器。 全文可在,并将很快在ICPR2020上发表。 下面的插图概述了使用我们的方法(AESc +染色)在MVTec AD某些样本上获得的异常检测结果。 方法概述 在这项工作中,我们解决了工业应用中图像异常检测的问题。 我们的方法基于经过训练的自动编码器,可以将任意图像(即有或没有任何缺陷)映射到干净图像(即无任何缺陷)。 通过这种方法,可以通过以下方法发现缺陷: (通常)一种基于残差的方法,该方法通过测量输入图像与其重建的干净版本之间的绝对差来评估异常。 (或者)基于不确定性的方法依赖于这样的直觉,即在训练过程中看不到的结构(即异常)将与更高的不确定性相关联,这可以通过MCDropout技术推断出的30个输出图像之间的差异来估算。 为了提高重建的干
# Anomaly Detection Framework for Industrial Vision ## Table of contents - [Context](#Context) - [Overview of the Method](#Overview-of-the-Method) - [Dependencies](#Dependencies) - [Key Components of the Implementation](#Key-Components-of-the-Implementation) - [Definition of the Stain noise corruption](#Definition-of-the-Stain-noise-corruption) - [The Graphical User Interface](#The-Graphical-User-Interface) ## Context This repository contains the code related to our anomaly detection framework that uses an autoencoder trained on images corrupted with our Stain-shaped noise. The full paper is available on [ArXiv]( and will be soon presented at ICPR2020. Illustration belows presents an overview of anomaly dectection results obtained with our method (AESc + Stain) on some samples of the MVTec AD [dataset]( <p align="center"> <img width="300" src=""> <br> </p> ## Overview of the Method In this work, we adress the problem of anomaly detection in images for an industrial application. Our method is based on an autoencoder trained to map an arbitrary image, i.e. with or without any defect, to a clean image, i.e. without any defect. In this approach, the defects can be dected through: - (commonly) a **residual-based approach** that evaluates the abnormality by measuring the absolute difference between the input image and its reconstructed clean version. - (alternatively) an **uncertainty-based approach** relies on the intuition that structures that are not seen during training, i.e. the anomalies, will correlate with higher uncertainties, as estimated by the variance between 30 output images inferred with the MCDropout technique. <p align="center"> <img width="500" src=""> <br> </p> To improve the sharpness of the recontructed clean image, we consider an autoencoder architecture with skip connections. In the common scenario where only clean images are available for training, we propose to corrupt them with a synthetic noise model to prevent the convergence of the network towards the identity mapping, and introduce an original Stain noise model for that purpose. We show that this model favors the reconstruction of clean images from arbitrary real-world images, regardless of the actual defects appearance. ## Dependencies Our implementation is built on tensorflow (version 2.4.1). <br> The GUI in based on PySimpleGUI (version 4.38.0). More detailed informations are available in the `requirements.txt`. ## Key Components of the Implementation ### Definition of the Stain noise corruption Our implementation relies on a GUI to create the JSON files necessary to launch the training and evaluation procedures. Handling this tool can look rather laborious. However, our network architecture is a classical autoencoder and the training pipeline is standard. For the readers that are interrested of identifying wether the method can improve theirs, they can focus on the understanding of the corruption model. The novelty of the approach lies in this synthetic noise model used to corrupt our training images. This corruption is depicted below. <p align="center"> <img width="500" src=""> <br> </p> *The Stain noise model is a cubic interpolation between 20 points (orange dots), arranged in ascending order of polar coordinates, located around the border of an ellipse of variable size (blue line). The axes of the ellipse are comprised between 1 and 12% of the smallest image dimension and its eccentricity is randomly initialized.* The definition of this Stain Corruption is contained in the `add_stain` function defined in the `datasets/` file. ### The Graphical User Interface The experiments are launched through a GUI called via the instruction `python -gui1`. This interface is composed of four tabs namely: 1. **Import_DB** Thanks to the "browse" buttons, select the folder path to the clean images and the abnormal test images. 2. **Corrupt_DB** Define the specification of the synthetic noise model used to corrupt training images of a specific Database imported before. Default values are the one used in the paper. Also, a folder with test images corrupted with synthetic noise is also created at this time. 3. **Train_Net** Define the network specifications and the training parameters in `hjson` files. 4. **Eval_net** Run evaluation on a trained network. This can include performance evaluation with a residual- and/or an uncertainty-based approach. <p align="center"> <img width="700" src=""> <br> </p>