## 3 Method
### Consistent Displacement Vector Selection  
From the above step, a set of activation peaks are extracted. The most probable size of the repeated pattern of the image can be inferred as the most frequent distance between activation peaks in both image and feature spaces. To detect the repeated patterns from the activation peaks, all the vectors which link these peaks are calculated on the image space. Each vector then votes for the displacement it represents. The displacement which obtains the highest score then represents the diagonal of the detected repeating rectangle.  
For each activated feature map \(f_{n}^{*}(I)\), a set of displacement vectors \(D_{f_{n}}=\left\{\hat{d}_{f_{n}}^{i,j}\right\}\) is obtained by computing the distance between each pair of peaks, i.e.,  
\[d_{f_{n}}^{i,j}=\left|p^{i}-p^{j}\right|,\forall p^{i},p^{j}\in P_{f_{n}},i \
eq j, \tag{3}\]  
where \(|.|\) denotes the element-wise absolute difference, namely the displacement of the two elements \(p^{i}\), \(p^{j}\). See Figure 2(a) for an illustration of some displacement vectors in the top sub-figure.  
Since each displacement vector \(d_{f_{n}}^{i,j}\in D_{f_{n}}\) represents a candidate size of the repeated pattern, displacement vectors of all selected filters and all layers cast votes into Hough voting space \(V\) so as to estimate an initial repeated pattern size \(d^{*}\) (see Figure 2(a) bottom sub-figure for an example of voting space). To reflect the uncertainty of the localization of activation peaks, each displacement vector \(V_{n,j,j}\) is modeled as normal distribution centers  
Figure 3: Illustration of consistent displacement vector selection. (**a**) Top: calculation of displacement vectors between activation peaks; bottom: voting space on which peaks’ coordinates (light spots) correspond to the displacement vectors of the strongest repetitions; (**b**) more examples of the top row shows the input images and the bottom row shows the corresponding voting spaces.  
at \(d_{f_{n}}^{ij}\) and standard deviation \(\delta_{n}\). To normalize overall energy, the vote is weighted by the number of displacement vectors \(\left|D_{f_{n}}\right|\) across all layers and filters as follows:  
\[V=\sum_{x,y}\sum_{n\in N}\frac{1}{\left|D_{f_{n}}\right|}\sum_{d_{f_{n}}^{ij} \in D_{f_{n}}}V_{n,i,j}\] (4a) where \[V_{n,i,j}=\frac{1}{2\pi\sqrt{\left|\Delta\right|}}exp(-\frac{1}{2}(x-d^{i,j})^ {T}\Delta^{-1}(x-d^{i,j})) \tag{4b}\] \[\Delta=\begin{pmatrix}\delta_{n}^{2}&0\\ 0&\delta_{n}^{2}\end{pmatrix} \tag{4c}\]  
where \(\delta_{n}\) is related to the width \(w\), corresponding to the \(x\) direction (or height \(h\), corresponding to the \(y\) direction) of each feature map \(w_{f_{n}^{*}(l)}\):  
\[\delta_{n}=\frac{w}{2\cdot w_{f_{n}^{*}(l)}} \tag{4d}\]  
When the input image has high topology regularity, the repeated patterns can be represented as the most consistent displacement vector \(d^{*}\), namely the maxima on the voting space along the \(x\)- and \(y\)-axes:  
\[d^{*}=\left(d_{x}^{*},d_{y}^{*}\right)=\left(\operatorname*{arg\,max}_{x}V_{ x,0},\operatorname*{arg\,max}_{y}V_{0,y}\right) \tag{5}\]  
Figure 3b shows some examples of the voting space \(V\), where the highlighted spots show the most consistent displacement vectors.