# Monocular Vision-Based Depth Estimation of Forward-Looking Scenes for Mobile Platforms
## 2 Methodology
### Attention Mechanism  
As an effective strategy to enhance the performance of CNNs, the channel attention mechanism adjusts the weight of each channel according to its importance in relation to the features. This adjustment improves the significance of the relevant channels. The channel attention module aids the depth estimation network in extracting salient features while suppressing irrelevant ones, thereby enhancing overall performance. Currently, SENet [25] and ECANet [26] are two typical channel attention mechanisms. The primary operations of SENet involve Squeeze and Excitation, which enhance the model's ability to perceive salient features. However, the inclusion of two fully connected layers within the SENet architecture leads to a significant increase in parameters and computational costs, as well as a heightened risk of overfitting. Additionally, the attention mechanism of SENet is based on global features, which limits its adaptability to small datasets and results in considerable performance fluctuations depending on dataset size. In contrast, ECANet addresses the limitations of SENet and has been widely adopted across various visual tasks.  
The benefits of ECANet are evident in three key aspects: (1) ECANet replaces fully connected layers with multiple 1D convolutions, leading to a significant reduction in network parameters while enhancing computational efficiency. (2) ECANet employs a local cross-channel interaction strategy without dimensionality reduction, effectively capturing the interactive relationships between feature channels through 1D convolutions. This approach mitigates the negative effects of dimensionality reduction and improves the network's feature extraction capabilities. (3) ECANet utilizes an adaptive method to adjust the size of the convolution kernel, allowing the network to accommodate feature maps of varying scales and enhancing the model's generalization ability. Consequently, the proposed method integrates ECANet into each layer of the decoder to improve overall network performance.  
As shown in Figure 4, ECANet primarily consists of global average pooling (GAP), a 1D convolution with a kernel size of 1\(\times k\), the sigmoid activation function, and other related operations. If the input feature map of ECANet is denoted as \(\mathbf{U}=[\mathbf{u}_{1},\mathbf{u}_{2},\ldots,\mathbf{u}_{s}]\in\mathbb{R} ^{h\times w\times s}\), ECANet initially conducts independent GAP on each channel.  
\[z_{n}=GAP(\mathbf{u}_{n})=\frac{1}{h\times w}\sum_{i=1}^{h}\sum_{j=1}^{w} \mathbf{u}_{n}(i,j) \tag{5}\]  
where \(\mathbf{u}_{n}\in\mathbb{R}^{h\times w}\) represents the feature map of the channel \(n\), \(GAP(\cdot)\) denotes the GAP operation, and \(\mathbf{Z}=[z_{1},z_{2},\ldots,z_{s}]\in\mathbb{R}^{1\times 1\times s}\).  
To capture the local cross-channel interactions, we focus on the interactions between each channel and its nearest neighbors. The channel attention weight for each channel can then be calculated using Equation (6).  
\[\mathbf{Z}^{\prime}=\sigma\Big{(}C_{k}^{1D}(\mathbf{Z})\Big{)} \tag{6}\]  
where \(C_{k}^{1D}(\cdot)\) is the 1D convolution operation with a kernel size of \(k\), \(\sigma(\cdot)\) denotes the sigmoid activation function, and \(\mathbf{Z}^{\prime}=[z_{1}{}^{\prime},z_{2}{}^{\prime},\ldots,z_{s}{}^{\prime}]\) is the corresponding weights of different channels.  
Each element \(z_{i}^{\prime}\) of the weight vector \(\mathbf{Z}^{\prime}\) is multiplied by the corresponding channel \(\mathbf{u}_{i}\) of the input feature map \(\mathbf{U}\) to generate a new feature map \(\mathbf{U}^{\prime}=[\mathbf{u}_{1}{}^{\prime},\mathbf{u}_{2}{}^{\prime}, \ldots,\mathbf{u}_{s}{}^{\prime}]\). Generally, the value of \(k\) is determined by the channel number of the feature map \(s\) and can be calculated as follows [26]:  
\[k=\left|\frac{\log_{2}(s)+1}{2}\right|_{odd} \tag{7}\]  
where \(\left|\cdot\right|_{odd}\) means to obtain the nearest odd number from the value in parentheses.