## 3 Dynamic Anchor
### Anchor Generator
#### 3.1.1 Anchor Shape Targets
\begin{array}{c}w^{*}=w_{gt}\cdot h_{gt}/2t\\ h^{*}=w_{gt}\cdot h_{gt}/2l\\ \lambda_{1}=\lambda_{2}=\lambda_{3}=\lambda_{4}=0\\ \end{array} \right. \tag{5}\]  
\[\text{Solution 2}:~{}\left\{ \begin{array}{c}w^{*}=2r\\ h^{*}=2b\\ \lambda_{1}=\lambda_{3}=0\\ \lambda_{2}=\left(w_{gt}\cdot h_{gt}-4b\cdot l\right)/\left(2\cdot w_{gt}{}^{2 }\cdot h_{gt}\right)\\ \lambda_{4}=\left(w_{gt}\cdot h_{gt}-4r\cdot t\right)/\left(2\cdot w_{gt}{}^{ 4}\cdot h_{gt}{}^{2}\right)\\ \end{array} \right. \tag{6}\]  
\[\text{Solution 3}:~{}\left\{ \begin{array}{c}w^{*}=w_{gt}\\ h^{*}=h_{gt}\\ \lambda_{2}=\lambda_{4}=0\\ \lambda_{1}=h_{gt}\cdot(2l-w_{gt})/\left(\big{(}h_{gt}+2l\big{)}\cdot\big{(}w_{ gt}/2+l\big{)}^{2}\right)\\ \lambda_{2}=w_{gt}\cdot(2t-h_{gt})/\left(\big{(}w_{gt}+2l\big{)}\cdot\big{(}h_{ gt}/2+l\big{)}^{2}\right)\\ \end{array} \right. \tag{7}\]Infeasible Solutions:  
\[\text{Solution 4}:\left\{ \begin{array}{c}w^{*}=2r\\ h^{*}=h_{gt}\\ \lambda_{1}=\lambda_{4}=0\\ \lambda_{2}=h_{gt}\cdot\left(2r-w_{gt}\right)/\left(\left(h_{gt}+2t\right)\cdot w _{gt}{}^{2}\right)\\ \lambda_{3}=\left(2 rt-w_{gt}\cdot h_{gt}{}^{2}\right)/\left(w_{gt}\cdot\left( h_{gt}/2+t\right){}^{2}\right)\end{array} \right. \tag{8}\]  
\[\text{Solution 5}:\left\{ \begin{array}{c}w^{*}=w_{gt}\\ h^{*}=2b\\ \lambda_{2}=\lambda_{3}=0\\ \lambda_{1}=\left(2 bl-w_{gt}\cdot h_{gt}/2\right)/\left(h_{gt}\cdot\left(w_{ gt}/2+l\right){}^{2}\right)\\ \lambda_{4}=w_{gt}\cdot\left(2b-h_{gt}\right)/\left(\left(w_{gt}+2l\right){} \cdot h_{gt}{}^{2}\right)\end{array} \right. \tag{9}\]  
We remove the solutions that do not satisfy the non-negativity condition and finally obtain three local optimal solutions:  
\[\left(w^{*},\,h^{*}\right)\in\left\{\left(w_{gt}\cdot h_{gt}/2t,w_{gt}\cdot h _{gt}/2l\right),\,\left(2r,\,2b\right),\,\left(w_{gt},h_{gt}\right)\right\} \tag{10}\]  
Solution 1 firstly involves the ground-truth box \(\left(w_{gt},h_{gt}\right)\) and another two parameters \(\left(t,1\right)\), which increases the difficulty of network prediction. In addition, the division operation will lose accuracy, so we do not adopt solution 1 as the optimal anchor box solution. For solution 3, for all feature points falling in the ground-truth box, their corresponding optimal prediction anchor frame are the same, which is obviously unreasonable. Besides, Guided Anchor uses \(\left(w_{gt},h_{gt}\right)\) as the prediction target of the anchor box, and in the subsequent performance comparison, dynamic anchor with \(\left(2r,\,2b\right)\) as the prediction target is superior to Guided Anchor. Finally, we chose solution 2 \(\left(2r,2b\right)\) as the anchor shape target. The general solution is \(w^{*}=2\times\max(t,b)\) and \(h^{*}=2\times\max(l,r)\). As shown in Figure 3b, the best anchor box \(\left(x,y,2r,2b\right)\) completely surrounds the ground-truth box \(\left(x_{gt},y_{gt},w_{gt},h_{gt}\right)\). Under the condition that the predicted anchors are accurate, it can be considered that the objects mainly exist in the region of the anchor boxes. Later, we use the predicted anchors for feature enhancement to improve the feature extraction ability of the network.