Distribution-preserving Sampling

Computer

Mechanism

image

  • Watermark Diffusion
    • s:l×cfc×hfhw×wfhwDiffusesd:l×c×h×w\displaystyle{ s : l \times \frac{ c }{ f _{ c } } \times \frac{ h }{ f _{ h w } } \times \frac{ w }{ f _{ h w } } \xrightarrow[ ]{ \text{Diffuse} } s ^{ d } : l \times c \times h \times w }
    • (c×h×w)\displaystyle{ \left( c \times h \times w \right) } dimension; each represent l\displaystyle{ l } bits of the watermark.
  • Watermark randomization
    • m=sdK(e.g. ChaCha20)\displaystyle{ m = s ^{ d } \oplus K \left( \text{e.g. ChaCha20} \right) }
    • mU({0,1})\displaystyle{ m \sim U \left( \left\lbrace 0 , 1 \right\rbrace \right) }

Distribution-preserving sampling

Facts

  • y=dec(mij)[0,2l1]\displaystyle{ y = \text{dec} \left( m _{ i j } \right) \in \left[ 0 , 2 ^{ l } - 1 \right] }
  • mU({0,1})    yU({0,,2l1})    p(y)=12l\displaystyle{ m \sim U \left( \left\lbrace 0 , 1 \right\rbrace \right) \implies y \sim U \left( \left\lbrace 0 , \ldots , 2 ^{ l } - 1 \right\rbrace \right) \implies p \left( y \right) = \frac{ 1 }{ 2 ^{ l } } }

Notations

  • Let f(x)\displaystyle{ f \left( x \right) } denotes the PDF of N(0,I)\displaystyle{ \mathcal{ N } \left( 0 , I \right) }
  • Let F(x)\displaystyle{ F \left( x \right) } denotes the CDF of N(0,I)\displaystyle{ \mathcal{ N } \left( 0 , I \right) }
  • F1(x)\displaystyle{ F ^{ - 1 } \left( x \right) } denotes the PPF of N(0,I)\displaystyle{ \mathcal{ N } \left( 0 , I \right) }

Suppose zTs=g(y)\displaystyle{ z _{ T } ^{ s } = g \left( y \right) }

Given

  • yU({0,1,,2l1})\displaystyle{ y \sim U \left( \left\lbrace 0 , 1 , \ldots , 2 ^{ l } - 1 \right\rbrace \right) }
  • zTsN(0,I)\displaystyle{ z _{ T } ^{ s } \sim N \left( 0 , I \right) }
Review: Change of Variables Formula

x=g(z)    pX(x)=pZ(z)dzdx\displaystyle{ x = g \left( z \right) \iff p _{ X } \left( x \right) = p _{ Z } \left( z \right) \left| \frac{ {\text{d}z} }{ {\text{d}x} } \right| }

Bottleneck
  • Bridge yU\displaystyle{ y \sim U } with zN\displaystyle{ z \sim \mathcal{ N } }
  • U\displaystyle{ U } is a discrete distribution
Dequantization & Normalizaion

Let yc=u+y2l,uN(0,1)\displaystyle{ y _{ c } = \frac{ u + y }{ 2 ^{ l } } , u \sim N \left( 0 , 1 \right) }

ycU(0,2l2l)=U(0,1)\displaystyle{ y _{ c } \sim U \left( 0 , \frac{ 2 ^{ l } }{ 2 ^{ l } } \right) = U \left( 0 , 1 \right) }, thus pYc(yc)=1\displaystyle{ p _{ Y _{ c } } \left( y _{ c } \right) = 1 }

pZ(z)=pYc(yc)dycdz    yc=pZ(z)dz=FZ(z)\displaystyle{ p _{ Z } \left( z \right) = p _{ Y _{ c } } \left( y _{ c } \right) \frac{ {\text{d}y} _{ c } }{ {\text{d}z} } \implies y _{ c } = \int p _{ Z } \left( z \right) {\text{d}z} = F _{ Z } \left( z \right) }

Thus.

Theorem (Inverse Transform Sampling)

z=FZ1(yc)=F1(u+y2l)i.e. zTs=ppf(u+i2l)\displaystyle{ z = F ^{ - 1 } _{ Z } \left( y _{ c } \right) = F ^{ - 1 } \left( \frac{ u + y }{ 2 ^{ l } } \right) \quad \text{i.e. } z _{ T } ^{ s } = \text{ppf} \left( \frac{ u + i }{ 2 ^{ l } } \right) }

Extract the watermark from image:

y=2lF(zTs)\displaystyle{ y = \left\lfloor 2 ^{ l } \cdot F \left( z _{ T } ^{ s } \right) \right\rfloor }
Equivilent: in a discretization view

y=i    zTs\displaystyle{ y = i \iff z _{ T } ^{ s } } falls into the i\displaystyle{ i }-th interval (i2l,i+12l]\displaystyle{ \left( \frac{ i }{ 2 ^{ l } } , \frac{ i + 1 }{ 2 ^{ l } } \right] } of f(x)\displaystyle{ f \left( x \right) }

Reproduction

  • Implement --rotate distortion method
  • Set --num 500
  • Set --rotate 75 (aligned to Tree-Ring)

Discovery:

  • aligned with the results in the paper
  • robust to crop
  • sensitive to rotation
Transformationtpr_detectiontpr_traceabilitymean_accstd_acc
Median Blur1.01.00.99870.0089
Resize1.01.00.99610.0162
JPEG Compression1.01.00.98840.0252
Gaussian Blur1.01.00.98410.0246
Random Crop1.01.00.97420.0164
Random Drop1.00.990.96140.0373
Gaussian Std1.01.00.95580.0594
Brightness0.980.950.95320.0939
S&P Noise1.00.980.93640.0664
==Rotate (Our Discovery)==0.00.00.50050.0335

Environment Configuration:

python 3.9
skimage==0.0 => scikit-image
transformers
huggingface_hub

Why Robust to Crop & Scale: Vote

Similar to voting, if the bit is set to 1 in more than half of the copies, the corresponding watermark bit is set to 1; otherwise, it is set to 0. This process restores the true binary watermark sequence s′.

假设图像被剪掉了 50%,这意味着有一半的水印副本丢失了。但由于 GS 在全图重复嵌入了多份副本,只要剩下的 50% 区域中,识别出的 Bit 1 比例依然占优(>1/2),根据上述的 Voting 规则,最终提取的原始比特流依然能被完美还原。

Why Sensitive to Rotation

  • 旋轉徹底改變了所有塊的相對朝向和內部索引順序。解碼器在 (x,y)\displaystyle{ \left( x , y \right) } 坐標系下看到的數據已經被重新洗牌,無法通過簡單的位移搜索來對齊。
  • 空域(Spatial Domain) 操作统计分布。
    • 追求“分布不失真”(Performance-Lossless),这使得它必须深入到每一个具体的噪声采样点。这种对“点”的极致追求,牺牲了对几何变换(如旋转)的宏观鲁棒性。
  • 频域的介入可以比较好地处理旋转
链接已复制到剪贴板