## 3 Proposed Algorithm
### Background Target Routing Algorithm  
In HFBE, although the extracted background pixels typically constitute the majority of the pixels, there are still a few pixels that are mixed with the target information due to external factors such as noise. We employ a background similarity routing algorithm to ensure the purity of the background pixels. The algorithm is based on the principle of inter-capsule similarity [40]: when the \(i\)-th layer feature capsules show a high level of similarity with the \(j\)-th layer feature capsules, their weights increase accordingly. In order to achieve the complete elimination of target information from the background, we deliberately decrease the weight of target information to ensure that the final output is ideal background information. Figure 3 shows the process of the background target routing algorithm. First, it computes the similarity between the feature capsule in frame \(t\) and the background feature capsule in the background pool. The new feature capsule in frame \(t\) that is similar to the background feature capsule is updated and obtained. In the next step, a routing algorithm is used to transfer information between the new feature capsule and the background feature capsule of the \(t\) frame. Thus, the background-target capsule feature (pure background capsule feature) of the current frame is generated. The feature capsule is  
Figure 2: Results of History Frame Background Extraction Module. (**a**) Spectral Curve of \(C_{t}\). (**b**) Generated Background Masks. (**c**) Final Results of Background Extraction. updated using the similarity between the feature capsule and the background capsule of the feature capsule of the \(t\) frame. Then, the new feature capsule of frame \(t\) is routed with the background capsule to derive the background-only feature capsule of the current frame. In order to calculate the similarity between the feature capsule \(u_{t}\) and the background capsule \(u_{b}\) at frame \(t\). This is specifically achieved as follows:  
\[S^{i}_{t|b}=\cos\theta=\frac{u^{i}_{b}\cdot u^{i}_{t}}{\left\|u^{i}_{b} \right\|\left\|u^{i}_{t}\right\|} \tag{17}\]  
where \(u^{i}_{b}\) is the \(i\)-th background capsule, \(u^{i}_{t}\) is the \(i\)-th feature capsule, and \(\left\|\|\right\|\) represents the magnitude of the vector. \(S^{i}_{t|b}\) denotes the similarity between the background capsule \(u^{i}_{b}\) and the feature capsule \(u^{i}_{t}\), which ranges from \(-1\) to \(1\). In addition, \(1\) denotes that the two capsules are in the exact same direction, \(-1\) denotes that the directions are completely opposite, and \(0\) denotes that the two capsules are orthogonal. The generated new capsule \(\tilde{u}^{i}_{t}\) is updated using the background capsule \(u^{i}_{b}\) and the resemblance between the feature capsule \(u^{i}_{t}\) so that the presence of the object capsule in the feature capsule of the \(t\)th frame is reduced. The new capsule is generated as follows:  
\[\tilde{u}^{i}_{t}= \begin{cases}u^{i}_{t}-S^{i}_{t|b}\times u^{i}_{t}&\text{ if }S^{i}_{t|b}=1\\ u^{i}_{t}&\text{ otherwise}\end{cases}  \tag{18}\]  
where \(u^{i}_{t}\) is the \(i\)-th feature capsule and \(S^{i}_{t|b}\) denotes the difference in similarity from the background capsule \(u^{i}_{b}\) to the signature capsule \(u^{i}_{t}\). The weight coefficient \(b^{i}_{t|b}\) between the background and the features is:  
\[e^{i}_{t|b}= \begin{cases}1-\frac{S^{i}_{t|b}}{\pi}&\text{ if }S^{i}_{t|b}=1\\ \frac{S^{i}_{t|b}}{\pi}&\text{ otherwise}\end{cases}  \tag{19}\]  
Figure 3: The architecture of background similarity routing algorithm. where \(e_{t|b}^{i}\) is the weight coefficient between the \(i\)-th background capsule \(u_{b}^{i}\) and the \(i\)-th feature capsule \(u_{t}^{i}\). \[u_{t|b}^{i}=W_{tb}\bar{u}_{t}^{i} \tag{20}\]  
where \(\bar{u}_{t}^{i}\) denotes the output vector of the \(i\)-th capsule of the feature capsule in frame \(t\) after similarity processing. The initial weight \(e_{t|b}\) is initially set to 0.