docforensics / core /config.py
Suryakarthik-1
Deploy DocForensics to Hugging Face Spaces
70520f0
Raw
History Blame Contribute Delete
1.19 kB
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
DATA_DIR = BASE_DIR / "data"
GENUINE_DIR = DATA_DIR / "genuine"
TAMPERED_DIR = DATA_DIR / "tampered"
MASKS_DIR = DATA_DIR / "masks"
CHECKPOINTS_DIR = BASE_DIR / "model" / "checkpoints"
MAX_IMAGE_SIDE = 2000
SUPPORTED_EXTS = {".jpg", ".jpeg", ".png", ".tiff", ".tif", ".pdf"}
MAX_FILE_MB = 20
ELA_QUALITY = 95
ELA_AMPLIFY = 15
ELA_THRESHOLD = 0.12
NOISE_WINDOW = 16
NOISE_THRESHOLD = 0.15
CM_BLOCK_SIZE = 16
CM_STRIDE = 8
CM_MATCH_THRESH = 0.95
DCT_HIST_BINS = 64
FONT_BASELINE_TOL = 3
# The CNN and AI-classifier are the most reliable signals. copy_move and
# double_jpeg are weak on text documents (legitimate repetition looks like
# tampering), so they carry little weight.
FUSION_WEIGHTS = {
'ela': 0.15,
'noise': 0.13,
'copy_move': 0.04,
'double_jpeg': 0.03,
'font': 0.10,
'metadata': 0.05,
'ai_generated': 0.20,
'model': 0.30,
}
TAMPER_THRESHOLD = 0.45
MODEL_INPUT_SIZE = 128
BATCH_SIZE = 4
LEARNING_RATE = 1e-4
MAX_EPOCHS = 40
EARLY_STOP_PATIENCE = 6