# YOLO-DFAN: Effective High-Altitude Safety Belt Detection Network
## 3 Proposed Method
### Dependency Fusing Attention Network  
The structure of the DFAN proposed in this paper is illustrated in Figure 4.  
Figure 4: Dependency fusing attention network (DFAN) structure. Figure 3: Atrous spatial pyramid pooling network (ASPPNet) structure. Figure 2: YOLO-DFAN network structure. We encoded channel direction dependencies without dimensionality reduction in the first branch:  
\[C_{map}=\sigma(\varphi_{1}(g_{1}(x))+\varphi_{2}(g_{2}(x))), \tag{1}\]  
The input feature map is first input into the global average pooling layer \(g_{1}(x)\) to capture the global spatial information. The global max-pooling layer \(g_{2}(x)\) is used to encode the features of the most significant part to compensate for the softly encoded average-pooled features. Then, the channel information of the k-nearest neighbors is aggregated by the one-dimensional (1D) convolutional layer \(\varphi(x)\) with the kernel size K. The activation function \(\sigma(x)\) is used to activate a self-gating mechanism so that the information with a higher response produces larger weights in comparison, with the weights of each channel as follows:  
\[\omega_{c(i)}^{c(C,1,1)}=\sigma(\sum_{l=1}^{K}W_{1}^{l}(\frac{1}{wh}\sum_{j=1,k =1}^{h,w}X_{i,j,k})_{l}+\sum_{l=1}^{K}W_{2}^{l}(maxX_{i,1\leq j\leq h,1\leq k \leq w})), \tag{2}\]  
where \(\sigma(x)\) is the sigmoid activation function, W represents the parameter representation matrix of the 1D convolution, and \(\left(\frac{1}{wh}\sum_{j=1,k=1}^{h,w}X_{i,j,k}\right)_{l}\) denotes the information of the \(i+1\)-th channel after the aggregation space. These weights emphasize the more useful channel features (i.e., the whole branch improves the usefulness of feature channels by encoding the interdependence between the channels of the features). For the second branch, we used two spatial extents of pooling kernels (H, 1) or (1, W) to encode each channel along the horizontal and vertical directions, respectively. These two feature maps contain direction-specific information and are separately encoded by the activation function into two attention mappings, each of which captures the long-range information of the input feature map in one spatial direction. Afterward, a 1D convolution is separately added to fuse the spatial linkage information with the k-nearest neighbors in the x-direction and the spatial linkage information with the k-nearest neighbors in the y-direction. In this way, the long-range vectors in both directions acquire rich spatial dependencies and capture more spatial information around the object feature region, which can have a scoring influence on the region of interest. The encoded attention map is obtained as follows:  
\[H_{map}=\sigma_{1}(\varphi_{1}(\theta((g_{1}(X))))), \tag{3}\]  
\[W_{map}=\sigma_{2}(\varphi_{2}(\theta((g_{2}(X))))), \tag{4}\]  
where \(\sigma(x)\) denotes the sigmoid function; \(\varphi(x)\) is the 1D convolutional function; \(\theta(x)\) represents the intermediate concatenation, regularization, act, and split operations; and \(g(x)\) denotes the global average pooling layer. The feature mapping information of the two vectors is as follows:  
\[\omega_{h}^{i}=\sigma(\sum_{l=1}^{K}W_{1}^{l}(\alpha(\frac{1}{hw}\sum_{j=1}^{ w}X_{c,i,j}))_{l}), \tag{5}\]  
\[\omega_{w}^{i}=\sigma(\sum_{l=1}^{K}W_{2}^{l}(\alpha(\frac{1}{h}\sum_{j=1}^{ h}X_{c,j,i}))_{l}), \tag{6}\]  
where \(\left(\alpha(\frac{1}{w}\sum_{j=1}^{w}X_{c,i,j})\right)_{l}\) denotes the information value of the \(i+1\)-th position of the spatial vector in the h-direction and \(\left(\alpha(\frac{1}{h}\sum_{j=1}^{h}X_{c,j,i})\right)_{l}\) is the information value of the \(i+1\)-th position of the spatial vector in the w-direction. By encoding the two spatial long-range vectors in a fused nearest neighbors fashion, more location information in the object region yielding score information about the region of interest can be preserved in the generated spatial attention map, focusing the network on a richer and more accurate localization of the region of interest of the objects.