DecoyFace / common.py
weathon's picture
Clean DecoyFace implementation and checkpoints
35ec68e verified
Raw History Blame Contribute Delete
896 Bytes
"""Shared config and paths for DecoyFace."""
from pathlib import Path
import torch
CKPT = Path(__file__).resolve().parent / "checkpoints"
ADAFACE_CKPT = CKPT / "adaface_ir50_ms1mv2.backbone.pth"
# DecoyFace hyper-parameters (paper Sec. V-B "Implementation Details").
CFG = {
"C": 64,
"r": 32, # RSS rank
"G": 16, # groups
"K": 3, # preserved true-sample groups
"M": 5000, # auxiliary complementary bank size
"sc_lo": 8, "sc_hi": 12, # coherent subset size s_c ~ U[8,12]
"L_lo": 2, "L_hi": 4, # shared source count L ~ U[2,4]
"t": 3, # random scale exponent k ~ U[-3,3]
"q": 0.95, # quantile
"tau_s": 0.8, # server target magnitude
"eps": 1e-6,
}
DEVICE = "cuda:0"
def fixed_perm(C=64, seed=1234):
g = torch.Generator().manual_seed(seed)
return torch.randperm(C, generator=g)