---
title: 'Capsule-Forensics: Digital Forgery Detection'
url: https://www.emergentmind.com/topics/capsule-forensics
type: topic
---

# Capsule-Forensics: Digital Forgery Detection

Capsule-Forensics denotes a family of media forensics techniques that leverage capsule networks—notably the dynamic routing-by-agreement paradigm—to robustly detect digital forgeries in images and videos. These methods extend capsule networks’ original intent beyond inverse graphics, applying the architecture’s hierarchical feature aggregation to extract the subtle, distributed artifacts characteristic of spoofed media, including replay, print, CGI, deepfake, and instruction-guided edits [1810.11215][1910.12467][2504.19212].

## 1. Architectural Foundations and Network Design

In its prototypical implementation, Capsule-Forensics processes a pre-cropped facial RGB image (e.g., $128\times128$) with the first three convolutional blocks of VGG-19, producing a $16\times16\times256$ feature tensor [1810.11215]. This latent feature map is partitioned across multiple (often three) primary capsule branches, each realized as a lightweight CNN with statistical pooling (mean and variance per channel) to form a pose vector $u_i$ for capsule $i$. These primary capsules are then dynamically routed to output capsules corresponding to semantic classes, such as “real” and “fake.”

The core component, the dynamic routing algorithm, transfers pose information $u_i$ from each primary capsule to high-level capsules $v_j$ through trainable transformation matrices $W_{ij}$. Routing proceeds over $r=2$ iterations as follows:
- Transformations with added Gaussian noise $\mathcal{N}(0,0.01)$ during training augment the weights.
- Coupling coefficients $c_{ij}$ are computed via softmax over output capsules, normalized for each primary capsule.
- Output capsules aggregate votes as $s_j = \sum_i c_{ij}\hat u_{j|i}$, squashed to normalize length.
- Agreement scores update logits $b_{ij}$ as $b_{ij} \leftarrow b_{ij} + \hat u_{j|i}\cdot v_j$.

Prediction is extracted by dimension-wise softmax across output capsule vectors, followed by averaging:
$$\hat y = \frac{1}{m}\sum_{d=1}^m \mathrm{softmax}\bigl([v_1^T,\,v_2^T]_d\bigr)$$
where $m$ is the capsule dimension, and $[v_1^T,\,v_2^T]_d$ denotes the $d$th component pair of the “real” and “fake” capsules. Binary cross-entropy loss outperforms the margin loss in this application [1810.11215][1910.12467].

Extensions like CapsFake [2504.19212] increase representational power via multimodal capsule stacks: visual (image-based), textual (caption-based), and frequency (DCT-domain) features, each projected into shared low-dimensional capsule space and routed competitively to class capsules.

## 2. Training Procedures and Datasets

Standard Capsule-Forensics pipelines utilize Adam or AdamW optimizers, typical learning rates ($10^{-3}$ or $10^{-4}$), batch sizes of 32–64, and moderate epoch counts ($\approx$50). Data augmentation includes random flips and photometric transforms to increase data variety [1810.11215].

Dataset coverage is broad:
- REPLAY-ATTACK: printed and video replays for anti-spoofing.
- FaceForensics, FaceForensics++: facial reenactment (Face2Face), deepfakes, face swapping, under variable compression

Source: https://www.emergentmind.com/topics/capsule-forensics