taquynhnga commited on
Commit
efd120a
1 Parent(s): 059e3b8

Update pages/3_Adversarial_attack.py

Browse files
Files changed (1) hide show
  1. pages/3_Adversarial_attack.py +26 -1
pages/3_Adversarial_attack.py CHANGED
@@ -20,7 +20,32 @@ SECONDARY_COLOR = '#bce7db'
20
 
21
 
22
  st.title('Adversarial Attack')
23
- st.write('How adversarial attacks affect ConvNeXt interpretation?')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  imagenet_df = pd.read_csv('./data/ImageNet_metadata.csv')
26
  image_id = None
 
20
 
21
 
22
  st.title('Adversarial Attack')
23
+ st.write('> **How adversarial attacks affect ConvNeXt interpretation?**')
24
+ st.write("""Adversarial examples are inputs crafted to confuse neural networks, causing them to misclassify a given input.
25
+ These examples are not distinguishable by humans but cause the network to fail to recognize the image content.
26
+ One type of such attack is the fast gradient sign method (FGSM) attack, which is a white box attack that aims to ensure misclassification.
27
+ A white box attack is where the attacker has full access to the model being attacked.
28
+
29
+ The FGSM attack is one of the earliest and most popular adversarial attacks.
30
+ It is described by Goodfellow _et al_ in their work on [Explaining and Harnessing Adversarial Examples](https://arxiv.org/abs/1412.6572).
31
+ The attack is simple yet powerful, using the gradients that neural networks use to learn.
32
+ Instead of adjusting the weights based on the backpropagated gradients to minimize loss, the attack adjusts the input data to maximize the loss using the gradient of the loss with respect to the input data.
33
+ """)
34
+
35
+ instruction_text = """Instruction to input:
36
+ 1. Choosing image: Users can choose a specific image by entering **Image ID** and hit the _Choose the defined image_ button or can generate an image randomly by hitting the _Generate a random image_ button.
37
+ 2. Choosing epsilon: **Epsilon** is the amount of perturbation on the original image under attack. The higher the epsilon is, the more pertubed the image is, the more confusion made to the model.
38
+ Users can choose a specific epsilon by engtering **Epsilon** and hit the _Choose the defined epsilon_ button.
39
+ Users can also let the algorithm find the smallest epsilon automatically by hitting the _Find the smallest epsilon automatically_ button.
40
+ The underlying algorithm will iterate through a set of epsilon in ascending order until reaching the **maximum value of epsilon**.
41
+ After each iteration, the epsilon will increase by an amount equal to **step** variable.
42
+ Users can change the default values of the two variable value optionally.
43
+ """
44
+ st.write("To use the functionality below, users need to input the **image** and the **epsilon**.")
45
+ with st.expander("See more instruction", expanded=False):
46
+ st.write(instruction_text)
47
+
48
+
49
 
50
  imagenet_df = pd.read_csv('./data/ImageNet_metadata.csv')
51
  image_id = None