# Convolutional Neural Network Architecture for Recovering Watermark Synchronization
## 3 Main Concept of Proposed Method  
The proposed method consists of a preparation step, insertion step, and decoding step as shown in Figure 2. In the preparation step, a random binary code is generated using the key, and this code is used to generate a 2D binary template matrix \(K\) of \(M\times N\) size. This matrix determines whether each block is a template block or a watermark block in an image divided into blocks. It also serves as the ground truth for estimating the RST parameters in the template matching step.  
In the insertion step, the image is divided into blocks, and then watermark insertion and template insertion are performed. First, the image is spatially divided into \(M\times N\) blocks. The set of generated blocks is defined as \(B\). The following rules distinguish the roles of the blocks.  
\[B(x,y)=\begin{cases}\text{Template block},&\text{if }K(x,y)=1\\ \text{Watermark block},&\text{if }K(x,y)=0\end{cases} \tag{1}\]  
where \(x\) and \(y\) are the horizontal and vertical coordinates of \(B\) and \(K\), \(0\leq x<M\), and \(0\leq y<\)\(N\).  
Then, a block-based watermark is inserted into all the watermark blocks through the watermark embedder. The watermark embedder consists of an image transform, watermark insertion, and inverse transform in the same manner as conventional watermarking techniques.  
As the final step of the insertion, a template is inserted into the template blocks. Template insertion is completed by simply adding the \(w\times h\) sized noise output from the template generation network to the image, where \(w\) and \(h\) are the width and height of the image. The template generation network is responsible for generating a specific form of noise that can be detected in the template extraction network.  
The decoding step consists of extracting the template, estimating the distorted geometric information of the image, recovering the image, and decoding the bits from the watermark. First, in the template extraction step, the extraction network finds the location where the template is inserted in the image. The template extraction network outputs a matrix \(K_{r}\)' with a value of 1 where the template is inserted and 0 where the watermark is inserted. Inputting the \(K_{r}\)' and the original template \(K_{r}\), which can be obtained from the key, into the template matching network yields estimated RST parameters. \(K_{r}\) is simply a resize of \(K\), which is used to increase the resolution of the template.  
The geometrically distorted image is recovered using the estimated RST parameters. This step solves the problem of block synchronization, which is the biggest problem with block-based watermarking techniques. Therefore, the block-based watermark can be extracted blindly by using the block size and position information used in the watermark insertion step.  
As the last step of decoding, the watermark extraction proceeds in the order of image transform and watermark extraction in the transformed domain as in conventional techniques.  
The template generation network, template extraction network, and template matching network, which require a more detailed description, are described in Sections 4.1 and 4.2, and the watermark embedder and decoder are described in Section 4.3.  
Figure 2: An overview of the proposed method. (**a**) insertion step, and (**b**) decoding step. A Stego image is an image in which both a watermark and a template are inserted.