当前位置:网站首页>Differernet [anomaly detection: normalizing flow]
Differernet [anomaly detection: normalizing flow]
2022-07-28 22:41:00 【It's too simple】
Preface
The blog is from 2020.8CVPR A paper on ,papers with code Statistical in MVTec The data set is ranked 20( As of the time of posting ), Now let's use Normalizing Flow Most of the network architecture testing results of the main ideas are in the forefront . This article mainly aims at DifferNet Understand the network operation architecture , There is no introduction to loss function and experiment .
background
The idea of network combines neural network feature extraction and standardized flow for density estimation , Solve the problem that defects cannot be detected by traditional methods using high intra class variance .
Standardized flow is a kind of neural network that can realize the transformation from data to density estimation , It is characterized by convenient propagation in two directions . There are two ways to implement affine transformation layer ( Autoregression and fixation ).RealNVP It is a special kind of inverse autoregressive flow . This article USES the RealNVP Structure and design an exponential function to make the training converge better .
The network proposes a classification of anomaly detection models based on generation model and pre training network . This network is the first batch of networks that use standardized flow for anomaly detection ..
Source code principle ( The model part )
Find the function input , Understand trunk functions , The following is understood with reference to the figure below .

class DifferNet(nn.Module)
batchsize Set to 24, After image enhancement *4, That is, one-time input model 96 A picture , Be careful 96 Map processing at the same time . Each picture is sampled into 1/1,1/2 and 1/4 size , After that, three down sampled pictures passed AlexNet Network feature extraction , Average all pixel values of each channel of the extracted feature map , Because it is 96 Map processing at the same time , formation (96,256) tensor , Three pictures cat Post formation (96,768) tensor .
def nf_head(input_dim=c.n_feat)
structure 10 A flow block ,8 individual NormalizingFlow Flow block ,1 individual Input fast ,1 individual output block .8 Each flow block is a consistent structure :
(1)class permute_layer(nn.Module)
take 0~768 Make two disorderly permutations of numbers , There is a law between these two disordered permutations , One is random disorder , The other made another disorder based on random disorder .
(2)class glow_coupling_layer(nn.module)
take 768 The dimension is divided into two halves (0~364,364~768), The latter half is activated by full connection ,s2,t2 Divide the latter half into half , According to the formula in the original paper (1) With the first half 768 Dimension calculation version . After the computing version is activated by full connection ,s1,t1 Divide the calculation version in half , According to the formula in the original paper (1) Calculate with the first half to generate the final version . Combine the calculated version with the final version in a column , And limit the range of values after combination .
1)class F_fully_connected(nn.Module)
Four floors are fully connected , The whole company hierarchy has Dropout Probabilistic reduction in the number of neurons , Prevent over fitting , The last layer does not set the activation function , Not set up Dropout.
2)def log_e(self,s)
The exponential function mentioned above , The formula of the original paper (2), Limit the value of the dimension to (-3,3) Between .
tips( Source code some interesting program segments )
(1) The parent class calls the child class
Source code segment
if not self.input_dims: # Only do it if this hasn't been computed yet
self.input_dims = [n.build_modules(verbose=verbose)[c]
for n, c in self.inputs]explain
self.inputs yes InputNode.out0, Look back InputNode In class self.out0 = (self, 0), That is to say n representative self This class itself ,c representative 0, adopt build_modules Function returns the input dimension 768.
(2)96 Transformation of tensor form of picture ( namely torch.Size([24, 4, 3, 448, 448])-->torch.Size([96, 3, 448, 448]))
Source code segment
inputs = inputs.view(-1, *inputs.shape[-3:])explain
*: Represents the input of arguments
view:-1 It means that the value here is not determined , Determine according to the later determined value ,(24,4,...) To (96,...) The source code completes the conversion .
边栏推荐
- Vscode ROS configuration GDB debugging error record
- MySQL installation and configuration (super detailed, simple and practical)
- 20-09-27 the project is migrated to Alibaba toss record (the network card order makes the service unable to connect to DB through haproxy)
- STM32_ Hal library driven framework
- Sword finger offer II 055. Binary search tree iterator (medium binary search tree iterator)
- 二进制的原码、反码、补码
- npm ERR code ETIMEDOUT npm ERR syscall connect npm ERR errno ETIMEDOUT npm ERR network reques...
- CMD common commands
- redis相关
- ATT&CK初步了解
猜你喜欢

Install PCL and VTK under the background of ROS installation, and solve VTK and PCL_ ROS conflict problem

Win11 how to open software notification

微信小程序剪切图片的功能

Ultra detailed visual studio 2019 running littlevgl (lvgl) simulator

使用PCL批量显示PCD点云数据流
![[reprint] the token token is used in the login scenario](/img/84/77dc2316e2adc380a580e2456c0e59.png)
[reprint] the token token is used in the login scenario

STM32_ Hal library driven framework
Integrating database Ecology: using eventbridge to build CDC applications
![[CVPR 2021] cylinder3d: cylindrical asymmetric 3D convolution network for LIDAR point cloud segmentation](/img/3d/3def78ec88419712e14cf437e21447.png)
[CVPR 2021] cylinder3d: cylindrical asymmetric 3D convolution network for LIDAR point cloud segmentation

MySQL built-in functions
随机推荐
STM32 board level support package for keys
Concise history of graphic technology
Qt+FFmpeg环境搭建
C language to realize string reverse order arrangement
775. Inverted words
Leetcode integer exercises integer inversion
PaddleNLP基于ERNIR3.0文本分类以中医疗搜索检索词意图分类(KUAKE-QIC)为例【多分类(单标签)】
Att & CK Threat Intelligence
GD32F303固件库开发(10)----双ADC轮询模式扫描多个通道
删除容器镜像报错解决image is referenced in multiple repositories
Sword finger offer II 065. The shortest word code (medium dictionary tree string array)
微信小程序里button点击的时候会边框有黑线
JS convert numbers to letters
Closure, prototype and original link
STM32 - interrupt overview (interrupt priority)
elment-plus图标input上面带的图标为什么不显示
Kali source solution software cannot be installed correctly
Sword finger offer II 063. replacement word (medium prefix tree string)
Ngx+sql environment offline installation log (RPM installation)
How do we do full link grayscale on the database?