|
@@ -29,7 +29,7 @@ parser = argparse.ArgumentParser(description='Adversarial attack from gradient l
|
|
|
parser.add_argument('--model', type=str, help='model to perform adversarial attack')
|
|
|
parser.add_argument('--data', type=str, help='dataset used')
|
|
|
parser.add_argument('--stack_size', default=4, type=int, help='size use to stack images')
|
|
|
-parser.add_argument('-l','--target_idx', nargs='+', help='list of data index to recontruct')
|
|
|
+parser.add_argument('-l','--target_idx', type=str, help='comma separated list of data index to recontruct')
|
|
|
parser.add_argument('--save', type=str2bool, nargs='?', const=False, default=True, help='save')
|
|
|
parser.add_argument('--gpu', type=str2bool, nargs='?', const=False, default=True, help='use gpu')
|
|
|
|
|
@@ -39,11 +39,12 @@ model_name = args.model
|
|
|
data = args.data
|
|
|
stack_size = args.stack_size
|
|
|
save_output = args.save
|
|
|
-if args.target_idx is not None:
|
|
|
- target_idx = [int(i) for i in args.target_idx]
|
|
|
-else:
|
|
|
+if args.target_idx is not None:
|
|
|
+ target_idx = [int(i) for i in args.target_idx.split(',')]
|
|
|
+else:
|
|
|
target_idx = args.target_idx
|
|
|
|
|
|
+
|
|
|
device = 'cpu'
|
|
|
if args.gpu:
|
|
|
device = 'cuda'
|