当前位置:网站首页>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 .
边栏推荐
- Imx6q GPIO multiplexing
- Less than a year after its establishment! MIT derivative quantum computing company completed financing of US $9million
- 微信小程序里button点击的时候会边框有黑线
- JS获取当前时间(年月日时分秒)
- Integrating database Ecology: using eventbridge to build CDC applications
- Ngrok intranet penetration
- JVM——自定义类加载器
- 98. Verify binary search tree (medium binary search tree DFS)
- mysql8.0无法给用户授权或提示You are not allowed to create a user with GRANT的问题
- Use webworker to perform background tasks
猜你喜欢

php二维数组如何删除去除第一行元素

842. 排列数字
![[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

静态成员static详解

When can I sign up for the 2022 class I constructor examination?

MySQL built-in functions

winform跳转第二个窗体案例

XXX port is already in use

Sword finger offer II 055. Binary search tree iterator (medium binary search tree iterator)

Which is the file transfer command in the basic services of the Internet
随机推荐
Ngrok intranet penetration
[virtual machine _2]-hyper-v and vmware/virtualbox cannot coexist
elment-plus图标input上面带的图标为什么不显示
近期bug总结
98. Verify binary search tree (medium binary search tree DFS)
Paddlenlp is based on ernir3.0 text classification. Take the crime prediction task of cail2018-small dataset as an example [multiple tags]
Solve the problem that TS node xxx.ts executes TS code and reports errors
Vscode ROS configuration GDB debugging error record
105. Construct binary tree from preorder and inorder traversal sequence (medium binary tree DFS hash table binary tree)
Sword finger offer II 065. The shortest word code (medium dictionary tree string array)
winform跳转第二个窗体案例
CMD common commands
Winserver operation and maintenance technology stack
There will be a black line on the border when the button in the wechat applet is clicked
Paddlenlp text classification based on ernir3.0: take wos dataset as an example (hierarchical classification)
JS array merging, de duplication, dimensionality reduction (es6: extended operator, set)
75. Color classification (medium array double pointer sorting)
Jianzhi offer II 062. implement prefix tree (medium design dictionary tree prefix tree string)
What does GPRS network mean
Awk blank line filtering