Giter VIP home page Giter VIP logo

Comments (5)

CHR-ray avatar CHR-ray commented on July 23, 2024

Hello, I need all your command line inputs to check whether your command line args are wrong or there are bugs in code.

from backdoorbench.

CHR-ray avatar CHR-ray commented on July 23, 2024

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

from backdoorbench.

FantasticCode2019 avatar FantasticCode2019 commented on July 23, 2024

ok,thanks for you.

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

thanks for you, I try to use your command and successfully.

from backdoorbench.

ShaniaShan avatar ShaniaShan commented on July 23, 2024

Hi,
Thanks for sharing your wonderful work.

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
use_celeba_preprocessing False <
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 True <
check True <
decoder_path ./jul29/checkpoints/jul29_decoder.pth <
batch_size 64 <
cuda 0 <
use_residual 0 <
encode_method bch <
secret secret <
seed 0 <
diff_bits 0 <
manual_str None <
proportion 1.0 <
use_modulated 0 <
fc_layers 0 <
fused_conv 0 <
bias_init None <
test_save_file None <
poison_rate 1.0 <
Loading image folder ../../data/cifar10_seperate_images/train ...
Finished. Loading took 0.23s
----------Not using modulated conv!----------
Fingerprinting the images...
Using bch code with secret string: secret
Traceback (most recent call last):
File "embed_fingerprints.py", line 281, in
main()
File "embed_fingerprints.py", line 278, in main
embed_fingerprints()
File "embed_fingerprints.py", line 171, in embed_fingerprints
identical = args.identical_fingerprints)
File "/home/backdoor/ssba/generate_fingerprints.py", line 63, in generate_fingerprints
fingerprints = generate_fingerprints_from_bch(fingerprint_size, secret)
File "/home/backdoor/ssba/generate_fingerprints.py", line 13, in generate_fingerprints_from_bch
bch = bchlib.BCH(BCH_POLYNOMIAL, BCH_BITS)
RuntimeError: unable to inititalize bch, invalid parameters?
_

from backdoorbench.

houseshiliang avatar houseshiliang commented on July 23, 2024

您好, 感谢您分享您的精彩工作。

我在重现SSBA算法时遇到以下错误:

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 -- same_fingerprints --check --decoder_path ./jul29/checkpoints/jul29_decoder.pth --batch_size 64 --seed 0 --encode_method bch --secret 秘密 --use_residual 0 --use_modulated 0 --fused_conv 0 --fc_layers 0 -- cuda 0 use_celeba_preprocessing False < 编码器路径./jul29/checkpoints/jul29_encoder.pth < data_dir ../../data/cifar10_seperate_images/train < output_dir ../../data/cifar10_seperate_images/train_encode < image_resolution 32 < Same_fingerprints True < check True < 解码器路径./jul29/checkpoints/jul29_decoder.pth < batch_size 64 < cuda 0 < use_residual 0 < encode_method bch < 秘密秘密< 种子0< diff_bits 0< manual_str无< 比例1.0< use_modulated 0< fc_layers 0< fused_conv 0< bias_init无< test_save_file无< poison_rate 1.0< 正在加载图像文件夹../../data/cifar10_seperate_images/train ... 已完成。加载花费了 0.23 秒 ---------- 不使用调制转换!------------ 对图像进行指纹识别... 使用带有秘密字符串的 bch 代码:秘密 回溯(最近一次调用最后一次) : 文件“embed_fingerprints.py”,第281行,在 main() 中文件“embed_fingerprints.py”,第278行,在main embed_fingerprints()中 文件“embed_fingerprints.py”,第171行,在embed_fingerprints中 相同= args.identical_fingerprints) 文件“ /home/backdoor/ssba/generate_fingerprints.py”,第 63 行,generate_fingerprints Fingerprints =generate_fingerprints_from_bch(fingerprint_size, Secret) 文件“/home/backdoor/ssba/generate_fingerprints.py”,第 13 行,generate_fingerprints_from_bch bch = bchlib.BCH( BCH_POLYNOMIAL,BCH_BITS) 运行时错误:无法初始化bch,参数无效? _

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.

from backdoorbench.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.