Downloads · 30 days
0
ManhQuangAI/anti-deepfake-dinov3-coursework
anti-deepfake-dinov3-coursework is a image classification model from ManhQuangAI. Use it when you need a label for an image. It is set up for custom. The card lists the license as other.
Bộ weight phục vụ đồ án phát hiện deepfake (ảnh): 2 backbone pretrained (chưa finetune), 2 model finetune (ViT-Plus A0, ConvNeXt) và 1 bản sampler-improve (ViT-Plus A1). Tất cả được huấn luyện / đánh giá với transform…
Downloads · 30 days
0
Access
Public
Updated Sep 2, 2026
Repo size
568 MB
Likes
1
Public
Click a slice to open those files.
.pt342 MB · 60%
From the Hugging Face model README
Bộ weight phục vụ đồ án phát hiện deepfake (ảnh): 2 backbone pretrained (chưa finetune), 2 model finetune (ViT-Plus A0, ConvNeXt) và 1 bản sampler-improve (ViT-Plus A1). Tất cả được huấn luyện / đánh giá với transform chuẩn Resize 256 → ImageNet mean/std, fp32. Code huấn luyện & đánh giá: github.com/QuangManhAI/deepfake-ViT.
| Checkpoint | Mô tả | Số params | File |
|---|---|---|---|
pretrained/dinov3-vits16plus/model-3.safetensors | DINOv3 ViT-S/16+ pretrained (LVD-1689M), không head | 28,69M | ~115 MB |
pretrained/dinov3-convnext/model-2.safetensors | DINOv3 ConvNeXt pretrained (LVD-1689M), không head | 27,82M | ~111 MB |
finetuned/vit-plus-a0/plus_v3_best.pt | ViT-Plus A0 finetune (sampler mặc định) | 28,69M | ~115 MB |
finetuned/vit-plus-a1-sampler/plus_v3_s1_best.pt | ViT-Plus A1 finetune, sampler weak-family (8 method yếu) | 28,69M | ~115 MB |
finetuned/convnext/convnext_weakfix_v3.pt | ConvNeXt finetuned | 28,12M (bb 27,82M + head 0,30M) | ~113 MB |
Head nhỏ: ViT head = Linear 384→2 (+770 tham số); ConvNeXt head ≈ 0,30M tham số.
Cùng test, fp32 MPS. Dòng "pretrained (probe)" = backbone đông cứng + linear probe
LogisticRegression(class_weight='balanced') trên 123.582 ảnh train — dùng để định lượng
sức mạnh feature sẵn có.
| Model | acc% | prec | rec | f1 | AUC | real_acc | fake_rec |
|---|---|---|---|---|---|---|---|
| ViT-S/16+ pretrained (probe) | 89,47 | 88,86 | 90,25 | 89,55 | 0,9624 | 88,69 | 90,25 |
| ConvNeXt pretrained (probe) | 87,77 | 89,62 | 85,44 | 87,48 | 0,9553 | 90,11 | 85,44 |
| ViT-Plus A0 finetune | 97,91 | 98,05 | 97,77 | 97,91 | 0,9979 | 98,05 | 97,77 |
| ViT-Plus A1 finetune (sampler yếu) | 98,47 | 97,94 | 99,02 | 98,48 | 0,9986 | 97,92 | 99,02 |
| ConvNeXt finetuned | 99,22 | 99,79 | 98,64 | 99,21 | 0,9998 | 99,79 | 98,64 |
faceswap, deepfake_faceswap, wav2lip, sadtalker, fsgan, facedancer, inswap, mobileswap.Các file là weight thô của dự án (không phải chuẩn transformers). Load bằng loader
trong repo code:
import sys; sys.path.insert(0, "path/to/deepfake-ViT")
from src.models.dinov3_vit import load_dinov3 # backbone ViT
from src.models.dinov3_convnext import load_dinov3_convnext # backbone ConvNeXt
import torch, torch.nn as nn
# 1) Backbone pretrained (không head)
bb = load_dinov3("pretrained/dinov3-vits16plus/model-3.safetensors", img_size=256)
bb = load_dinov3_convnext("pretrained/dinov3-convnext/model-2.safetensors")
# 2) Model finetune: state_dict có khóa backbone.* / head.*
class Cls(nn.Module):
def __init__(self, backbone):
super().__init__()
self.backbone = backbone
self.head = nn.Linear(backbone.embed_dim, 2)
def forward(self, x):
return self.head(self.backbone(x))
model = Cls(load_dinov3("models/dinov3-vits16plus-pretrain-lvd1689m/model-3.safetensors",
img_size=256)) # ViT-S/16+ làm backbone nền
ck = torch.load("finetuned/vit-plus-a1-sampler/plus_v3_s1_best.pt",
map_location="cpu", weights_only=False)
model.load_state_dict(ck["state_dict"]) # A0 dùng cùng khóa này
Preprocessing khi eval/huấn luyện (khớp mọi số liệu trên): Resize((256, 256)),
ToTensor(), Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]).
README.md
pretrained/
dinov3-vits16plus/ model-3.safetensors · config-3.json · preprocessor_config.json
dinov3-convnext/ model-2.safetensors · config-2.json · preprocessor_config.json
finetuned/
vit-plus-a0/ plus_v3_best.pt # A0 (sampler mặc định)
vit-plus-a1-sampler/ plus_v3_s1_best.pt # A1 (sampler weak-family)
convnext/ convnext_weakfix_v3.pt # ConvNeXt finetuned
.pt dùng weights_only=False để đọc (lưu từ torch 2.x); chúng chỉ chứa
state_dict.