ALADDIN detector

A binary classifier that flags face swaps produced by ALADDIN, a one-step face-swapping model (paper, accepted to WACV 2027; code). We release it openly so that images generated with our method can be detected. The generator weights will be available only through gated access.

Model

  • Architecture: ConvNeXt-Tiny, initialised from timm convnext_tiny.fb_in22k_ft_in1k. 28M parameters, single logit.
  • Output: sigmoid(logit) is the probability that the image is an ALADDIN swap.
  • Input: a 512ร—512 RGB, FFHQ-style aligned face crop, which is the format ALADDIN outputs. Images of other sizes are resized to 512 with bilinear interpolation.

Quick start

Install the dependencies:

pip install torch "timm>=1.0.16" pillow
pip install facexlib opencv-python   # only for --align

Score one aligned 512ร—512 face crop in Python:

import timm, torch
from PIL import Image

model = timm.create_model("hf-hub:Sumsub/aladdin-detector", pretrained=True).eval()
transform = timm.data.create_transform(**timm.data.resolve_data_config({}, model=model))
x = transform(Image.open("face.png").convert("RGB")).unsqueeze(0)
p_swap = torch.sigmoid(model(x)).item()   # > 0.5 means "ALADDIN swap"; tune the threshold on your own data

Score whole folders with the command-line script. Download it from this repository first (hf comes with huggingface_hub; on versions older than 0.34 use huggingface-cli download):

hf download Sumsub/aladdin-detector infer.py align.py --local-dir aladdin-detector
cd aladdin-detector

# aligned 512x512 face crops
python infer.py aligned_crops/ --out scores.csv

# arbitrary photos: detect and align the largest face first
python infer.py photos/ --align --out scores.csv

--align detects the largest face and aligns it exactly as ALADDIN does: facexlib RetinaFace-R50 and the FFHQ 512 five-point template, implemented in align.py. The face detector weights are downloaded automatically on first use. Images without a detectable face get an empty score.

The output CSV has the columns path, logit and p_swap.

Limitations and intended use

  • ALADDIN only. It detects ALADDIN swaps specifically and is not a general deepfake detector. Other generators, and post-processing with neural face enhancers (GPEN, CodeFormer), are untested.
  • Intended use: research, and supporting moderation of synthetic media. It is not sole evidence about a person or an image.

License

CC BY-NC-SA 4.0, following the license of the FFHQ dataset used for training.

Citation

@article{shchekotov2026aladdin,
  title   = {Adversarial Latent Diffusion Distillation for One-Step Identity Swapping},
  author  = {Shchekotov, Ivan and Gritsaev, Timofei and Pirogov, Viacheslav and Vetrov, Dmitry},
  journal = {arXiv preprint arXiv:2610.37503},
  year    = {2026}
}
Downloads last month
-
Safetensors
Model size
27.8M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Paper for Sumsub/aladdin-detector