DeepFakeDefender_Loader
Load the ensemble, never touch it again
- net
- transform_val
This node does one job and does it quietly: it loads a trained deepfake-detection model so its partner node, DeepFakeDefender_Sampler, can score images. You set it up once, wire its two outputs into the sampler, and then you never think about it again. That's the whole point - it exists so you don't have to write a line of Python to get a pretrained classifier into your graph.
The model it loads is the real deal, not a toy. This pack wraps the 1st-place solution to the Global Multimedia Deepfake Detection competition's Image Track, by the "JTGroup" team (upstream repo: HighwayWu/DeepFakeDefenders). The architecture, MFF_MoE, is a mixture-of-experts ensemble: two ConvNeXt-Tiny backbones, a pair each of EfficientNet-B4 and B5, and one B6, all averaged together. The interesting bit is that inference uses EMA weights - an exponential-moving-average snapshot of each expert (decay 0.995) - which is a training trick that usually generalizes better than the raw weights. The loader pulls both weight.pth (the experts) and ema.state (the moving averages) and combines them, so you don't have to think about which one to use.
The one input
- ckpt_path - a string, default
"DeepFakeDefender". This is a folder name underComfyUI/models/, not a path to a file. The node looks inComfyUI/models/DeepFakeDefender/forweight.pthandema.state, and will even create the folder if it doesn't exist (which only really helps if you downloaded the weights into the wrong place).
That's it. Everything else is handled.
The two outputs
- net - the loaded model, typed as
MODELso it plugs into the sampler'snetinput. - transform_val - typed as
MODELtoo, which is a lie: it's actually a torchvision preprocessing pipeline (ToTensor, ImageNet normalization, resize to 512×512). The author reuses theMODELtype to get a wire through the graph. So when you connect it, you're passing a transform, not a model. It works; it's just not what the socket name implies.
Install
Grab the pack, clone into custom_nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_DeepFakeDefenders.git
Then restart ComfyUI. The model files are the real install step, and they're not auto-downloaded - you grab them from the README's Baidu Cloud or Google Drive links and drop them in:
ComfyUI/models/DeepFakeDefender/
├── ema.state
└── weight.pth
Where people get burned
Three gotchas, all visible in the source if you go looking:
timmis a hard dependency that isn't in requirements.txt. The requirements file is one big commented-out block (torch, torchvision, transformers, cv2 - all#-prefixed, sopip install -r requirements.txtinstalls literally nothing). The code actually importstimm,cv2,torchvision, and PIL. Your ComfyUI env almost certainly has torchvision and cv2; it may not havetimm. If the Loader dies on import, that's your fix:pip install timm.- CUDA only, no graceful fallback. The loader unconditionally runs
nn.DataParallel(net).cuda()and even setsCUDA_VISIBLE_DEVICES=0at module import. There's a device check in the file that contemplates MPS/CPU, but the loader never uses it. On a CPU-only or Apple Silicon box, this node will error - the README's "ComfyUI users should have all this" is optimistic. - The license is CC BY-NC 4.0. Non-commercial. Fine for personal experimenting and research; if you're building a commercial content-moderation product on this, that's a licensing conversation you need to have.
Set the folder name, wire net and transform_val into the sampler, and the loader fades into the background where it belongs.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| ckpt_path | STRING | DeepFakeDefender | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| net | MODEL | — |
| transform_val | MODEL | — |