← all repositories
MadryLab/photoguard

Inoculating images so diffusion models mangle edits

PhotoGuard adds adversarial noise to images so that Stable Diffusion-based editing tools produce unrealistic or unrelated output, raising the cost of malicious manipulation.

689 stars Jupyter Notebook Computer VisionML Frameworks
photoguard
Not currently ranked — collecting fresh signals.
star history

What it does

This research tool protects photos from AI-powered editing by adding adversarial perturbations that corrupt Stable Diffusion outputs. When a diffusion model tries to edit, inpaint, or restyle a treated image, it generates obviously fake or irrelevant results instead of a convincing forgery. The repository provides Jupyter notebooks demonstrating both simple encoder-level attacks and more complex end-to-end diffusion attacks.

The interesting bit

The clever twist is using offense as defense: instead of detecting manipulations after the fact, the project proactively breaks the generative model itself by attacking the image embedding space or the full diffusion process. It is a bit like giving a photo a mild poison pill that only harms the AI trying to digest it.

Key highlights

  • Implements two adversarial immunization strategies: a lightweight encoder attack and a stronger end-to-end diffusion attack
  • Targets both image-to-image translation and inpainting pipelines
  • Ships with an interactive Gradio demo and Colab-ready notebooks
  • Built on top of the Hugging Face diffusers Stable Diffusion stack
  • Accompanies the research paper Raising the Cost of Malicious AI-Powered Image Editing

Verdict

Worth exploring if you study adversarial defenses, deepfake mitigation, or content provenance. If you need a drop-in production API to guard user uploads, this is research code with notebooks, not a finished service.

Frequently asked

What is MadryLab/photoguard?
PhotoGuard adds adversarial noise to images so that Stable Diffusion-based editing tools produce unrealistic or unrelated output, raising the cost of malicious manipulation.
Is photoguard open source?
Yes — MadryLab/photoguard is open source, released under the MIT license.
What language is photoguard written in?
MadryLab/photoguard is primarily written in Jupyter Notebook.
How popular is photoguard?
MadryLab/photoguard has 689 stars on GitHub.
Where can I find photoguard?
MadryLab/photoguard is on GitHub at https://github.com/MadryLab/photoguard.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.