Inspiration

In an era where generative AI can create hyper-realistic fake images in seconds, the line between reality and fabrication is blurring. We were alarmed by the rising misuse of deepfakes for misinformation, identity theft, and harassment.

Most current solutions focus on detection—flagging an image as fake after it has already spread. We wanted to shift the paradigm to prevention. Inspired by the 2025 paper "Defending Deepfake via Texture Feature Perturbation" by Zhang et al., we asked ourselves: What if an image could defend itself?

We set out to build Vaxel, a tool that "vaccinates" personal photos with imperceptible noise that disrupts deepfake models without degrading visual quality for human viewers.

What it does

Vaxel is a desktop application that proactively protects your images.

Ingestion: Users upload a photo via drag-and-drop or capture one directly via webcam.

Vaccination: The engine analyzes the image's texture features and injects a mathematically calculated adversarial perturbation. To the human eye, the image looks identical. To a Deepfake AI (like StarGAN), the image contains chaotic noise that breaks the generation process.

Verification: The app includes a built-in "Attack Tester." It runs a local StarGAN attack on both the original and the protected image side-by-side, proving to the user that the protection actually works (verifying that the attack fails on the vaccinated image).

How we built it

We utilized a hybrid architecture leveraging Tauri v2, Rust, Python, and Next.js.The Core Engine (Python & PyTorch):

We implemented the Texture Feature Perturbation (TFP) algorithm. We used a ResNet-50 backbone with Grad-CAM to generate attention maps ($M_{att}$), identifying which regions of the face are most critical for texture.

We then extract texture features using Local Binary Patterns (LBP) and pass them through an encoder-decoder network to generate the perturbation noise $\delta$.$$x_{adv} = x + \epsilon \cdot \delta$$Where $\epsilon$ controls the intensity (Protection Level).

The Desktop Shell (Rust & Tauri):We used Tauri to wrap the application. The Rust backend orchestrates the lifecycle of the Python engine. We compiled the Python environment into a standalone binary sidecar using PyInstaller, allowing the app to run without the user needing to install Python or CUDA manually.

The UI (Next.js & Tailwind):The frontend provides a sleek, dark-mode interface. It communicates with the Rust backend via Tauri's IPC to stream progress updates (STATUS, PROGRESS, SUCCESS) in real-time.

Cloud Infrastructure (Modal):For users without powerful GPUs, we deployed the Python inference code to Modal, creating a serverless GPU endpoint that scales on demand.

Challenges we ran into

Packaging Python for Distribution: One of the hardest parts was bundling the Python ML engine (with heavy dependencies like torch, scikit-image, and cv2) into a single binary that could run on a user's machine. We had to write a custom build_binary.sh script to handle hidden imports and dynamic libraries for PyInstaller.

Cross-Process Communication: Synchronizing state between the React frontend, the Rust main process, and the Python sidecar was tricky. We implemented a line-based stdout protocol where the Python engine emits JSON payloads that Rust parses and forwards to the frontend event loop.

Balancing Quality vs. Protection: Finding the right epsilon ($\epsilon$) value was difficult. Too high, and the image looks grainy; too low, and the deepfake model breaks through. We solved this by adding a "Protection Level" selector (Low, Medium, High) so users can make their own trade-off.

Accomplishments that we're proud of

Privacy-First Design: We are incredibly proud of the Local Mode. By bundling the engine, users can protect their sensitive personal photos without the data ever leaving their device.

The "Attack Tester": It’s one thing to say an image is protected; it’s another to show it. We successfully integrated a pre-trained StarGAN model into the app, allowing users to verify the "vaccine" effectiveness in real-time.

What we learned

Adversarial Machine Learning: We gained a deep understanding of how GANs (Generative Adversarial Networks) rely on texture statistics and how easily they can be disrupted by high-frequency noise.

Tauri v2: We learned the intricacies of the new Tauri v2 API, specifically the plugin system for file system access and shell command execution.

Systems Engineering: Orchestrating a full-stack desktop app that bundles a heavy ML runtime taught us valuable lessons in build pipelines and resource management.

What's next for Vaxel

Broader Defense: Currently, we optimize against StarGAN. We plan to implement defenses against diffusion-based models (like Stable Diffusion + LoRA) and face-swappers (like Roop).

Video Support: Expanding the pipeline to process video frames batch-by-batch to protect users from deepfake videos, not just static images.

Mobile Port: Since the architecture relies on a separated frontend and cloud backend, we plan to port the UI to React Native to offer a mobile version of Vaxel.

Built With

Share this project:

Updates