冬
gcw_IDzXRVNw/CommunityForensics-DeepfakeDet-ViT-ascend
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

CommunityForensics-DeepfakeDet-ViT-ascend

Deepfake detection model adapted for Ascend NPU.

Model Info

  • Base Model: CommunityForensics-DeepfakeDet-ViT
  • Task: Deepfake detection (binary classification)
  • Architecture: ViT-small (12 layers, hidden_size=384, 12 heads)
  • Parameters: 35.99M
  • Input: RGB images (384x384)
  • Output: [authentic_prob, fake_prob]

Performance

  • Inference Time: ~0.28s per batch (batch_size=2)
  • NPU Memory: ~135MB allocated

Usage

from inference import ViTForImageClassification, load_model_info
import torch

model_path = "/path/to/CommunityForensics-DeepfakeDet-ViT"
device = "npu:0"

config, _ = load_model_info(model_path)
model = ViTForImageClassification(config)
model.load_weights(f"{model_path}/model.safetensors")
model = model.to(device)

images = torch.randn(2, 3, 384, 384).to(device)
logits = model(images)

Output Format

The model outputs logits of shape (batch_size, 2):

  • [:, 0]: Authentic image probability
  • [:, 1]: Fake/合成图像概率

Notes

  • Model uses sigmoid activation for probability output
  • Preprocessing: ImageNet normalization (mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])