Datasets:
Tasks:
Question Answering
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Add files using upload-large-folder tool
Browse filesFiles changed (6)
109 unmodified lines110111112113114115116109 unmodified lines# Output:Detector(LID) . a detector 1: $\mathrm { L I D } _ { n e g } { = } [ ]$ , $\mathrm { L I D } _ { p o s } { = } [ ]$ 2: for $B _ { n o r m }$ in $X$ do $\textsf { \textsf { D } } B _ { n o r m }$ : a minibatch of normal examples 3: $B _ { a d v } : =$ adversarial attack $B _ { n o r m }$ . $B _ { a d v }$ : a minibatch of adversarial examples 4: $B _ { n o i s y }$ : $: =$ add random noise to $B _ { n o r m }$ . $B _ { n o i s y }$ : a minibatch of noisy examples 5: N = |Bnorm| $\triangleright$ number of examples in $B _ { n o r m }$ 6: LIDnorm, LIDnoisy, $\mathrm { L I D } _ { n o i s y } = \mathrm { z e r o s } [ N , L ]$ 7: for $i$ in $[ 1 , L ]$ do 8: Anorm = Hi(Bnorm) $\triangleright i$ -th layer activations of $B _ { n o r m }$ 9: Aadv = Hi(Badv) $\triangleright i$ -th layer activations of $B _ { a d v }$ 10: $A _ { n o i s y } = H ^ { i } ( B _ { n o i s y } )$ ${ \triangleright } i$ -th layer activations of $B _ { n o i s y }$ 11: for $j$ in $[ 1 , N ]$ do 12: $\begin{array} { r } { \dot { \mathrm { L I D } _ { n o r m } } \dot { [ j , i ] } = - \Big ( \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \log { \frac { r _ { i } ( A _ { n o r m } [ j ] , A _ { n o r m } ) } { r _ { k } ( A _ { n o r m } [ j ] , A _ { n o r m } ) } } \Big ) ^ { - 1 } } \end{array}$ 13: $\begin{array} { r } { \mathbf { L I D } _ { a d v } [ j , i ] = - \Big ( \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \log \frac { r _ { i } ( A _ { a d v } [ j ] , A _ { n o r m } ) } { r _ { k } ( A _ { a d v } [ j ] , A _ { n o r m } ) } \Big ) ^ { - \frac { 1 } { \gamma _ { k } } } } \end{array}$ 1 14: LIDnoisy[j, i] = − 1k Pki=1 log ri(Anoisy[j],Anorm)rk(Anoisy[j],Anorm) 15: $\triangleright r _ { i } ( A [ j ] , A _ { n o r m } )$ : the $L _ { 2 }$ distance of $A _ { - } [ j ]$ to its $i$ -th nearest neighbor in $A _ { n o r m }$ 16: end for 17: end for 18: ${ \mathrm { L I D } } _ { n e g }$ .append $( \mathrm { L I D } _ { n o r m } )$ , ${ \mathrm { L I D } } _ { n e g }$ .append $( \mathrm { L I D } _ { n o i s y } )$ 19: $\mathrm { L I D } _ { p o s }$ .append $\mathrm { L I D } _ { a d v , }$ ) 20: end for 21: Detector $\left( \mathrm { L I D } \right) =$ train a classifier on $( \mathrm { L I D } _ { n e g } , \mathrm { L I D } _ { p o s } )$# 5.1 EXPERIMENTAL SETUP109 unmodified lines110111112113114115116109 unmodified lines# Output:Detector(LID) . a detector 1: $\mathrm { L I D } _ { n e g } { = } [ ]$ , $\mathrm { L I D } _ { p o s } { = } [ ]$ 2: for $B _ { n o r m }$ in $X$ do $\textsf { \textsf { D } } B _ { n o r m }$ : a minibatch of normal examples 3: $B _ { a d v } : =$ adversarial attack $B _ { n o r m }$ . $B _ { a d v }$ : a minibatch of adversarial examples 4: $B _ { n o i s y }$ : $: =$ add random noise to $B _ { n o r m }$ . $B _ { n o i s y }$ : a minibatch of noisy examples 5: N = |Bnorm| $\triangleright$ number of examples in $B _ { n o r m }$ 6: LIDnorm, LIDnoisy, $\mathrm { L I D } _ { n o i s y } = \mathrm { z e r o s } [ N , L ]$ 7: for $i$ in $[ 1 , L ]$ do 8: Anorm = Hi(Bnorm) $\triangleright i$ -th layer activations of $B _ { n o r m }$ 9: Aadv = Hi(Badv) $\triangleright i$ -th layer activations of $B _ { a d v }$ 10: $A _ { n o i s y } = H ^ { i } ( B _ { n o i s y } )$ ${ \triangleright } i$ -th layer activations of $B _ { n o i s y }$ 11: for $j$ in $[ 1 , N ]$ do 12: $\begin{array} { r } { \dot { \mathrm { L I D } _ { n o r m } } \dot { [ j , i ] } = - \Big ( \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \log { \frac { r _ { i } ( A _ { n o r m } [ j ] , A _ { n o r m } ) } { r _ { k } ( A _ { n o r m } [ j ] , A _ { n o r m } ) } } \Big ) ^ { - 1 } } \end{array}$ 13: $\begin{array} { r } { \mathbf { L I D } _ { a d v } [ j , i ] = - \Big ( \frac { 1 } { k } \sum _ { i = 1 } ^ { k } \log \frac { r _ { i } ( A _ { a d v } [ j ] , A _ { n o r m } ) } { r _ { k } ( A _ { a d v } [ j ] , A _ { n o r m } ) } \Big ) ^ { - \frac { 1 } { \gamma _ { k } } } } \end{array}$ 1 14: LIDnoisy[j, i] = − 1k Pki=1 log ri(Anoisy[j],Anorm)rk(Anoisy[j],Anorm) 15: $\triangleright r _ { i } ( A [ j ] , A _ { n o r m } )$ : the $L _ { 2 }$ distance of $A _ { - } [ j ]$ to its $i$ -th nearest neighbor in $A _ { n o r m }$ 16: end for 17: end for 18: ${ \mathrm { L I D } } _ { n e g }$ .append $( \mathrm { L I D } _ { n o r m } )$ , ${ \mathrm { L I D } } _ { n e g }$ .append $( \mathrm { L I D } _ { n o i s y } )$ 19: $\mathrm { L I D } _ { p o s }$ .append $\mathrm { L I D } _ { a d v , }$ ) 20: end for 21: Detector $\left( \mathrm { L I D } \right) =$ train a classifier on $( \mathrm { L I D } _ { n e g } , \mathrm { L I D } _ { p o s } )$# 5.1 EXPERIMENTAL SETUP
82 unmodified lines8384858687888982 unmodified lines# 4.1 MULTI-SCALE CASE (MUSAE)We know that the SGNS aspect of MUSAE (Algorithm 2, Line 17) is minimized when the learned embeddings grv , hrf satisfy grw>hrf ≈ log #(w,f )r|Dr|#(w)r#(f )r − log b ∀w ∈ V, f ∈ F. Our aim is to express this factorization in terms of known properties of the graph $\mathcal { G }$ and its features.Lemma 1. The empirical statistics of node-feature pairs obtained from random walks give unbiased estimates of joint probabilities of observing feature $f \in \mathbb { F } r$ steps $( i )$ after; or $( i i )$ before node $v \in \mathbb { V }$ , as given by:82 unmodified lines8384858687888982 unmodified lines# 4.1 MULTI-SCALE CASE (MUSAE)We know that the SGNS aspect of MUSAE (Algorithm 2, Line 17) is minimized when the learned embeddings grv , hrf satisfy grw>hrf ≈ log #(w,f )r|Dr|#(w)r#(f )r − log b ∀w ∈ V, f ∈ F. Our aim is to express this factorization in terms of known properties of the graph $\mathcal { G }$ and its features.Lemma 1. The empirical statistics of node-feature pairs obtained from random walks give unbiased estimates of joint probabilities of observing feature $f \in \mathbb { F } r$ steps $( i )$ after; or $( i i )$ before node $v \in \mathbb { V }$ , as given by:
356 unmodified lines357358359360361362363356 unmodified lines
• Image and Label encoder, $q ( z | x , y )$ : Our architecture (Figure 9) for the image-label encoder first separately processes the images and the labels, and then concatenates them downstream in the network and then passes the concatenated features through a multi-layered perceptron. More specifically, we have convolutional layers which process image into 32, 64, 128, 16 feature maps with strides $1 , 2 , 2 , 2$ in the corresponding layers. We use batch normalization in the convolutional layers before applying the ELU non-linearity. On the label encoder side, we first encode the each attribute label into a 32d continuous vector and then pass each individual attribute vector through a 2-layered MLP with 512 hidden dimensions each. For example, for MNIST-A we have 4 attributes, which gives us 4 vectors of 512d. We then concatenate these vectors and pass it through a two layer MLP. Finally we concatenate this label feature with the image feature after the convolutional layers (after flattening the conv-features) and then pass the result through a 2 layer MLP to predict the mean $( \mu )$ and standard deviation $( \sigma )$ for the latent space gaussian. Following standard practice, we predict $\log \sigma$ for the standard deviation in order to get values which are positive.
# µ