Paper: FedVideoMAE: Efficient Privacy-Preserving Federated Video Moderation
This project adapts the pMAE paradigm of "parameter-efficient + reconstructive prompt + server-side reconstruction/fine-tuning" to the video domain, based on VideoMAE for self-supervised pretraining, and performs federated evaluation (linear probing/small head fine-tuning) on RWF-2000. It can be smoothly extended to similar datasets like RLVS, HockeyFight, UCF-Crime, etc.
If you find this project useful in your research, please consider citing our paper:
@article{tao2025fedvideomae,
title = {FedVideoMAE: Efficient Privacy-Preserving Federated Video Moderation},
author = {Tao, Ziyuan and Xu, Chuanzhi and Jayawardana, Sandaru and Bao, Wei and Thilakarathna, Kanchana and Lim, Teng Joon},
journal = {arXiv preprint arXiv:2512.18809},
year = {2025}
}- Federated self-supervised pretraining (FedAvg, parameter-efficient: LoRA + reconstructive prompt)
- Client-side: Only train PEFT parameters (LoRA, Prompt, small head), freeze backbone
- Server-side: Aggregate parameters, optional "server-side reconstruction/fine-tuning" for prompt or head alignment
- Evaluation:
- Linear probing (freeze backbone + federated training of linear head)
- Small head fine-tuning (freeze backbone + federated fine-tuning of small head with few parameters)
- Dataset: RWF-2000 (extensible to other datasets)
Recommended Python 3.9
Quick installation:
pip install -r requirements.txtThe requirements.txt provides minimum dependencies. If you already have local repositories (like VideoMAE/, pMAE/), you don't need to install them.
Organize your RWF-2000 dataset as follows:
RWF-2000/
├── train/
│ ├── Fight/
│ │ └── *.avi
│ └── NonFight/
│ └── *.avi
└── val/
├── Fight/
│ └── *.avi
└── NonFight/
└── *.avi
The dataset contains training and validation splits, with each split containing two categories: Fight (violent behavior) and NonFight (non-violent behavior). Video files are in AVI format.
Pre-partition client data (IID/non-IID):
python -m FedVideomae_DP.data.partition \
--data_root /your/data/RWF-2000 \
--out_json partitions/rwf2000_iid_10c.json \
--num_clients 10 --strategy iidUpdate data.root and data.partitions paths in configs/*rwf2000.yaml to point to your actual paths.
python -m FedVideomae_DP.train.fl_pretrain \
--config configs/pretrain_rwf2000.yamlpython -m FedVideomae_DP.train.central_linear_probe \
--config configs/linear_probe_rwf2000_epsilon_1.yamlThe provided config points to a specific pretrained checkpoint. Duplicate and edit it to match your run (e.g., epsilon target, checkpoint path, output_dir).
- Federated small-head fine-tuning (use your fine-tune config with a federated block):
python -m FedVideomae_DP.train.fl_fine_tuning \
--config <your_federated_finetune_config>.yaml- Central small-head fine-tuning (weak head):
python -m FedVideomae_DP.train.central_weak_finetune \
--config configs/central_weak_finetune_rwf2000.yamlTypical classification evaluation with threshold scan and TTA, without extra outputs:
python -m FedVideomae_DP.train.evaluate \
--config configs/evaluate_small_head_rwf2000.yaml \
--model_type small_head \
--threshold_scan \
--scan_metric f1_macro \
--tta_hflip \
--temporal_clips 3 \
--deterministic_temporal- Omit
--output_dir,--visualize, and--extract_featuresto use defaults and skip visuals/features. - To fix the decision threshold manually, pass
--threshold 0.50(overrides scan). - To re-compute metrics at the best scanned threshold, add
--apply_best_threshold.
For reconstruction evaluation on a pretrained model:
python -m FedVideomae_DP.train.evaluate \
--config configs/evaluate_small_head_rwf2000.yaml \
--model_type pretrainedpython -m FedVideomae_DP.train.analyze_features \
--feature_path evaluation_results/features.pth \
--output_dir feature_analysis- Parameter Efficiency (PEFT): Insert LoRA into attention/MLP linear layers, train only small parameters, reducing communication/privacy leakage risks.
- Reconstructive Prompt: Inject learnable prompt tokens during self-supervised reconstruction to assist masked video block reconstruction.
- Server-side Reconstruction/Fine-tuning: Server maintains (aggregated) prompts/small heads, optionally performs reconstruction/consistency fine-tuning on small public buffer to align cross-client feature spaces.
FedVideomae_DP/
configs/ # Configuration files
data/ # Data loading and preprocessing
fl/ # Federated learning components
models/ # Model definitions and wrappers
train/ # Training and evaluation scripts
scripts/ # Utility scripts
To verify your environment setup:
python scripts/check_env.pyThis will print versions of key libraries and basic introspection of the Transformers VideoMAE API.
- By default uses HuggingFace
VideoMAEForPreTrainingas backbone; will automatically download weights on first run (can setmodel_name). - If running environment cannot connect to internet or you don't want automatic downloads, set
model_name: nullin config and provide local weight path, or only use feature mode (avoid pretraining). - Initial version is a runnable baseline skeleton, easy to extend as needed (e.g., RLVS, HockeyFight, UCF-Crime).
configs/pretrain_rwf2000.yaml— Federated pretraining configurationconfigs/linear_probe_rwf2000_epsilon_1.yaml— Linear probing (central) example; duplicate and edit for your runconfigs/central_weak_finetune_rwf2000.yaml— Central small-head fine-tuning configurationconfigs/evaluate_small_head_rwf2000.yaml— Evaluation (small-head) example; can also be used with--model_type pretrained
After running evaluation scripts, you'll find:
evaluation_results/- Reconstruction quality metrics and visualizationsfeature_analysis/- Feature distribution analysis and visualizationsruns/- Training logs and model checkpoints

