## 3 Method
### Cost Volume Aggregation
#### 3.3.1 Epipolar Transformer  
Cost volume construction is the process of aggregating feature volumes from different source views to obtain depth information for individual pixels in the reference view. As conventional variance-based aggregation methods often struggle to filter out noise effectively, this paper employs an epipolar Transformer for aggregating feature volumes from different views. Specifically, the Transformer's cross-attention mechanism is used to build a 3D correlation along the epipolar line direction between the reference feature \(p_{r}\) (Query) and source features \(\left\{p_{sij}\right\}_{j=0}^{D-1}\) (Keys). And use the cross-dimensional attention to guide the aggregation of feature volumes from different views, ultimately achieving cross-dimensional cost volume aggregation. The detailed structure of the module is illustrated in Figure 4.  
Common shallow 2D CNNs can only extract texture features within a fixed receptive field and struggle to capture finer details in regions with weak textures. Therefore, this paper employs the computationally intensive cascaded U-Net for query construction. Guided by Equation (1), the projection transformation of source view features restores the depth information of 2D query features. To ensure 3D consistency in depth space, we adopt a cross-attention mechanism along the epipolar line direction to establish 2D semantic and 3D spatial depth correlations. This involves the 3D correlation between the pixel feature of the reference view, \(p_{r}\) (Query), and the source features mapped to the epipolar line, \(\left\{p_{sij}\right\}_{j=0}^{D-1}\) (Keys). The attention weights, \(w_{i}\), are computed to achieve this, as shown in Equation (3).  
\[w_{i}=softmax\bigg{(}\frac{v_{i}{}^{T}p_{r}}{t_{e}\sqrt{\mathbb{C}}}\bigg{)}, \tag{3}\]  
where \(t_{e}\) represents the temperature parameter. The \(\left\{p_{sij}\right\}_{j=0}^{D-1}\) are stacked along the depth dimension to form \(v_{i}\in\mathbb{R}^{C\times D}\). Previous studies [35; 36] have indicated that utilizing group-wise correlations to group feature volumes can reduce the computational and storage requirements of the model during cost volume construction. Therefore, this paper employs group-wise correlations to partition the feature volumes into \(g\) groups along the feature dimension,  
Figure 4: Flowchart of epipolar Transformer aggregation.  
where \(g=0,\ldots,G-1\). Based on the inner product calculation in Equation (4), the similarity \(s_{i}\in R^{G\times D}\) is computed between the source view feature volumes and the reference view feature volume. The obtained \(s_{i}\) serves as the values for the cross-attention mechanism.  
\[s_{i}^{g}=\frac{1}{G}\langle v_{i}^{g},p_{r}^{g}\rangle \tag{4}\]  
In this context, the \(g\)-th group feature of \(v_{i}\) is denoted as \(v_{i}^{g}\in R^{\frac{G}{G}\times D}\), where \(\langle\cdot,\cdot\rangle\) represents the inner product. \(s_{i}\in R^{G\times D}\) are obtained by stacking \(\left\{s_{i}^{g}\right\}_{g=0}^{G-1}\) along the channel dimension. Finally, the values of the epipolar attention mechanism are guided and aggregated for stage \(n\) by the \(w_{i}\), resulting in the stage-wise aggregated cost volume \(C_{agg}^{n}\). The specific operations are detailed in Formula (5).  
\[C_{agg}^{n}=\frac{\sum_{i=1}^{N-1}w_{i}s_{i}}{\sum_{i=1}^{N-1}w_{i}} \tag{5}\]