Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
Anti-Tamper-Perturbation — [ICCV 2025] 针对未经授权个体图像生成的防篡改保护 | Kitploit
工具/GitHubGitHub/seeyn/anti-tamper-perturbation
隐写术论文与研究学习与教育AI 安全对抗性攻击
GitHubseeyn/anti-tamper-perturbation

Anti-Tamper-Perturbation

[ICCV 2025] 针对未经授权个体图像生成的防篡改保护

查看仓库
61710个月前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

🛡️ 针对未经授权个人图像生成的防篡改保护

ICCV 2025 论文官方代码
📄 针对未经授权个人图像生成的防篡改保护

Page 1 of PDF

⚙️ 环境配置

root@kitploit:~
conda create --name ATP --file requirements.txt
conda activate ATP

🔐 启动 ATP

  1. 下载数据集 CelebA-HQ 和 VGGFace2。数据集链接可在 CelebA-HQ、VGGFace2 中找到。对于授权模型训练,还应下载 FFHQ

  2. 下载 授权模型权重 和引导 掩码

  3. 在 configs/authorization.yaml 中设置 weights 路径,并在 configs/protection.yaml 中设置 mask 路径

  4. 运行

root@kitploit:~
python perturb.py --device cuda:0 --input_dir path_to_cleanData --output_dir path_to_perturbedData --method CAAT --input-mask path_to_mask

我们建议将 CAAT 与 ATP 集成,这能在生成效率和保护性能之间取得良好平衡。但我们也提供了集成 MetaCloak、Anti-DreamBooth 和 AdvDM 的代码。

📁 输出目录结构

root@kitploit:~
output_dir/
├── Authorized/  # Authorized images
|       ├ {id}/ # Authorized images separated by id
|       ├ Authorization_messages/ # Authorization messages for each image
└── ATP_{method}/     # Protected Images by ATP+{method}
         ├ {id}/ # ATP Perturbed images separated by id

🔍 验证

  1. 在 configs/verification.yaml 中设置 weights 路径

  2. ✅ 无净化:运行

root@kitploit:~
cd authorization
python verify.py --message_dir path_to_authorization_messages  --input_dir path_to_atp_protected_image --method CAAT
  1. 🔓 在净化条件下
  • 朴素变换:运行
root@kitploit:~
cd authorization
python verify.py --message_dir path_to_authorization_messages  --input_dir path_to_atp_protected_image --method CAAT --noise-args 2 --noise-type Resize
root@kitploit:~
cd authorization
python verify.py --message_dir path_to_authorization_messages  --input_dir path_to_atp_protected_image --method CAAT --noise-args 70 --noise-type JPEG
  • 高级净化:GridPure
  1. 首先运行 GridPure
  2. 运行
root@kitploit:~
cd authorization
python verify.py --message_dir path_to_authorization_messages  --input_dir path_to_atp_protected_image --method GridPure

示例输出:

root@kitploit:~
Average Bit-Error: 0.44984375 Unauthorized image Ratio: 1.0 Pass Verification Identity Num: 0

"Pass Verification Identity Num" 可用于计算保护成功率(PSR)。一旦发生净化且身份无法通过验证,我们便将其视为一次成功的保护。

🧑‍🎨 生成

如果图像通过验证,它们便可被用于生成。

  1. ✅ 无净化:运行
root@kitploit:~
 cd generation
 python generate.py --input_dir path_to_image_for_generation --method CAAT --device cuda:0

结果保存在 "DREAMBOOTH" 目录中。

  1. 🔓 在净化条件下

尽管在我们的实验中,净化后的图像因完全无法通过验证而未用于生成,我们仍然提供了基线算法的代码以方便比较。

对于 JPEG 和 Resize,运行:

root@kitploit:~
 cd generation
 python generate.py --input_dir path_to_image_for_generation --method CAAT --device cuda:0 --purification naive

对于 Gridpure,您需要先运行 GridPure,然后使用净化后的图像运行:

root@kitploit:~
 cd generation
 python generate.py --input_dir path_to_image_for_generation --method CAAT --device cuda:0 --purification gridpure

🧾 指标计算

  1. 从 celebahq、vggface 下载 ID 嵌入。

  2. 修改 ./configs/metrics.yaml 中定义的设置。您需要定义待评估图像的路径(instance_dir)、用于存储评估结果记录文件的目录路径(output_dir)、用于生成的提示词以及 ID 嵌入路径(id_emb_path)。

  3. 从 url 下载 LIQE.pt。将其放置到 ./metrics/LIQE/checkpoints

root@kitploit:~
 cd metrics
 python eval_dir.py --dataset CelebA-HQ --method CAAT

评估结果将保存在您在 metrics.yaml 中定义的 output_dir 中

root@kitploit:~
 python show.py --path evaluation_results

示例输出:

root@kitploit:~
CLIP-IQAC       LIQE            ISM             FDFR             PSR
-0.176525       1.033371        0.489084        0.406250        0.859375

(通过修改 eval_dir.py 代码中第 67 行到第 68 行(已注释),您还可以评估来自朴素变换的净化生成结果。)

📈 训练

您也可以训练自己的授权模型。

修改 ./configs/authorization.yaml 中的设置

root@kitploit:~
cd authorization

bash scripts/train.sh 

📚 致谢

在构建此项目时,我们借鉴了以下项目的代码:LIQE、GridPure、ANTIDB、METACLOAK、CAAT、HiDDeN、BasicSR。

感谢他们的出色工作!

📌 如果您觉得此项目对您的研究有用,请考虑引用我们的论文。

© 2025 伊利诺伊大学董事会。保留所有权利。

下载工具
ArgumentDescriptionExample
--device决定在哪个 GPU 上运行模型cuda:0, cuda:1
--input_dir干净输入图像的路径./data/clean/
--output_dir保存扰动图像的路径./data/perturbed/
--method保护扰动方法CAAT, ANTIDB, ADVDM,METACLOAK
--input-mask掩码的路径./mask/050_mask.pt
ArgumentDescriptionExample
--message_dir_dir授权消息目录的路径./data/Authorization_messages
--input_dir待验证图像的路径./data/perturbed/
--method保护扰动方法CAAT, ANTIDB, ADVDM,METACLOAK
--noise-args保护扰动方法2, 50
--noise-type保护扰动方法JPEG, Resize
ArgumentDescriptionExample
--dataset用于评估的数据集CelebA-HQ, VGGFace2
--method保护扰动方法CAAT, ANTIDB, ADVDM,METACLOAK