Downloads · 30 days
0
vadishev/stegastamp-original
stegastamp-original is a machine learning model from vadishev. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as apache-2.0.
A PyTorch implementation of StegaStamp (Tancik et al., CVPR 2020) trained on COCO dataset.
Downloads · 30 days
0
Access
Public
Updated Feb 5, 2026
Repo size
651 MB
Likes
0
Public
Click a slice to open those files.
.pt651 MB · 100%
From the Hugging Face model README
A PyTorch implementation of StegaStamp (Tancik et al., CVPR 2020) trained on COCO dataset.
| Metric | Value |
|---|---|
| Bit Accuracy | 99.6% |
| PSNR | 27.95 dB |
experiment_name: stegastamp_original
data:
batch_size: 4
training:
num_steps: 140000
lr: 0.0001
stn_lr_scale: 0.01 # Critical for training stability
loss:
message: { scale: 7.0, ramp_steps: 1 }
l2: { scale: 2.0, ramp_steps: 10000 }
lpips: { scale: 1.5, ramp_steps: 10000 }
distortion:
strategy: curriculum
The STN linear parameters (stn_fc_weight, stn_fc_bias) require a 100× lower learning rate to prevent training collapse. Without this, the decoder outputs constant 0.5 probabilities (loss stuck at 0.693).
import torch
from picode.models.stegastamp import Encoder, Decoder
# Load checkpoint
checkpoint = torch.load("best.pt", map_location="cpu")
encoder = Encoder(num_bits=100)
decoder = Decoder(num_bits=100)
encoder.load_state_dict(checkpoint["encoder"])
decoder.load_state_dict(checkpoint["decoder"])
# Encode message into image
image = ... # (B, 3, 400, 400) tensor in [0, 1]
message = torch.randint(0, 2, (B, 100)).float()
encoded_image = encoder(image, message)
# Decode message from image
logits = decoder(encoded_image)
decoded_message = (torch.sigmoid(logits) > 0.5).float()
@inproceedings{tancik2020stegastamp,
title={StegaStamp: Invisible Hyperlinks in Physical Photographs},
author={Tancik, Matthew and Mildenhall, Ben and Ng, Ren},
booktitle={CVPR},
year={2020}
}
Apache 2.0