elliothe / bfa Goto Github PK
View Code? Open in Web Editor NEWPytorch implementation of Bit-Flip based adversarial weight Attack (BFA)
Home Page: https://elliothe.github.io/BFA/
License: Other
Pytorch implementation of Bit-Flip based adversarial weight Attack (BFA)
Home Page: https://elliothe.github.io/BFA/
License: Other
When I was trying to perform the attacks on resnet18, I modified the model
in BFA_imagenet.sh to resnet18
, and got the following errors:
Traceback (most recent call last):
File "main.py", line 860, in <module>
main()
File "main.py", line 445, in main
random_attack=args.random_bfa)
File "main.py", line 592, in perform_attack
attack_log = attacker.progressive_bit_search(model, data, target)
File "/home/yecheng/repo/BFA/attack/BFA.py", line 124, in progressive_bit_search
key=operator.itemgetter(1))[0]
ValueError: max() arg is an empty sequence
I also tried the other Github repo for your previous paper, however, the issue persists.
May I get some help?
Hello, I tested BFA attack in this code but can't equal attack performance in vgg11-bn-quan, unlike resnet. (N_flips is 11 on paper, but 50 on test this code).
I think that the attack performance gap is caused by using different pre-trained weights.
So, plz uploaded your pre-trained vgg11-bn-quan weight?
I show that attack performance differs from BFA papers while attempting resnet44 and resnet56 BFA Attack. (paper resnet44 8bit is [6, 10, 11, 13, 22] but my resnet44 8bit is [57, 56, 59, 62, 60] and not drop acc 10%)
Therefore, I think BFA attack performance doesn't come out properly when the network gets deeper, what do you think?
Also, if possible, can you provide the weight parameter you used?
my resnet44 and resnet56 training script is this is this.
`
model=resnet56_quan
dataset=cifar10
epochs=160
train_batch_size=128
test_batch_size=128
optimizer=SGD
quan_bitwidth=8
seed=1
label_info=train
save_path=./save/${DATE}/${dataset}${model}${epochs}${optimizer}${label_info}${quan_bitwidth}${seed}
tb_path=${save_path}/tb_log #tensorboard log path
############### Neural network ############################
{
/usr/bin/env python ./main.py --dataset ${dataset}
--data_path ${data_path}
--arch ${model} --save_path ${save_path}
--quan_bitwidth ${quan_bitwidth}
--manualSeed ${seed}
--epochs ${epochs} --learning_rate 0.1
--optimizer ${optimizer}
--schedule 80 120 --gammas 0.1 0.1
--attack_sample_size ${train_batch_size}
--test_batch_size ${test_batch_size}
--workers 4 --ngpu 1 --gpu_id 0
--print_freq 100 --decay 0.0003 --momentum 0.9
} &
model=resnet44_quan
dataset=cifar10
epochs=160
train_batch_size=128
test_batch_size=128
optimizer=SGD
quan_bitwidth=8
seed=1
label_info=train
save_path=./save/${DATE}/${dataset}${model}${epochs}${optimizer}${label_info}${quan_bitwidth}${seed}
tb_path=${save_path}/tb_log #tensorboard log path
############### Neural network ############################
{
/usr/bin/env python ./main.py --dataset ${dataset}
--data_path ${data_path}
--arch ${model} --save_path ${save_path}
--quan_bitwidth ${quan_bitwidth}
--manualSeed ${seed}
--epochs ${epochs} --learning_rate 0.1
--optimizer ${optimizer}
--schedule 80 120 --gammas 0.1 0.1
--attack_sample_size ${train_batch_size}
--test_batch_size ${test_batch_size}
--workers 4 --ngpu 1 --gpu_id 0
--print_freq 100 --decay 0.0003 --momentum 0.9
} &
File "main.py", line 860, in
main()
File "main.py", line 445, in main
random_attack=args.random_bfa)
File "main.py", line 572, in perform_attack
attacker.criterion, log, summary_output=True)
File "main.py", line 770, in validate
prec1, prec5 = accuracy(output.data, target, topk=(1, 5))
File "main.py", line 835, in accuracy
correct_k = correct[:k].view(-1).float().sum(0)
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
The bin_resnet_cifar code present in the corresponding model folder seems to be quantization resnet rather than bin_resnet_cifar.
Can i refer to bin_vgg that convert to NN from quantized to binarized ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.