sutd-visual-computing-group / Re-thinking_MI

[CVPR-2023] Re-thinking Model Inversion Attacks Against Deep Neural Networks
https://ngoc-nguyen-0.github.io/re-thinking_model_inversion_attacks/
32 stars 4 forks source link

KeyError: 'gan_file_path' #2

Closed LukasStruppek closed 1 year ago

LukasStruppek commented 1 year ago

Hi,

I am currently trying to reproduce the results from the paper. However, I am not able to run the LOMMA attack. However, it seems that a key (gan_file_path) is missing in the configuration file:

Traceback (most recent call last):  
  File "recovery.py", line 75, in <module>
    targetnets, E, G, D, n_classes, fea_mean, fea_logvar = get_attack_model(  
  File "/workspace/utils.py", line 289, in get_attack_model  
    _, dataloader_gan = init_dataloader(args_json, args_json['dataset']['gan_file_path'], 50, mode="gan")  
KeyError: 'gan_file_path'  

And this is my configuration file:

{
    "root_path": "./attack_results_lomla_00/",
    "dataset": {
        "model_name": "VGG16",
        "test_file_path": "./datasets/celeba/meta/testset.txt",
        "name": "celeba",
        "img_path": "./datasets/celeba/img_align_celeba",
        "n_classes": 1000,
        "fid_real_path": "./datasets/celeba/meta/celeba_target_300ids.npy",
        "KNN_real_path": "./datasets/celeba/meta/fea_target_300ids.npy",
        "p_reg_path": "./checkpoints/p_reg",
    },
    "train": {
        "model_types": "VGG16,efficientnet_b0",
        "cls_ckpts": "checkpoints/target_model/target_ckp/VGG16_85.74_allclass.tar,checkpoints/aug_ckp/celeba/VGG16_efficientnet_b0_0.01_1.0/VGG16_efficientnet_b0_kd_1_20.pt",
        "num_seeds": 5,
        "Nclass": 1000,
        "gan_model_dir": "./checkpoints/GAN",
        "eval_model": "FaceNet",
        "eval_dir": "./checkpoints/target_model/target_ckp/FaceNet_95.88.tar"
    },
    "attack": {
        "method": "gmi",
        "variant": "ours",
        "iters_mi": 2400,
        "lr": 0.02,
        "lam": 1.0,
        "same_z": "",
        "eval_metric": "fid, acc, knn"
    }
}

Could you help me to fix this bug? I already tried adding the missing key with the value set to the generator path. Still, I receive another error for this. Thank you very much in advance :)

Best, Lukas

ngoc-nguyen-0 commented 1 year ago

Hi Lukas,

Thank you for letting me know it. I have updated the config. It should be: "gan_file_path": "./datasets/celeba/meta/ganset.txt"

"dataset":{ "model_name": "VGG16", "test_file_path": "./datasets/celeba/meta/testset.txt", "gan_file_path": "./datasets/celeba/meta/ganset.txt", "name": "celeba", "img_path": "./datasets/celeba/img_align_celeba", "img_gan_path": "./datasets/celeba/img_align_celeba", "n_classes":1000, "fid_real_path": "./datasets/celeba/meta/celeba_target_300ids.npy", "KNN_real_path": "./datasets/celeba/meta/fea_target_300ids.npy", "p_reg_path": "./checkpoints/p_reg" },

Thanks. Ngoc

LukasStruppek commented 1 year ago

Hi Ngoc,

thank you very much for your fast response. It now seems to work – I just need to train two additional augmentation models.

Best, Lukas