SonyResearch / SemSim

Implementation of the paper: "Privacy Assessment on Reconstructed Images: Are Existing Evaluation Metrics Faithful to Human Perception?” (NeurIPS 2023)
Apache License 2.0
5 stars 0 forks source link

[BUG] Cannot run codes due to missing files #4

Open nidham-sony opened 10 months ago

nidham-sony commented 10 months ago

This is the bug I get (I have downloaded all data and place it respectively in benchmark/images/Cifar_ori/ and benchmark/images/cifar100/)

(semsim) chgazagn@deatcs001fc106:~/sony/projects/SemSim$ python metrics/pixel_level_metrics.py
Setting up [LPIPS] perceptual loss: trunk [squeeze], v[0.1], spatial [off]
Loading model from: /home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/lpips/weights/v0.1/squeeze.pth
ResNet20-4_200_inversed_aug_auglist__rlabel_False
Traceback (most recent call last):
  File "metrics/pixel_level_metrics.py", line 156, in <module>
    results, results_positive, positive_item_rec, positive_item_ori= calculate_metrics(path_ori, path_rec)
  File "metrics/pixel_level_metrics.py", line 118, in calculate_metrics
    ori_ps = np.loadtxt(os.path.join(ori_dir+'_ps', name + ".txt"))
  File "/home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/numpy/lib/npyio.py", line 1338, in loadtxt
    arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
  File "/home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/numpy/lib/npyio.py", line 975, in _read
    fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
  File "/home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/numpy/lib/_datasource.py", line 193, in open
    return ds.open(path, mode, encoding=encoding, newline=newline)
  File "/home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/numpy/lib/_datasource.py", line 533, in open
    raise FileNotFoundError(f"{path} not found.")
FileNotFoundError: benchmark/images/cifar100/ResNet20-4_200_inversed_aug_auglist__rlabel_False_ori_ps/3_72.txt not found.

@sxzrt : can you make sure the file ResNet20-4_200_inversed_aug_auglist__rlabel_False_ori_ps/3_72.txt exist and inflate the zip ?

nidham-sony commented 10 months ago

I also have this bug

(semsim) chgazagn@deatcs001fc106:~/sony/projects/SemSim$ python benchmark/Semsim_train_evaluation.py --data human_anno_id --arch ResNet18 --epochs 100 --mode crop --semsim True
Currently evaluating -------------------------------:
Monday, 18. December 2023 06:16PM
CPUs: 6, GPUs: 1 on deatcs001fc106.
GPU : NVIDIA RTX A4000
False
True
Currently evaluating -------------------------------:
Monday, 18. December 2023 06:16PM
CPUs: 6, GPUs: 1 on deatcs001fc106.
GPU : NVIDIA RTX A4000
Traceback (most recent call last):
  File "benchmark/Semsim_train_evaluation.py", line 288, in <module>
    main()
  File "benchmark/Semsim_train_evaluation.py", line 68, in main
    loss_fn, trainloader, validloader, _ = preprocess(opt, defs, valid=False)
  File "./benchmark/comm.py", line 370, in preprocess
    loss_fn, _, _, _ = inversefed.construct_dataloaders('human_anno_id', defs, opt.rec_data_dir, opt = opt)
  File "./inversefed/data/data_processing.py", line 47, in construct_dataloaders
    trainset, validset, recset = _build_human_anno_id(path, rec_data_dir, defs.augmentations, normalize, opt)
  File "./inversefed/data/data_processing.py", line 214, in _build_human_anno_id
    trainset = RE_ID_Tri_All_Data(data_path +  '/train_with_ori', transform=transforms.ToTensor())
  File "./inversefed/data/re_id_dataset_cross_tri.py", line 12, in __init__
    self.classes = sorted([d.name for d in os.scandir(root_dir) if d.is_dir()])
FileNotFoundError: [Errno 2] No such file or directory: '../../../data/human_anno_id/train_with_ori'
nidham-sony commented 10 months ago

And similarly for test

(semsim) chgazagn@deatcs001fc106:~/sony/projects/SemSim$ python benchmark/Semsim_train_evaluation.py --data human_anno_id --arch ResNet18 --epochs 100 --mode crop --semsim True --evaluate True
Currently evaluating -------------------------------:
Monday, 18. December 2023 06:18PM
CPUs: 6, GPUs: 1 on deatcs001fc106.
GPU : NVIDIA RTX A4000
True
True
Currently evaluating -------------------------------:
Monday, 18. December 2023 06:18PM
CPUs: 6, GPUs: 1 on deatcs001fc106.
GPU : NVIDIA RTX A4000
Traceback (most recent call last):
  File "benchmark/Semsim_train_evaluation.py", line 276, in <module>
    feature_dis = evaluate_semsim()
  File "benchmark/Semsim_train_evaluation.py", line 190, in evaluate_semsim
    loss_fn, trainloader, validloader, reidloader = preprocess(opt, defs, valid=False)
  File "./benchmark/comm.py", line 370, in preprocess
    loss_fn, _, _, _ = inversefed.construct_dataloaders('human_anno_id', defs, opt.rec_data_dir, opt = opt)
  File "./inversefed/data/data_processing.py", line 47, in construct_dataloaders
    trainset, validset, recset = _build_human_anno_id(path, rec_data_dir, defs.augmentations, normalize, opt)
  File "./inversefed/data/data_processing.py", line 214, in _build_human_anno_id
    trainset = RE_ID_Tri_All_Data(data_path +  '/train_with_ori', transform=transforms.ToTensor())
  File "./inversefed/data/re_id_dataset_cross_tri.py", line 12, in __init__
    self.classes = sorted([d.name for d in os.scandir(root_dir) if d.is_dir()])
FileNotFoundError: [Errno 2] No such file or directory: '../../../data/human_anno_id/train_with_ori'
nidham-sony commented 10 months ago

Moreover, the file metrics/data.txt is missing as I get this bug

(semsim) chgazagn@deatcs001fc106:~/sony/projects/SemSim$ python metrics/models_rank_corr.py 
Traceback (most recent call last):
  File "metrics/models_rank_corr.py", line 110, in <module>
    data = np.loadtxt('metrics/data.txt')
  File "/home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/numpy/lib/npyio.py", line 1338, in loadtxt
    arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
  File "/home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/numpy/lib/npyio.py", line 975, in _read
    fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
  File "/home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/numpy/lib/_datasource.py", line 193, in open
    return ds.open(path, mode, encoding=encoding, newline=newline)
  File "/home/EU/chgazagn/miniconda3/envs/semsim/lib/python3.8/site-packages/numpy/lib/_datasource.py", line 533, in open
    raise FileNotFoundError(f"{path} not found.")
FileNotFoundError: metrics/data.txt not found.