🚀 DeepClip: Region-Aware Face Forgery Artifact Description
DeepClip is CLIP for deepfakes: a face forgery detector whose image embeddings are aligned with CLIP text embeddings. Besides telling whether a face is fake, it describes where and what kind of forgery it sees, in the same words it was trained on (e.g. "a photo of a fake face with blending artifacts in the mouth.").
💡 What DeepClip Predicts
DeepClip scores a face image against CLIP text captions and returns two things:
- Fake probability:
1 - p_real, wherep_realis the score of the caption "a photo of a real face." - Artifact scores: 4 regions × 5 artifact types = 20 captions such as "a photo of a fake face with blending
artifacts in the mouth.", each a probability in
[0, 1].
| Values | |
|---|---|
| Region | face, eyes, nose, mouth |
| Artifact type | blur, color, texture, structure, blend |
The 20 artifact scores laid out as a 4 × 5 artifact map (region × type). The darker the cell, the closer the face is to that (region, type) caption.
🏛️ Architecture
DeepClip combines the MS-Eff-GCViT image encoder of DeepGuard, a hybrid CNN-ViT that catches both local and global forgery traces, with the frozen text encoder of CLIP. Only the image encoder is trained: it learns to place each face next to the caption that describes its forgery.
🔄 Training & Inference
- (1) Caption-supervised training: every fake face gets a caption built from one (region, artifact type) pair
sampled from its
pair_label. The trainable image encoder is aligned with the frozen CLIP text embeddings with a multi-positive sigmoid loss (SigLIP). The 21 caption embeddings are computed once and kept in a table, so the text encoder is not run during training. - (2) Real/fake scoring and artifact map: at test time, the similarity to "a photo of a real face." gives the fake probability, and the similarity to the 20 region–artifact captions gives the artifact map.
🤗 Live Demo
| 📝 Face Forgery Artifact Description | 🔍 Detection Explainability (XAI) |
|---|---|
| Upload a face → verdict, CLIP caption and 4 × 5 artifact map | Grad-CAM maps of the DeepGuard detector |
🧬 Model Zoo
| Mode | Model Name | Resolution | Image Encoder | Text Encoder | Contrastive Embedding Dim | Params (M) | FLOPs (G) |
|---|---|---|---|---|---|---|---|
| ⚡ Fast | deepclip_b0 | 224×224 | ms_eff_gcvit_b0 | CLIP ViT-B/16 (frozen) | 512 | 8.82 | 0.83 |
| 🔥 Pro | deepclip_b5 | 384×384 | ms_eff_gcvit_b5 | CLIP ViT-L/14 (frozen) | 768 | 50.61 | 13.26 |
📈 In-Domain Evaluation
Trained and tested on FaceForensics++.
| Model | Test@AUC | Test@Accuracy | Test@Log Loss | Test@Macro F1 |
|---|---|---|---|---|
| ⚡ deepclip_b0 | 0.9917 | 96.33% | 0.0959 | 0.9396 |
| 🔥 deepclip_b5 | 0.9935 | 98.08% | 0.0739 | 0.9672 |
📈 Cross-Domain Evaluation (Trained on FaceForensics++)
Generalization to datasets not seen during training.
Celeb-DF (v2)
| Model | Test@AUC | Test@Accuracy | Test@Log Loss | Test@Macro F1 |
|---|---|---|---|---|
| ⚡ deepclip_b0 | 0.6821 | 61.97% | 0.8823 | 0.6147 |
| 🔥 deepclip_b5 | 0.7674 | 74.13% | 0.7455 | 0.7162 |
KoDF
| Model | Test@AUC | Test@Accuracy | Test@Log Loss | Test@Macro F1 |
|---|---|---|---|---|
| ⚡ deepclip_b0 | 0.7726 | 68.83% | 1.5238 | 0.6791 |
| 🔥 deepclip_b5 | 0.8277 | 71.75% | 1.6868 | 0.7072 |
Video-level results with
num_frames=20andagg_mode="conf". The final fake probability of a video ismax(prob, S_art), whereS_artis the sigmoid of the mean of the top-3 artifact logits (test_deepclip.py).
🚀 Model Usage
pip install "deepclip[detect]>=1.1.0" transformers
[!NOTE] This model is gated because it was trained on FaceForensics++. Accept the terms on this page and log in with
hf auth loginbefore the first download.
from transformers import pipeline
🖼️ Image Classification
clf = pipeline(
"image-classification",
model="KoreaPeter/deepclip_b5",
trust_remote_code=True,
)
# ── Basic Inference ───────────────────────────────────────────────
result = clf("face.jpg")
# [{'label': 'fake', 'score': 0.9712}, {'label': 'real', 'score': 0.0288}]
# ── Artifact Scores ───────────────────────────────────────────────
result = clf("face.jpg", return_artifacts=True)
# [{'label': 'fake', 'score': 0.9712},
# {'label': 'real', 'score': 0.0288},
# {'artifacts': {'face': {'blur': 0.12, 'color': 0.08, 'texture': 0.21, 'structure': 0.05, 'blend': 0.64},
# 'eyes': {...}, 'nose': {...}, 'mouth': {...}}}]
# ── Custom Parameters ─────────────────────────────────────────────
result = clf(
"face.jpg",
margin_ratio=0.2, # Margin ratio around the detected face bbox (default: 0.2)
conf_thres=0.5, # Confidence threshold for YOLO face detection (default: 0.5)
min_face_ratio=0.01, # Minimum face-to-frame area ratio to process (default: 0.01)
tta_hflip=0.0, # Probability of horizontal flip for TTA (default: 0.0)
top_k=1, # Number of top labels to return (default: all)
return_artifacts=True, # Append the 20 artifact scores (default: False)
)
🎬 Video Classification
clf = pipeline(
"video-classification",
model="KoreaPeter/deepclip_b5",
trust_remote_code=True,
)
# ── Basic Inference ───────────────────────────────────────────────
result = clf("video.mp4")
# [{'label': 'fake', 'score': 0.9634}, {'label': 'real', 'score': 0.0366}]
# ── Custom Parameters ─────────────────────────────────────────────
result = clf(
"video.mp4",
num_frames=20, # Number of frames to sample (default: 20)
margin_ratio=0.2, # Margin ratio around the detected face bbox (default: 0.2)
conf_thres=0.5, # Confidence threshold for YOLO face detection (default: 0.5)
min_face_ratio=0.01, # Minimum face-to-frame area ratio to process (default: 0.01)
tta_hflip=0.0, # Probability of horizontal flip for TTA (default: 0.0)
agg_mode="conf", # Aggregation mode: 'conf' | 'mean' | 'vote' (default: 'conf')
return_frame_scores=True, # Return per-frame scores (default: False)
return_artifacts=True, # Append the 20 artifact scores, mean over the frames (default: False)
)
# [{'label': 'fake', 'score': 0.9634},
# {'label': 'real', 'score': 0.0366},
# {'frame_scores': [0.97, 0.95, 0.98, ...], 'agg_mode': 'conf'},
# {'artifacts': {'face': {...}, 'eyes': {...}, 'nose': {...}, 'mouth': {...}}}]
When no face is found, both pipelines return [{'label': 'no_face_detected', 'score': -1.0}].
🤝 Citation
@misc{deepclip2026,
title = {DeepClip: Region-Aware Face Forgery Artifact Description with Contrastive Language-Image Pre-training},
author = {seoyunje},
year = {2026},
url = {https://github.com/SEOYUNJE/DeepClip}
}