## 2 Detection Model  
### Foreground Motion Blocks Extraction  
#### 2.1.1 Sampling Areas Determination  
We propose a sample-area criteria for a single frame illustrated in Figure 2. There are eight sample areas in a frame, namely, \(\mathbf{X}_{1},\mathbf{X}_{2},\cdots\mathbf{X}_{8}\), which are located at four diagonal positions and four middle positions in the boundary. Each sample area contains twenty-five \(8\times 8\) blocks whose types include both inter and intra, and the size of each sample area is \(40\times 40\). The two green rectangles in Figure 2 are represented as the outer and the inner boundary respectively, and the center point in this frame is named as the anchor point. For mathematical analysis, we define sampling set \(\mathbb{X}=\{\mathbf{X}_{1},\mathbf{X}_{2},\cdots\mathbf{X}_{8}\}\), and each block in \(\mathbf{X}_{i}\) (\(1\leq i\leq 8\)) is represented as \(x_{i1}^{i}(1\leq i1\leq 25)\). Also, we define \(\mathbb{I}_{i}\) as the intercoded block set and set \(\mathbb{I}_{i}^{\mathbb{C}}\) be the intracoded block set for sampling area \(\mathbf{X}_{i}\). Consider the motion vectors (MVs) for the filtered sampling blocks of the previous frames has a distribution named \(q(x)\), and the current unfiltered sampling blocks has a distribution named \(p(x)\), we can compute Kullback-Leivler Divergence (KLD) between them as:  
\[D(p||q)=E_{x\sim P}\left[\log\frac{P(x)}{Q(x)}\right]=\int p(x)\log\frac{p(x)} {q(x)}dx, \tag{1}\]  
in which \(E_{x\sim P}[\cdot]\) is a statistical average value. To minimize \(D(p||q)\), a trick is to quantize these MVs into \(\mathbb{X}\) into \(l\) levels. Let \(mv_{j}^{i}\) (\(j\in\mathbb{I}_{i}\)) denote the \(j\)th block's MV in \(\mathbb{I}_{i}\), the maximum and minimum MVs are represented as:  
\[\left\{ \begin{array}{ll}&mv_{min}(x)=\min\limits_{\bigcup\mathbb{I}_{i}}( \min\limits_{j\in\mathbb{I}_{i}}(mv_{j}^{i}(x)));\;mv_{min}(y)=\min\limits_{ \bigcup\mathbb{I}_{i}}(\min\limits_{j\in\mathbb{I}_{i}}(mv_{j}^{i}(y)))\\ &mv_{max}(x)=\max\limits_{\bigcup\mathbb{I}_{i}}(\max\limits_{j\in\mathbb{I} _{i}}(mv_{j}^{i}(x)));\;mv_{max}(y)=\max\limits_{\bigcup\mathbb{I}_{i}}(\max \limits_{j\in\mathbb{I}_{i}}(mv_{j}^{i}(y)))\end{array} \right. \tag{2}\]  
\(mv(x)\) and \(mv(y)\) stand for the horizontal and vertical components. The MV step \(\Delta_{s}\) equals to \(\|mv_{max}-mv_{min}\|/l\), where \(\|\cdot\|\) is the \(L_{2}\) norm. Let \(r_{s}\) be the \(s\)th level of the quantized MVs, its probability has the following expression:  
\[P_{r}(r_{s})=\frac{n_{s}}{n},\;1\leq s\leq l. \tag{3}\]  
Here, \(n_{s}\) means the number of MVs at level \(s\) and \(n\) stands for the total quantized MVs. Then, (1) can be rewritten in a discrete way:  
\[D(P_{r}||P_{r}^{\prime})=\sum\limits_{s}P_{r}(r_{s})\log\frac{P_{r}(r_{s})}{P_ {r}^{\prime}(r_{s})}, \tag{4}\]  
in which \(P_{r}^{\prime}\) is the historical MV distribution for previous frames. Now, we elaborate the proposed sampling block filter algorithm (Algorithm 1):```
1:Initialize sample set \(\mathbb{X}=\emptyset\), \(\kappa=1\), \(l\), the expected sample size \(S_{z}\), and the decay factor \(\gamma=0.9\). 2:while\(|\mathbb{X}|<S_{z}\)do
3: Reset \(\mathbb{X}=\emptyset\). 4:for\(s=1,\cdots,l\)do
5: Compute the relative deviation \(d=|\frac{\|P_{r}(r_{s})-P_{r}^{\prime}(r_{s})\|}{\|P_{r}(r_{s})\|}|\). 6:for each intercoded block \(x_{j}^{i}\) whose MV belongs to level \(k\)do
7: Add \(x_{j}^{i}\) into \(\mathbb{X}\) with an acceptance probability \(P_{a}=1-\kappa d\). 8:endfor
9:endfor
10: Decrease \(\kappa\) by \(\kappa=\gamma\kappa\). 11:endwhile
12:Update \(P_{r}^{\prime}(r_{s})\) by rules in (5). ```

**Algorithm 1** Sampling block filter algorithm

Please note that the algorithm first calculates the relative deviation \(d\) between \(P_{r}(r_{s})\) and \(P_{r}^{\prime}(r_{s})\) at each level and accept each block with a probability according to \(\delta\). Next, it maintains the lower bound of the sampling size by reducing \(\kappa\) during each loop.