StegaStampOptions

Options & Configuration · AiDotNet.Safety.Watermarking

Configuration of a StegaStampWatermarker: the image and secret sizes and the training schedule of Tancik et al. (2020).

Inheritance: ModelOptions → NeuralNetworkOptions → StegaStampOptions

Known derived types: SynthIdImageOptions

How It Works

The image size, the message length and the BCH protection are the paper’s (Sec. 4.1, 5.4). The paper gives no learning rate, loss weights or ramps. Those defaults are the authors’ reference training script (scripts/base.sh in github.com/tancik/StegaStamp). The ramps count training steps.

Constructors

Constructor Summary
StegaStampOptions() The paper’s sizes and the reference script’s training schedule.
StegaStampOptions(StegaStampOptions other) A copy of other.

Properties

Property Summary
bool UseErrorCorrection { get; set; } Protects the keyed payload with a BCH code correcting 5 errors, as the paper does for its 56 data bits (Sec.
double BlurProbability { get; set; } Chance of a Gaussian blur, and separately of a motion (line) blur, on a training step.
double BrightnessShift { get; set; } Largest brightness offset.
double ContrastHigh { get; set; } Largest contrast factor.
double ContrastLow { get; set; } Smallest contrast factor.
double CriticGradientClip { get; set; } Each element of the critic’s gradient is clipped to [-c, c] before its step (the reference script: 0.25).
double CriticLearningRate { get; set; } RMSProp learning rate of the WGAN critic (the reference script: 1e-5, with TensorFlow 1’s RMSProp: decay 0.9, epsilon 1e-10, mean square starting at 1).
double CriticLossScale { get; set; } Weight of the critic (adversarial) loss once ramped (the reference script: 0.5).
double CriticWeightClip { get; set; } The WGAN critic’s weights are clipped to [-c, c] after each of its steps.
double EdgeLossGain { get; set; } Extra weight on the residual near the image border once ramped (the reference code’s l2_edge_gain): the residual is scaled by 1 + gain * (1 - falloff) before it is squared.
double HueShift { get; set; } Largest per-channel (hue) offset.
double ImageLossScale { get; set; } Weight of the residual’s L2 image loss once ramped (the reference script: 2).
double LearningRate { get; set; } Adam learning rate of the encoder and decoder (the reference script: 1e-4).
double MinimumJpegQuality { get; set; } Lowest quality of the differentiable JPEG approximation.
double NoiseStdDev { get; set; } Largest standard deviation of the additive Gaussian noise.
double PerspectiveJitter { get; set; } Largest corner displacement of the random perspective warp, as a fraction of the side.
double SaturationMix { get; set; } Largest mix toward the luminance image (desaturation).
double SecretLossScale { get; set; } Weight of the secret’s cross-entropy (the reference script: 1.5).
double[] YuvLossScales { get; set; } Weights of the Y, U and V channels in the image loss.
int ColorRampSteps { get; set; } Steps over which the colour, noise and JPEG perturbations ramp to full strength.
int CriticLossRampSteps { get; set; } Steps over which the critic loss’s weight ramps linearly to CriticLossScale, counted from the start of training as in the reference script; off until NoImageLossSteps.
int EdgeLossDelaySteps { get; set; } Steps before the edge gain starts to ramp in (the reference script: 80000).
int EdgeLossRampSteps { get; set; } Steps over which the edge gain ramps to EdgeLossGain after the delay (the reference script: 10000).
int ImageLossRampSteps { get; set; } Steps over which the image loss’s weight ramps linearly to ImageLossScale, counted from the start of training as in the reference script; the loss is off until NoImageLossSteps, so it switches on at the ramp’s value there.
int ImageSize { get; set; } Side of the square image the networks work at (the paper uses 400).
int LearningRateWarmupSteps { get; set; } Steps over which the learning rate of the encoder and decoder’s first optimizer (the secret-only phase’s, or the full loss’s when NoImageLossSteps is 0) rises linearly from 0 to LearningRate; 0 (the reference script) starts at the full…
int NoImageLossSteps { get; set; } Initial steps that train the secret alone, so decoding is learned before imperceptibility.
int PerspectiveRampSteps { get; set; } Steps over which the perspective warp ramps to full strength.
int SecretBits { get; set; } Bits the encoder hides (the paper uses 100: 56 data bits, BCH parity, padding).