DeMamba (X-CLIP + Mamba) trained on GenVideo-100K

A checkpoint of XCLIP_DeMamba for detecting AI-generated video (real vs. fake), trained by us on GenVideo-100K using a single-GPU adaptation of the official DeMamba code.

These are our own trained weights, not the official release from the DeMamba authors.

Files

File Description
best_acc.pth Best checkpoint by validation accuracy (epoch 15 of 30). A dict: {"epoch": int, "model_state_dict": ...}
FULL_val_metrics.txt Metrics on the full GenVideo validation set (~18K videos)
configs/XCLIP_DeMamba.yaml Training config
eval_demamba_standalone.py Self-contained evaluation script (raw videos in, metrics out)

Results (full GenVideo validation set)

Metric Value
Accuracy 88.74%
AUC 96.67%
AP 96.28%
Real recall (1 − FPR), n=10,000 0.8316

Per generator:

Generator Recall AP n
Crafter 0.9964 0.9347 1398
Gen2 0.9978 0.9411 1380
HotShot 0.9643 0.7316 700
Lavie 0.9200 0.7628 1400
ModelScope 0.9786 0.7774 700
MoonValley 1.0000 0.8895 626
MorphStudio 0.9857 0.8150 700
Show_1 0.9043 0.6035 700
Sora 0.9107 0.2071 56
WildScrape 0.8193 0.6546 924

Training setup

  • Model: X-CLIP-base-patch16 vision encoder + pure-PyTorch Mamba temporal head (XCLIP_DeMamba), full fine-tuning (tuning_mode: sft)
  • Single 16 GB GPU, bf16 autocast, batch size 4, lr 1e-6, 30 epochs × 4000 batches
  • Model selection on a 3K-video validation subset; final numbers above are on the full validation set
  • Frames sampled at 2 fps (clips ≥ 4 s) or ceil(8 / length) fps otherwise

Input preprocessing

  • 8 consecutive sampled frames per clip (zero-padded if fewer)
  • Frames in RGB order; at evaluation, 10% is center-cropped off each side of the longer dimension
  • Each frame resized to 224×224, normalized with ImageNet mean (0.485, 0.456, 0.406) / std (0.229, 0.224, 0.225)
  • eval_demamba_standalone.py in this repo does all of this from raw video files

Usage

Evaluate on a folder of videos (easiest)

eval_demamba_standalone.py is a single self-contained file (model code + video preprocessing + metrics). It downloads best_acc.pth from this repo; the checkpoint already includes the fine-tuned X-CLIP encoder.

pip install torch "transformers>=4.30" opencv-python numpy pandas scikit-learn huggingface_hub tqdm
python eval_demamba_standalone.py --data_root /path/to/GenVideo-Val --out_dir results

Labels are read from folder names (real/… → 0, fake/<Generator>/… → 1), or pass --csv with path,label[,generator] columns. It writes predictions.csv and metrics.txt.

Load the weights with the original DeMamba repo

Requires the DeMamba model code (models/DeMamba.py, models/mamba_base.py) and the X-CLIP-base-patch16 vision weights. XCLIP_DeMamba reads the X-CLIP path from the DEMAMBA_XCLIP_PATH environment variable.

The checkpoint was saved from a torch.nn.DataParallel wrapper, so every key starts with module.:

import torch
from models import XCLIP_DeMamba

model = XCLIP_DeMamba()
state = torch.load("best_acc.pth", map_location="cpu", weights_only=False)
sd = {k.removeprefix("module."): v for k, v in state["model_state_dict"].items()}
model.load_state_dict(sd)
model.eval()

Limitations

  • About 17% of real videos are flagged as fake at the default threshold.
  • Weak AP on Sora (only 56 validation videos), Show_1, and in-the-wild scraped videos.
  • Trained on general AI-generated video, not specifically on face-swap deepfakes.

Citation

If you use these weights, please cite the original DeMamba / GenVideo paper:

@article{DeMamba,
  title={DeMamba: AI-Generated Video Detection on Million-Scale GenVideo Benchmark},
  author={Haoxing Chen and Yan Hong and Zizheng Huang and Zhuoer Xu and Zhangxuan Gu and Yaohui Li and Jun Lan and Huijia Zhu and Jianfu Zhang and Weiqiang Wang and Huaxiong Li},
  journal={arXiv preprint arXiv:2405.19707},
  year={2024}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for Ahsanz/DeMamba-GenVideo100K