-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot generate poison data in SSBA algorithm #28
Comments
Hello, I need all your command line inputs to check whether your command line args are wrong or there are bugs in code. |
Try this. I have already go through all of them and successfully start the attack. # go to resource/ssba !
python dataset_convert_into_images.py --dataset cifar10
mkdir jul29
python train.py \
--data_dir ../../data/cifar10_seperate_images/train \
--output_dir ./jul29 \
--EXP_NAME jul29 \
--random_seed 0 \
--fingerprint_length 100 \
--image_resolution 32 \
--num_epochs 20 \
--batch_size 64 \
--use_residual 0 \
--use_modulated 0 \
--fc_layers 0 \
--fused_conv 0
# embedding training dataset
python embed_fingerprints.py \
--encoder_path ./jul29/checkpoints/jul29_encoder.pth \
--data_dir ../../data/cifar10_seperate_images/train \
--output_dir ../../data/cifar10_seperate_images/train_encode \
--image_resolution 32 \
--identical_fingerprints \
--check \
--decoder_path ./jul29/checkpoints/jul29_decoder.pth \
--batch_size 64 \
--seed 0 \
--encode_method bch \
--secret secret \
--use_residual 0 \
--use_modulated 0 \
--fused_conv 0 \
--fc_layers 0 \
--cuda 0
# pack images into npy file
python utils/pack_images.py \
--path ../../data/cifar10_seperate_images/train_encode \
--save_file_path ../../data/cifar10_seperate_images/train_encode.npy
# embedding test dataset
python embed_fingerprints.py \
--encoder_path ./jul29/checkpoints/jul29_encoder.pth \
--data_dir ../../data/cifar10_seperate_images/test \
--output_dir ../../data/cifar10_seperate_images/test_encode \
--image_resolution 32 \
--identical_fingerprints \
--check \
--decoder_path ./jul29/checkpoints/jul29_decoder.pth \
--batch_size 64 \
--seed 0 \
--encode_method bch \
--secret secret \
--use_residual 0 \
--use_modulated 0 \
--fused_conv 0 \
--fc_layers 0 \
--cuda 0
# pack images into npy file
python utils/pack_images.py \
--path ../../data/cifar10_seperate_images/test_encode \
--save_file_path ../../data/cifar10_seperate_images/test_encode.npy
# go to root of backdoorbench first !
python attack/ssba.py --attack_train_replace_imgs_path ../data/cifar10_seperate_images/train_encode.npy --attack_test_replace_imgs_path ../data/cifar10_seperate_images/test_encode.npy |
ok,thanks for you.
thanks for you, I try to use your command and successfully. |
Hi, I met the following errors when reproducing the SSBA algorithm: python embed_fingerprints.py --encoder_path ./jul29/checkpoints/jul29_encoder.pth --data_dir ../../data/cifar10_seperate_images/train --output_dir ../../data/cifar10_seperate_images/train_encode --image_resolution 32 --identical_fingerprints --check --decoder_path ./jul29/checkpoints/jul29_decoder.pth --batch_size 64 --seed 0 --encode_method bch --secret secret --use_residual 0 --use_modulated 0 --fused_conv 0 --fc_layers 0 --cuda 0 |
In the file "embed_fingerprints.py", there is a line "bch = bchlib.BCH(BCH_POLYNOMIAL, BCH_BITS)". It should be "bch = bchlib.BCH(BCH_BITS, BCH_POLYNOMIAL)". By this, I solved the same error. |
I really appreciate your job.
![微信图片_20230728171834](https://private-user-images.githubusercontent.com/53119335/256780997-12494b87-12b2-442c-b57b-1f11b616aa40.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE2NzI4NTQsIm5iZiI6MTcyMTY3MjU1NCwicGF0aCI6Ii81MzExOTMzNS8yNTY3ODA5OTctMTI0OTRiODctMTJiMi00NDJjLWI1N2ItMWYxMWI2MTZhYTQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzIyVDE4MjIzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1ODkxYWE1MjkwMzYyNGY2NGZkMWRkZTg3MDhjNGI2YTE4YmQ0YTBmYzU2ZDJmZjIzZWU1MDY3NGE3MDBlNjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.u1tCLp1GGED_C6_J8cRXACo6RTcevPiJPzgJdKLqgPs)
Excuse me. I cannot generate poison data in ssba.py("--attack_train_replace_imgs_path" and "--attack_test_replace_imgs_path" should receive two path for poisoned training data and poisoned testing data, respectively)
We've already installed the packages in requirement.txt file.
We generated the toxic data based on the command in the readme, but the execution reported an error at step 3.
I want to ask how should I solve this problem. Thanks in advance!
The text was updated successfully, but these errors were encountered: