# Scale-Adaptive Deep Matching Network for Constrained Image Splicing Detection and Localization
## 3 Method
### Scale-Adaptive Correlation Computation
The correlation maps are computed by:  
\[\mathbf{C}^{(12)}(i_{12},j_{12},m_{12})=\vec{\tilde{f}}^{(1)}(i_{1},  
```
1:Image \(\mathbf{I}^{(1)}\) and \(\mathbf{I}^{(2)}\)
2:\(\mathbf{F}_{3}^{(1)}\), \(\mathbf{F}_{4}^{(1)}\), \(\mathbf{F}_{5}^{(1)}\) = Encoder(\(\mathbf{I}^{(1)}\))
3:\(\mathbf{F}_{3}^{(2)}\), \(\mathbf{F}_{4}^{(2)}\), \(\mathbf{F}_{5}^{(2)}\) = Encoder(\(\mathbf{I}^{(2)}\))
4:\"Attention weighted feature maps generation for hierarchical features:\"
5:for c = 3 to 5 do
6: \"L2 normalization of Equation (2)\"
7: \(\mathbf{F}_{n}^{(1)}\) = L2_norm(\(\mathbf{F}_{n}^{(1)}\))
8: \(\mathbf{F}_{n}^{(2)}\) = L2_norm(\(\mathbf{F}_{n}^{(2)}\))
9:\"Refer to Equations (3)-(5)\"
10: \(\mathbf{F}_{n}^{(1)}\) = \(\mathbf{F}_{scale}(\mathbf{F}_{n}^{(1)},\mathbf{F}_{sq}(\bar{\bar{\bar{\bar{\bar{ \bar{\bar{\bar{\bar{\bar{\bar{\bar{\bar{\bar{\bar{\bar{\bar{\bar{ \bar{               \bar{bar{\bar{             \bar{     \bar{   \bar{    \bar{   \bar{    \bar{   \bar{   \bar{   \bar{   \bar{    \bar{    \bar{   \bar{   \bar{   \bar{   \bar{    \bar{   \bar{   \bar{   \bar{   \bar{   }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}\          \ \ \ \ \ \ \ \ \ \ \\\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ our SADM typically employs attention-based separable convolutional blocks to gain a good tradeoff between localization and detection performance and computation complexity.

(1) ASPP.

Before the ASPP block, the correlation computation module produces a feature tensor of size \(W/8\times H/8\times 96\). ASPP is the first part of the mask generator with three parallel layers of atrous convolution to capture multiscale features, setting atrous rates with [6; 12; 18]. Then the feature maps are concatenated into a \(1\times 1\) convolution to reduce channels.

(2) Attention-based separable convolutional block.

The mask generator uses attention-based separable convolutional block for three times, corresponding to the three times of upsampling operations. The design of attention-based separable convolutional block is shown in Figure 5. It employs depthwise separable convolution for two times first and a spatial attention second, utilizing L2-normalization, ReLU among them.

**Depthwise separable convolution.** The depthwise separable convolution is shown in Figure 6. Motivated by the architecture of [31], we adopt a variant of depthwise separable

Figure 4: Parameter settings of mask generator architecture. “\(3\times 3\)” and “[1; 3]” indicate the kernel size used in convolution layers. “AC” means the atrous convolution, and “6”, “12”, “18” stand for the r\({}_{s}\) of atrous convolution. “480”, “96”, “48”, “16” represent the input or output channels of each layer.

Figure 3: Truncation operations of Scale-Adaptive Correlation Computation module. \(\tilde{\mathbf{F}}^{(1)}\), \(\tilde{\mathbf{F}}^{(2)}\) are generated from SE blocks. “Top_32 ” means that we sort each correlation map along the \(H/8\times W/8\) channels to select Top_32 values.

convolution for our mask generator. Different from ecumenical depthwise separable convolution, we utilize the \(1\times 1\) pointwise convolution followed by the \(3\times 3\) depthwise convolution for each input channel and concatenate into the subsequent layers. We apply it to mask generator to reduce the model parameters uttermost. Similar to the Xception network [31], we employ L2-normalization and ReLU between pointwise convolution and depthwise convolution.

### Spatial attention

Spatial attention can capture the spatial dependencies and produce more powerful pixel-level characterization, helping recover the spatial detail information effectively. The detail of spatial attention is shown in Figure 6. Let \(\mathbf{P}\) denote the feature map input to spatial attention blocks, \(\mathbf{P}(i,j)\) denotes a c-dimensional descriptor at at \((i,j)\). Noted that \(\mathbf{P}\in\mathbb{R}^{h\times w\times c}\), \(i\in[1,h]\), \(j\in[1,w]\), \(h\) and \(w\) indicate the height and width of the feature map and \(h\) = \(w\) in our work. Prior to reinforce \(\mathbf{P}\) using spatial attention, we employ L2-normalization and ReLU to modify it. Then, the first step is to transform \(\mathbf{P}\) into two feature spaces by the \(1\times 1\) convolution layer, \(f(\mathbf{P})=\mathbf{PW}_{f}+\mathbf{b}_{f}\) and \(g(\mathbf{P})=\mathbf{PW}_{g}+\mathbf{b}_{g}\). The similarity between \(f(\mathbf{P})\) and each \(g(\mathbf{P})\) is calculated as follows:

\[s^{(x,y)}=f(\mathbf{P}^{(x)})^{T}g(\mathbf{P}^{(y)}) \tag{9}\]

In order to normalize these weights, we use a softmax function:

\[\beta^{(x,y)}=\frac{exp(s^{(x,y)})}{\sum_{y}exp(s^{(x,y)})} \tag{10}\]

when predicting the \(x\)th region, \(\beta^{(x,y)}\) denotes the extent that the model attends to the \(y\)th location, \(x\), \(y\in[1,h\times w]\).