相关代码:"Unlearnable Clusters: Towards Label-agnostic Unlearnable Examples",CVPR2023。
首先,运行 preprocess.py 来重命名数据集目录
python preprocess.py --config config/preprocess.yaml -f rename
第二步,运行 preprocess.py 进行 K-means 初始化。
python preprocess.py --config config/preprocess.yaml -f cluster_pets_rn50_cluster10
# 聚类文件将保存在 {output_dir}/{dataset}_{surrogate_model}_cluster{num_clusters}.pth
# 例如:output/cluster/pets_rn50_cluster10.pth
第三步,运行 main.py --stage 1 生成逐聚类扰动。
python main.py --config config/stage_1.yaml -e {experiment} --stage 1
# {experiment} 是 uc_{dataset}_{surrogate_model}
# 例如:python main.py --config config/stage_1.yaml -e uc_pets_cliprn50 --stage 1
最后,运行 main.py --stage 2 来训练目标模型。
python main.py --config config/stage_2.yaml -e {experiment} --stage 2
# {experiment} 是 uc_{dataset}_{surrogate_model}_{target_model}
# 例如:python main.py --config config/stage_2.yaml -e uc_pets_rn50_rn18 --stage 2
如果您觉得本代码对您的研究有帮助,请考虑引用。
@inproceedings{zhang2023unlearnable,
title={Unlearnable Clusters: Towards Label-agnostic Unlearnable Examples},
author={Jiaming Zhang, Xingjun Ma, Qi Yi, Jitao Sang, Yu-Gang Jiang, Yaowei Wang, Changsheng Xu},
booktitle="Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition",
year={2023}
}