Machine learning · Graduate course project · 2025
Adversarial attacks on a fine-tuned face recognition model
An interactive demo that attacks a fine-tuned FaceNet model with FGSM and PGD perturbations. Pick a face, set epsilon, and watch the noise, the perturbed image and the new prediction.
A working Next.js and FastAPI demo of FGSM and PGD attacks on a face recognition model, with the noise, the perturbed image and the prediction shown side by side.
- Role
- Full-stack and ML
- Stack
- Next.js · TypeScript · Tailwind CSS · FastAPI · PyTorch · facenet-pytorch
- Links
- Code >

This was a team project for a collaborative research course. We fine-tuned a face recognition model on photos of our own team and then built a demo to show how easily it can be fooled.
The model is an InceptionResnetV1 (FaceNet) pretrained on VGGFace2. It turns a face into a 512-dim embedding, and the backend predicts the identity of the nearest training embedding by Euclidean distance. The FastAPI backend implements two attacks: FGSM, a single step along the sign of the gradient, and PGD, which repeats that step and projects the perturbation back inside an epsilon bound.
The Next.js frontend lets you upload a face, set epsilon, switch attacking on or off, and choose the attack. It shows the attack noise, the final image and the predicted identity side by side. The backend code is at poisoning_face_recognition_backend.