GUARD: the step-by-step breakdown
From Adam Rosler. The thing you commented GUARD for: how to shield your own photos with PhotoGuard, what it does and doesn't do, and the simpler steps that matter more.
What the reel showed
Open image models can repaint everything around a person from one sentence ("a person standing in a prison cell"). MIT researchers (Salman, Khaddaj, Leclerc, Ilyas, Madry; arXiv:2302.06588) built PhotoGuard: tiny changes to the pixels of the person, chosen so the model's encoder sees something close to a flat grey image. We ran it ourselves on a stand-in photo: the shielded photo's edit came back unrealistic (washed out, she no longer fits the scene). Then we shrank it and saved it as a JPEG, and the edit worked again. The authors warn about exactly that.
Shield a photo yourself (about an hour on a laptop CPU, minutes on a GPU)
- Get the code.
git clone https://github.com/MadryLab/photoguard(MIT licence) or use this page'sguard.py, a CPU-friendly version of the official demo (same attack and settings). - Install.
pip install torch diffusers transformersand download the inpainting model (stable-diffusion-v1-5/stable-diffusion-inpaintingon Hugging Face). - Make a mask. A black-and-white image the size of your photo: white over the person you want to protect.
- Run it.
python guard.py photo.png mask.png MODEL_DIR out/. You getimmunized.png(post this one), plus test edits of the original, the shielded photo and a resized-and-JPEG'd copy, so you can see the protection and its limit for yourself. - Check it. Look at
immunized.pngat full size: you may see faint grain on the person. A stronger setting (more steps) protects more and shows more.
What it does and doesn't do
- It is built against one model family (Stable Diffusion 1.x inpainting). Newer or different models may ignore it.
- A crop, a filter, a resize or a re-save can wash it out. Social apps often resize and recompress what you upload.
- So treat it as a speed bump, not a lock. The authors say the real fix is for the companies that make these models to build immunization in.
The steps that matter more
- Keep accounts private and prune who can see your photos: fewer strangers can download them.
- Post fewer clear, full-length, high-resolution photos of yourself and your kids publicly.
- Ask platforms and model makers for built-in protections and for provenance labels (content credentials) on edited images.
- If someone fakes a photo of you: save the evidence, report it to the platform, and in many places it is now a crime.
Sources: Salman et al., arXiv:2302.06588 (2023); github.com/MadryLab/photoguard. Our scripts: guard.py,
latents.py (this page); our run's outputs are kept with the reel's project files.
Files for this breakdown
Unlock the full GUARD breakdown + downloadable runnable scripts
Drop your email once to read the complete step-by-step guide, grab the files, and unlock all 96 Reel breakdowns on this device forever.