hcguoO0 / FIA

code for "Feature Importance-aware Transferable Adversarial Attacks"
76 stars 15 forks source link

The mid-layer parameter? #4

Closed jackylyy closed 3 years ago

jackylyy commented 3 years ago

Hello,Could tell me when inception-resnet-v2 as the source model,what mid layer to be attack,I set the parameter ‘InceptionResnetV2/InceptionResnetV2/Conv2d_4a_3x3/Relu’ that follows your paper Conv_4a. But the permance is lower 10% comparing the result in your paper. So what is the mid parameter when you attack inception-resnet-v2? Thx.

hcguoO0 commented 3 years ago

The parameter ‘InceptionResnetV2/InceptionResnetV2/Conv2d_4a_3x3/Relu’is right, can you check whether you have modified the code or whether the other parameters are right?

jackylyy commented 3 years ago

I just do this experiment again. I am sure that the all parameters are consisent except mid-layer. All I modify are the mid-layer and the image_size from 224 to 299. But the performance is still lower 10%. Below is the parameter setting,and I did‘t change other code.

tf.flags.DEFINE_string('model_name', 'inception_resnet_v2', 'The Model used to generate adv.')

tf.flags.DEFINE_string('attack_method', 'FIA', 'The name of attack method.')

tf.flags.DEFINE_string('layer_name','InceptionResnetV2/InceptionResnetV2/Conv2d_4a_3x3/Relu','The layer to be attacked.')

tf.flags.DEFINE_string('input_dir', './dataset/images/', 'Input directory with images.')

tf.flags.DEFINE_string('output_dir', './adv/FIA/', 'Output directory with images.')

tf.flags.DEFINE_float('max_epsilon', 16.0, 'Maximum size of adversarial perturbation.')

tf.flags.DEFINE_integer('num_iter', 10, 'Number of iterations.')

tf.flags.DEFINE_float('alpha', 1.6, 'Step size.')

tf.flags.DEFINE_integer('batch_size', 20, 'How many images process at one time.')

tf.flags.DEFINE_float('momentum', 1.0, 'Momentum.')

tf.flags.DEFINE_string('GPU_ID', '4', 'which GPU to use.')

"""parameter for DIM""" tf.flags.DEFINE_integer('image_size', 299, 'size of each input images.')

tf.flags.DEFINE_integer('image_resize', 250, 'size of each diverse images.')

tf.flags.DEFINE_float('prob', 0.7, 'Probability of using diverse inputs.')

"""parameter for TIM""" tf.flags.DEFINE_integer('Tkern_size', 15, 'Kernel size of TIM.')

"""parameter for PIM""" tf.flags.DEFINE_float('amplification_factor', 2.5, 'To amplifythe step size.')

tf.flags.DEFINE_float('gamma', 0.5, 'The gamma parameter.')

tf.flags.DEFINE_integer('Pkern_size', 3, 'Kernel size of PIM.')

"""parameter for FIA""" tf.flags.DEFINE_float('ens', 30.0, 'Number of random mask input.')

tf.flags.DEFINE_float('probb', 0.9, 'keep probability = 1 - drop probability.')

FLAGS = tf.flags.FLAGS os.environ["CUDA_VISIBLE_DEVICES"] = FLAGS.GPU_ID

hcguoO0 commented 3 years ago

the parameter “probb” should be 0.7 when attacking normally trained models and be 0.9 when attacking defense models

jackylyy commented 3 years ago

Ok, it's no problem now, thx.