Abstract
Identity documents that carry a facial portrait remain one of the most widely used forms of personal identification. Yet two closely related attacks continue to undermine their trustworthiness: replacing a genuine photograph with a fraudulent one, and issuing documents that are fraudulent from the outset. Despite continued advances in document security, both attacks remain simple to execute and difficult to detect during in-person verification.
We introduce CodeFace, a deep-learning steganography method that verifies the integrity of a facial portrait by embedding an imperceptible secret message directly into the image and recovering it later from a physically printed copy. Implemented as an end-to-end neural network, CodeFace learns to encode and decode messages that survive the full document lifecycle — printing, environmental lighting, camera capture, and digital compression — while keeping the encoded portrait visually indistinguishable from the original. This robustness stems from two contributions: a loss term that constrains the distance between the facial features of the encoded and original images, and a dedicated architecture that improves message recovery from the small portrait sizes typical of ID photographs. In extensive experiments on physically printed polycarbonate and PVC cards captured with consumer smartphones, CodeFace reliably decodes messages of up to 120 bits, demonstrating that document integrity can be verified without altering the perceived appearance of the portrait.
Method
CodeFace is the first steganography method optimized specifically for facial images printed on IDs and MRTDs. It comprises two independent pipelines — an encoder that conceals a secret message inside a detected face, and a decoder that recovers it from a photo of the printed, physically captured document.
Face detection
The encoder and decoder both need to locate the exact facial region used to carry the message. After testing BlazeFace, MobileNet V2 (float32/int8), SSD/MTCNN, LBP cascade, and PRNet, the authors chose PRNet for its accuracy under pose variation and occlusion, optimizing and converting it to TensorFlow Lite for mobile deployment.
Error-correcting codes
To stabilize decoding accuracy, the secret message is protected with cyclic error-correcting codes — BCH and Reed–Solomon — before being embedded by the encoder network.
Perturbation simulation
Between encoder and decoder, training images are perturbed with perspective warp, motion/defocus blur, camera sensor noise, color manipulation (hue, saturation, brightness, contrast), and JPEG compression — approximating real printing and smartphone-capture conditions. CodeFace's key novelty is an additional resize network that down-samples images before the decoder during training, letting it read messages from much smaller printed portraits than prior methods.
Loss functions & training
The full generator/discriminator training setup is shown below. The encoder is trained with a weighted sum of five terms: LPIPS perceptual loss, a FaceNet embedding-distance loss (preserving facial identity), Wasserstein loss, residual regularization, and a cross-entropy message loss that trains the decoder.
Datasets
Training combined seven frontal-face datasets (PICS, Color FERET, AT&T, BioID, Georgia Tech Face Database, and FEI Face Database). After filtering for ICAO identity-document requirements (photo size, framing, uniform background, visible eyes), 1900 images remained for training.
Results
CodeFace is compared against StegaStamp, the only other printer-proof steganography model available at the time, encoding 100-bit messages unless noted otherwise.
Facial-feature preservation (809 images)
| Metric (809 images) | CodeFace | StegaStamp |
|---|---|---|
| Mean Euclidean feature distance | 0.0091 | 0.1346 |
| Std. deviation | 0.0028 | 0.0168 |
| Max | 0.0445 | 0.1853 |
Perceptual similarity & face verification (VGGFace2)
Ablation: message size & the resize network
On a regular PC, mean encode time is ≈1.2 seconds per image; mean decode/validation time is ≈0.8 milliseconds. The trained model was converted to TensorFlow Lite and deployed in an Android application.
Patents
CodeFace's encoding/decoding/validation system is protected by two related patent filings.
Code
The CodeFace implementation is proprietary and licensed by INCM. The source code is private and not publicly available.
BibTeX
@article{shadmand2021codeface,
title = {CodeFace: A Deep Learning Printer-Proof Steganography for Face Portraits},
author = {Shadmand, Farhad and Medvedev, Iurii and Gon\c{c}alves, Nuno},
journal = {IEEE Access},
volume = {9},
pages = {167282--167291},
year = {2021},
publisher = {IEEE},
doi = {10.1109/ACCESS.2021.3132581}
}