Paper Notes: ASLFeat: Learning Local Features of Accurate Shape and Localization
This paper builds on D2-Net and introduces two main improvements:
1) Using Deformable Convolution for dense transformation estimation and feature extraction
2) Using a feature pyramid to accommodate different spatial resolutions and low-level details to localize keypoints precisely
1 Methods
1.1 Prerequisites
The network design in this paper builds on two prior works: DCN and D2-Net. Let’s first review the main ideas behind each:
Deformable convolutional networks (DCN)
Deformable Convolutional Networks (DCN) are primarily designed to learn dynamic receptive fields. The formula for conventional convolution is:
\begin{equation}\mathbf{y}(\mathbf{p})=\sum_{\mathbf{p}_{n} \in \mathcal{R}} \mathbf{w}\left(\mathbf{p}_{n}\right) \cdot \mathbf{x}\left(\mathbf{p}+\mathbf{p}_{n}\right)\end{equation}
Here, \mathbf{p} denotes the coordinates of the convolution center, \mathbf{p}_{n} denotes an offset within the convolution grid \mathcal{R}, and \mathbf{x}(\cdot) gives the pixel value at the specified location. DCN extends this formulation by adding a predicted offset \Delta p and a feature weight \Delta m:
\begin{equation}\mathbf{y}(\mathbf{p})=\sum_{\mathbf{p}_{n} \in \mathcal{R}} \mathbf{w}\left(\mathbf{p}_{n}\right) \cdot \mathbf{x}\left(\mathbf{p}+\mathbf{p}_{n}+\Delta \mathbf{p}_{n}\right) \cdot \Delta \mathbf{m}_{n}\end{equation}
Since \Delta p typically takes fractional values, the implementation uses nonlinear interpolation.
D2-Net
The core idea behind D2-Net is to combine the descriptor and detector in a single describe-and-detect approach. It learns a feature map, obtains local descriptors through L2 normalization, and computes the detector scores from y as follows:
Compute the local score:
\begin{equation}\alpha_{i j}^{c}=\frac{\exp \left(\mathbf{y}_{i j}^{c}\right)}{\sum_{\left(i^{\prime}, j^{\prime}\right) \in \mathcal{N}(i, j)} \exp \mathbf{y}_{i^{\prime} j^{\prime}}^{c}}\end{equation}
Here, \mathcal{N}(i, j) denotes the pixel neighborhood. For example, a 3 \times 3 convolution uses a neighborhood of nine pixels.
Compute the channel-wise score:
\begin{equation}\beta_{i j}^{c}=\mathbf{y}_{i j}^{c} / \max _{t} \mathbf{y}_{i j}^{t}\end{equation}
The final detector score is the maximum of the product of these two scores:
Building on this approach, the paper proposes the improvements described below.
1.2 DCN with Geometric Constraints
The authors argue that the original DCN has too many degrees of freedom and can predict arbitrary deformations. In visual localization, however, the deformation is global and has only a limited number of degrees of freedom. It typically takes one of three forms: 1) similarity, 2) affine, or 3) homography:
As a result, conventional DCN learns unnecessary parameters without guaranteeing that the geometric constraints are satisfied. The authors address this by imposing geometric constraints on DCN.
Affine-constrained DCN
An affine transform that includes rotation and scaling typically takes the following form:
\begin{equation}\mathbf{S}=\lambda R(\theta)=\lambda\left(\begin{array}{cc}\cos (\theta) & \sin (\theta) \\-\sin (\theta) & \cos (\theta)\end{array}\right)\end{equation}
Some papers, such as AffNet, also introduce a shear coefficient. Following that approach, this paper defines the affine transform as:
Homography-constrained DCN
A homography can typically be determined from four point correspondences. Following the approach in “Unsupervised deep homography,” this paper uses a differentiable linear solver to obtain the H matrix. The linear system is typically written as \mathbf{M h}=\mathbf{0}, where \mathbf{M} \in \mathbb{R}^{8 \times 9}. Here, \mathbf{h} is a nine-dimensional vector representing the nine parameters of the matrix \mathbf{H}. Three constraints, \mathbf{H}_{33}=1 and \mathbf{H}_{31}=\mathbf{H}_{32}=-, must be satisfied, leaving six parameters. The linear system can then be rewritten as \hat{\mathbf{M}}_{(i)} \hat{\mathbf{h}}=\hat{\mathbf{b}}_{(i)}, where \hat{\mathbf{M}}_{(i)} \in \mathbb{R}^{2 \times 6}. For each pair of corresponding points (u_i, v_i) and (u_i', v_i'), we have:
\begin{equation}\hat{\mathbf{M}}_{(i)}=\left[\begin{array}{cccccc}0 & 0 & -u_{i} & -v_{i} & v_{i}^{\prime} u_{i} & v_{i}^{\prime} v_{i} \\u_{i} & v_{i} & 0 & 0 & -u_{i}^{\prime} u_{i} & -u_{i}^{\prime} v_{i}\end{array}\right]\end{equation}and:
\begin{equation}\hat{\mathbf{b}}_{(i)}=\left[-v_{i}^{\prime}, u_{i}^{\prime}\right]^{T} \in \mathbb{R}^{2 \times 1}\end{equation}The resulting linear system is:
\begin{equation}\hat{\mathbf{M}} \hat{\mathbf{h}}=\hat{\mathbf{b}}\end{equation}The differentiable linear solver (tf.matrix solve) can then be used to obtain \mathbf{h}.
In practice, we use the four offsets {(−1, −1),(1, −1),(1, 1),(−1, 1)} and multiply them by \mathbf{H} to obtain the new offsets.
With the geometric transformations defined above, the geometrically constrained offsets are computed as follows:
\begin{equation}\triangle \mathbf{p}_{n}=\mathbf{T} \mathbf{p}_{n}-\mathbf{p}_{n}, \text { where } \mathbf{p}_{n} \in \mathcal{R}\end{equation}1.3 Selective and Accurate Keypoint Detection
Keypoint peakiness measurement
In D2-Net, the detector score combines spatial and channel-wise responses. The channel-wise score uses a ratio-to-max calculation, which may make the score less representative of the actual distribution of responses across channels (?). With this in mind, the authors revise both scores as follows, aiming to use response peakiness as the basis for the detector score:
\begin{equation}\beta_{i j}^{c}=\operatorname{softplus}\left(\mathbf{y}_{i j}^{c}-\frac{1}{C} \sum_{t} \mathbf{y}_{i j}^{t}\right)\end{equation}Similarly:
\begin{equation}\alpha_{i j}^{c}=\operatorname{softplus}\left(\mathbf{y}_{i j}^{c}-\frac{1}{|\mathcal{N}(i, j)|} \sum_{\left(i^{\prime}, j^{\prime}\right) \in \mathcal{N}(i, j)} \mathbf{y}_{i^{\prime} j^{\prime}}^{c}\right)\end{equation}The softplus activation function is defined as:
\begin{equation}f(x)=\ln \left(1+e^{x}\right)\end{equation}Multi-level keypoint detection (MulDet)
D2-Net does not localize keypoints precisely enough because it detects them from a low-resolution feature map. There are several ways to recover spatial resolution (as shown below), such as training an additional feature decoder or using dilated convolutions. However, these methods either increase the number of learnable parameters or require substantial GPU memory or computing power.
The authors propose a simple and effective solution that requires no additional learnable weights. It uses the convolutional network’s built-in feature pyramid to combine detections from multiple feature levels, an approach known as hierarchical scale fusion.
\begin{equation}\hat{\mathbf{s}}=\frac{1}{\sum_{l} w_{l}} \sum_{l} w_{l} \mathbf{s}^{(l)}\end{equation}The final score at each location is the weighted average of the scores at that location across levels.
1.4 Learning Framework
Network architecture
The final network architecture is shown below:
As in VGG, the network uses two conv layers per scale. The final stage uses three deformable conv layers (conv6, conv7, and conv8), and MulDet uses features from conv1, conv3, and conv8.
In Equation 14, w_{i}=1,2,3, and in Equation 3, \mathcal{N}(i, j)=3,2,1.
Loss design
Let \mathcal{C} denote the set of keypoint correspondences in the image pair (I, I^{\prime}). Following D2-Net, the loss is defined as:
\begin{equation}\mathcal{L}\left(I, I^{\prime}\right)=\frac{1}{|\mathcal{C}|} \sum_{c \in \mathcal{C}} \frac{\hat{s}_{c} \hat{s}_{c}^{\prime}}{\sum_{q \in \mathcal{C}} \hat{s}_{q} \hat{s}_{q}^{\prime}} \mathcal{M}\left(\mathbf{f}_{c}, \mathbf{f}_{c}^{\prime}\right)\end{equation}Here, \hat{S}_{k} and \hat{S}_{k}^{\prime} are the detector scores for (I and I^{\prime}), respectively, while \mathbf{f}_{k} and \mathbf{f}_{k}^{\prime} are the descriptors. The ranking loss \mathcal{M}(\cdot, \cdot) replaces the hardest-triplet loss used in D2-Net. Here, we define \mathcal{M} as:
\begin{equation}\begin{array}{l}\mathcal{M}\left(\mathbf{f}_{c}, \mathbf{f}_{c}^{\prime}\right)=\left[D\left(\mathbf{f}_{c}, \mathbf{f}_{c}^{\prime}\right)-m_{p}\right]_{+}+ \\\quad\left[m_{n}-\min \left(\min _{k \neq c} D\left(\mathbf{f}_{c}, \mathbf{f}_{k}^{\prime}\right), \min _{k \neq c} D\left(\mathbf{f}_{k}, \mathbf{f}_{c}^{\prime}\right)\right)\right]_{+}\end{array}\end{equation}Here, D(\cdot, \cdot) denotes Euclidean distance, and m_p and m_n are 0.2 and 1.0, respectively.
2 Experiments
2.1 Image Matching
The experimental results are as follows:
2.2 Comparisons with other methods
The experimental results are as follows
2.3 3D Reconstruction
The experimental results are as follows:
2.4 Visual Localization
The experimental results are as follows:
Paper & Source Code
Paper
https://arxiv.org/abs/2003.10071
Source Code
https://github.com/lzx551402/ASLFeat
References
[1] https://blog.csdn.net/phy12321/article/details/106040545
[2] https://www.jianshu.com/p/c184c2efbecc









