hierarchical scene coordinate classification and regression for … · 2020. 6. 11. · jdla, and...

6
Hierarchical Scene Coordinate Classification and Regression for Visual Localization —Supplementary Material— Xiaotian Li 1 Shuzhe Wang 1 Yi Zhao 1 Jakob Verbeek 2 Juho Kannala 1 1 Aalto University 2 Facebook AI Research In this supplementary material, we provide more details on network architecture, training procedure, and other ex- perimental settings. Additional qualitative results are pre- sented at the end. A. Main Experiment Details In this section, we present the experiment details on 7- Scenes, 12-Scenes, Cambridge Landmarks, and the com- bined scenes. A.1. Network Architecture We use a similar VGG-style [11] architecture as DSAC++ [2] as the base regression network, except we use ELU activation [4] instead of ReLU [7]. As mentioned in the main paper, we found that the plain regression network is faster to train with ReLU, while our network which has additional conditioning layers and classification branches works better with ELU. Conditioning layers and generators, as well as two additional classification branches, are added upon the base network for our 3-level hierarchical network which is used in the main experiments. There are three convolutional layers with stride 2 in the regression base network. The output resolution of the regression branch is thus reduced by a factor of 8. Strided convolution, dilated convolution and upconvolution are used in the two classification branches to enlarge the receptive field and preserve the output resolution. The pre- dicted classification labels are converted into one-hot for- mat before being fed into the generators. If more than one label map used as input to a conditioning generator, the la- bel maps are concatenated. The detailed architecture is given in Fig. 1. For experi- ments on 7-Scenes, 12-Scenes, Cambridge Landmarks, we use the same network architecture. For experiments on the combined scenes, we increased the number of channels for certain layers and added two more layers in the first con- ditioning generator. The additional layers are marked in red, and the increased channel counts are marked in red, blue and purple for i7-Scenes, i12-Scenes and i19-Scenes, respectively. The more compact architecture for the exper- iments (Ours capacity- in Table 2 and Fig. 3 of the main paper) on the combined scenes is illustrated in Fig. 2. In the case we use different numbers of channels for a convo- lutional layer, the channel counts are marked in red, blue and purple for i7-Scenes, i12-Scenes and i19-Scenes re- spectively. As in DSAC++ [2], our network always takes an input image of size 640 × 480. We follow the same practice to resize larger images as [2]. That is, the image is first rescaled to height 480. If its width is still larger than 640, it is cropped to width 640. Central cropping is used at test time, and random horizontal offsets are applied during train- ing. A.2. Network Training For 7-Scenes and 12-Scenes, our network is trained from scratch for 300K iterations with an initial learning rate of 10 -4 using Adam [6], and the batch size is set to 1. We halve the learning rate every 50K iterations for the last 200K iterations. For the Cambridge Landmark dataset, the dense reconstructions are far from perfect. The rendered ground truth scene coordinates contain a significant amount of out- liers, which make the training difficult. Therefore, we train the network for 600K iterations for experiments on this dataset. For the combined scenes, the network is trained for 900K iterations. As mentioned in the main paper, we found that the accu- racy of the final regression predictions is critical to high lo- calization performance. Therefore, a larger weight is given to the regression loss term. The weights for the classifi- cation loss terms w 1 , w 2 are set to 1 for all scenes. The weight for the regression loss term is set to 100,000 for the three combined scenes and 10 for the other datasets. For data augmentation, affine transformations are ap- plied to each training image. We translate, rotate, scale, shear the image by values uniformly sampled from [-20%, 20%], [-30 , 30 ], [0.7,1.5], [-10 , 10 ], respectively. In addition, we also augment the images with additive bright-

Upload: others

Post on 31-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Hierarchical Scene Coordinate Classification and Regression for … · 2020. 6. 11. · jdla, and Josef Sivic. NetVLAD: CNN architecture for weakly supervised place recognition

Hierarchical Scene Coordinate Classification and Regressionfor Visual Localization

—Supplementary Material—

Xiaotian Li1 Shuzhe Wang1 Yi Zhao1 Jakob Verbeek2 Juho Kannala11Aalto University 2Facebook AI Research

In this supplementary material, we provide more detailson network architecture, training procedure, and other ex-perimental settings. Additional qualitative results are pre-sented at the end.

A. Main Experiment DetailsIn this section, we present the experiment details on 7-

Scenes, 12-Scenes, Cambridge Landmarks, and the com-bined scenes.

A.1. Network Architecture

We use a similar VGG-style [11] architecture asDSAC++ [2] as the base regression network, except we useELU activation [4] instead of ReLU [7]. As mentioned inthe main paper, we found that the plain regression networkis faster to train with ReLU, while our network which hasadditional conditioning layers and classification branchesworks better with ELU. Conditioning layers and generators,as well as two additional classification branches, are addedupon the base network for our 3-level hierarchical networkwhich is used in the main experiments.

There are three convolutional layers with stride 2 inthe regression base network. The output resolution ofthe regression branch is thus reduced by a factor of 8.Strided convolution, dilated convolution and upconvolutionare used in the two classification branches to enlarge thereceptive field and preserve the output resolution. The pre-dicted classification labels are converted into one-hot for-mat before being fed into the generators. If more than onelabel map used as input to a conditioning generator, the la-bel maps are concatenated.

The detailed architecture is given in Fig. 1. For experi-ments on 7-Scenes, 12-Scenes, Cambridge Landmarks, weuse the same network architecture. For experiments on thecombined scenes, we increased the number of channels forcertain layers and added two more layers in the first con-ditioning generator. The additional layers are marked inred, and the increased channel counts are marked in red,blue and purple for i7-Scenes, i12-Scenes and i19-Scenes,

respectively. The more compact architecture for the exper-iments (Ours capacity- in Table 2 and Fig. 3 of the mainpaper) on the combined scenes is illustrated in Fig. 2. Inthe case we use different numbers of channels for a convo-lutional layer, the channel counts are marked in red, blueand purple for i7-Scenes, i12-Scenes and i19-Scenes re-spectively.

As in DSAC++ [2], our network always takes an inputimage of size 640 × 480. We follow the same practiceto resize larger images as [2]. That is, the image is firstrescaled to height 480. If its width is still larger than 640,it is cropped to width 640. Central cropping is used at testtime, and random horizontal offsets are applied during train-ing.

A.2. Network Training

For 7-Scenes and 12-Scenes, our network is trained fromscratch for 300K iterations with an initial learning rate of10−4 using Adam [6], and the batch size is set to 1. Wehalve the learning rate every 50K iterations for the last 200Kiterations. For the Cambridge Landmark dataset, the densereconstructions are far from perfect. The rendered groundtruth scene coordinates contain a significant amount of out-liers, which make the training difficult. Therefore, we trainthe network for 600K iterations for experiments on thisdataset. For the combined scenes, the network is trainedfor 900K iterations.

As mentioned in the main paper, we found that the accu-racy of the final regression predictions is critical to high lo-calization performance. Therefore, a larger weight is givento the regression loss term. The weights for the classifi-cation loss terms w1, w2 are set to 1 for all scenes. Theweight for the regression loss term is set to 100,000 for thethree combined scenes and 10 for the other datasets.

For data augmentation, affine transformations are ap-plied to each training image. We translate, rotate, scale,shear the image by values uniformly sampled from [-20%,20%], [−30◦, 30◦], [0.7,1.5], [−10◦, 10◦], respectively. Inaddition, we also augment the images with additive bright-

Page 2: Hierarchical Scene Coordinate Classification and Regression for … · 2020. 6. 11. · jdla, and Josef Sivic. NetVLAD: CNN architecture for weakly supervised place recognition

+

+

+

Concatenation

3x3, 1, 64

3x3, 2, 128

3x3, 2, 128

3x3, 1, 256

3x3, 2, 256

3x3, 1, 512

3x3, 1, 512

3x3, 1, 512

1x1, 1, 4096

cond

1x1, 1, 4096

cond

3x3, 1, 128/256/256/256

3x3, 2, 2, 128/256/256/256

3x3, 1, 2, 128/256/256/256

2x2, 2, 128/256/256/256

1x1, 1, 128/256/256/256

cond1x1, 1,

64/128/128/128cond

1x1, 1, 25

3x3, 2, 2, 256

3x3, 1, 2, 256 2x2, 2,

128/256/256/256

3x3, 1, 128/256/256/256

2x2, 2, 128/256/256/256

1x1, 1, 128/256/256/256

1x1, 1, 64/128/256/256

1x1, 1, 25/175/300/475

1x1, 1, 3

1x1, 1, 32/128/256/256

1x1, 1, 64/128/128/128

1x1, 1, 128

1x1, 1, 64/128/128/128

1x1, 1, 64/128/128/128

1x1, 1, 128/256/256/256

1x1, 1, 128/256/256/256

1x1, 1, 50/128/256/256

1x1, 1, 64/128/128/128

1x1, 1, 128

1x1, 1, 4096

1x1, 1, 4096

1x1, 1, 4096

1x1, 1, 4096

1x1, 1, 256

1x1, 1, 512

ArgMax ArgMax

RGB Image(W x H x 3)

Scene Coordinate Map

(W/8 x H/8 x 3)

Label Map(W/8 x H/8 x 1)

Label Map(W/8 x H/8 x 1)

Convolution(kernel size, stride, channels)

Dilated Convolution(kernel size, stride, dilation, channels)

Upconvolution(kernel size, stride, channels)

Conditioning Layer

1x1, 1, 256

1x1, 1, 256

+

+

Regression

Generator Classification

Classification

One-Hot One-Hot

Generator

Figure 1. Detailed network architecture.

3x3, 1, 64

3x3, 2, 128

3x3, 2, 128

3x3, 1, 256

3x3, 2, 256

3x3, 1, 512

3x3, 1, 512

1x1, 1, 512

1x1, 1, 512

cond

1x1, 1, 512

cond

3x3, 1, 256

3x3, 2, 2, 256

3x3, 1, 2, 256

2x2, 2, 256

1x1, 1, 256

cond

1x1, 1, 128

cond

1x1, 1, 25

3x3, 2, 2, 256

3x3, 1, 2, 256

2x2, 2, 256

3x3, 1, 256

2x2, 2, 256

1x1, 1, 256 1x1, 1,

128/256/2561x1, 1,

175/300/475

1x1, 1, 3

1x1, 1, 128/256/2561x1, 1, 128

1x1, 1, 128

1x1, 1, 128

1x1, 1, 128

1x1, 1, 256

1x1, 1, 256

1x1, 1, 128/256/2561x1, 1, 128

1x1, 1, 128

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

1x1, 1, 256

1x1, 1, 512

ArgMax ArgMax

RGB Image(W x H x 3)

Scene Coordinate Map

(W/8 x H/8 x 3)

Label Map(W/8 x H/8 x 1)

Label Map(W/8 x H/8 x 1)

1x1, 1, 512

1x1, 1, 512

3x3, 1, 512

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

cond

3x3, 1, 256

3x3, 1, 256

3x3, 1, 256

1x1, 1, 256

1x1, 1, 256

Concatenation

Convolution(kernel size, stride, channels)

Dilated Convolution(kernel size, stride, dilation, channels)

Upconvolution(kernel size, stride, channels)

Conditioning Layer

+

+

+

+

+

Regression

Generator

Classification

Generator

Classification

One-Hot One-Hot

Figure 2. The more compact architecture of Ours capacity-.

Page 3: Hierarchical Scene Coordinate Classification and Regression for … · 2020. 6. 11. · jdla, and Josef Sivic. NetVLAD: CNN architecture for weakly supervised place recognition

ness changes uniformly sampled from [-20, 20]. Whentraining without data augmentation, as with [2], we ran-domly shift the image by -4 to 4 pixels, both horizontallyand vertically, to make full use of data, as the output reso-lution is reduced by a factor of 8.

A.3. Pose Optimization

At test time, we follow the same PnP-RANSAC pipelineand parameter settings as in [2]. The inlier threshold is setto τ = 10 for all the scenes. The softness factor is set toβ = 0.5 for the soft inlier count [2]. A set of 256 initialhypotheses are sampled, and the refinement of the selectedhypothesis is performed until convergence for a maximumof 100 iterations.

A.4. Run Time

The network training takes ≈12 hours for 300K itera-tions on an NVIDIA Tesla V100 GPU, and ≈18 hours onan NVIDIA GeForce GTX 1080 Ti GPU.

At test time, it takes ≈100ms for our method to localizean image on an NVIDIA GeForce GTX 1080 Ti GPU andan Intel Core i7-7820X CPU. Scene coordinate predictiontakes 50-65ms depending on the network size. Pose opti-mization takes 30-60ms depending on the accuracy of thepredicted correspondences.

B. Experiments on the Aachen DatasetIn this section, we provide the experimental details on

the Aachen dataset.

B.1. Ground Truth Labels

Similar to the experiments on the other datasets, to gen-erate the ground truth location labels, we run hierarchicalk-means clustering on the sparse point cloud model usedin [8], which is built with COLMAP [9, 10] using Super-Point [5] as local feature detector and descriptor. For thisdataset we adopt a 4-level classification-only network. Wealso experimented with two classification-regression net-works, but the 4-level classification-only network worksbetter (see Table 5in the main paper). For the 4-levelclassification-only network, we use four-level hierarchicalk-means with the branching factor set to 100 for all levels.This results in ≈685K valid clusters at the finest level, witheach of them containing only a single 3D point. For theexperiments with the 4-level classification-regression net-work and the 3-level classification-regression network, weuse three-level and two-level hierarchical k-means with thesame branching factor setting (100 for all levels), respec-tively.

B.2. Network Architecture

As stated in the main paper, for the experiments on theAachen dataset, we use a list of sparse features as input to

the network, rather than a regular RGB image. Due to thesparse and irregular format of the input, we use 1×1 con-volutional layers in the network. We add a dummy spa-tial dimension to the input, i.e. we use a descriptor map ofsize N×1×256 as input. In addition, there are no sharedlayers between different levels. To use image-level con-textual information, every output layer including the firstone is also conditioned on an image ID. To achieve this, theencoded image ID is concatenated with the label maps (ifavailable) and then fed into the conditioning parameter gen-erators. As mentioned in the main paper, during training,we use the ID of the training image. At inference time, weadopt NetVLAD [1] for global image retrieval, and we usethe ID of a retrieved image. The detailed architecture of the4-level classification-only network is given in Fig. 3. For the4-level classification-regression network, we simply changethe last classification layer to a regression output layer. Forthe 3-level classification-regression network, one classifica-tion level is further removed.

B.3. Network Training

The network is trained from scratch for 900K iterationswith an initial learning rate of 10−4 using Adam [6], and thebatch size is set to 1, similar to the previous experiments.We halve the learning rate every 50K iterations for the last200K iterations. As in [3, 8], all images are converted tograyscale before extracting the descriptors. Random affinetransformations, brightness and contrast changes are alsoapplied to the images before the feature extraction. Duringtraining, we ignore the interest point detection, and a de-scriptor is extract from the dense descriptor map if it hasan available corresponding 3D point in the spare 3D model.Following [8], before extracting the NetVLAD [1] and Su-perPoint [5] features, the images are downsampled such thatlargest dimension is 960. At test time, for SuperPoint, Non-Maximum Suppression (NMS) with radius 4 is applied tothe detected keypoints and 2K of them with the highest key-point scores are used as the input to our network.

B.4. Pose Optimization

We follow the PnP-RANSAC algorithm as in [8] andthe same parameter settings are used. The inlier thresholdis set to τ = 10, and at most 5,000 hypotheses are sampledif no hypotheses with more than 100 inliers are found. Notethat the pose optimization is applied independently for allthe top-10 retrieved database images.

B.5. Run Time

The network training takes 2-3 days on an NVIDIATesla V100/NVIDIA GeForce GTX 1080 Ti GPU. On anNVIDIA GeForce GTX 1080 Ti GPU and an Intel Corei7-7820X CPU, it takes ≈1.1/1.4s (Aachen Day/AachenNight) for our method to localize an image. It takes

Page 4: Hierarchical Scene Coordinate Classification and Regression for … · 2020. 6. 11. · jdla, and Josef Sivic. NetVLAD: CNN architecture for weakly supervised place recognition

+

1x1, 1, 256

1x1, 1, 2048

cond

1x1, 1, 2048

cond

1x1, 1, 100

1x1, 1, 256

1x1, 1, 256

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

1x1, 1, 256

1x1, 1, 256

Descriptor Map(N x 1 x 256)

Label Map(N x 1 x 1)

Label Map(N x 1 x 1)

Label Map(N x 1 x 1)

1x1, 1, 256

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

cond

ArgMax

1x1, 1, 512

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 256

1x1, 1, 2048

cond

1x1, 1, 2048

cond

1x1, 1, 100

1x1, 1, 256

1x1, 1, 256

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

1x1, 1, 256

1x1, 1, 256

1x1, 1, 256

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

cond

ArgMax

1x1, 1, 512

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 256

1x1, 1, 2048

cond

1x1, 1, 2048

cond

1x1, 1, 100

1x1, 1, 256

1x1, 1, 128

1x1, 1, 512

1x1, 1, 128

1x1, 1, 256

1x1, 1, 256

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

ArgMax

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 256

1x1, 1, 2048

cond

1x1, 1, 2048

cond

1x1, 1, 100

1x1, 1, 128

1x1, 1, 128

1x1, 1, 512

1x1, 1, 128

1x1, 1, 256

1x1, 1, 256

1x1, 1, 512

1x1, 1, 512

1x1, 1, 512

ArgMax

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 2048

1x1, 1, 2048

Label Map(N x 1 x 1)

Encoded Image ID

Concatenation

Convolution(kernel size, stride, channels)

Conditioning Layer

+

One-Hot One-Hot One-Hot

++

GeneratorGenerator Generator Generator

Classification Classification Classification Classification

Figure 3. Detailed network architecture of the 4-level classification-only network for the Aachen dataset experiments.

≈170ms to extract the global and local descriptors. Scenecoordinate prediction takes ≈280ms (10×28ms) and poseoptimization takes ≈600/900ms (10×60/90ms) (AachenDay/Aachen Night). The time needed for global descriptormatching and the simple pre-RANSAC filtering is negligi-ble.

C. Additional Qualitative ResultsWe show in Fig. 4 the quality of scene coordinate predic-

tions for test images from 7-Scenes/i7-Scenes, and compareour method to the regression-only baseline. The scene co-ordinates are mapped to RGB values for visualization.

We show in Fig. 5 the quality of scene coordinate predic-tions for the Aachen dataset experiments. The scene coordi-nate predictions are visualized as 2D-2D matches betweenthe query and database images. We show only the inliermatches.

References[1] Relja Arandjelovic, Petr Gronat, Akihiko Torii, Tomas Pa-

jdla, and Josef Sivic. NetVLAD: CNN architecture forweakly supervised place recognition. In CVPR, 2016. 3

[2] Eric Brachmann and Carsten Rother. Learning less is more -6D camera localization via 3D surface regression. In CVPR,2018. 1, 3

[3] Eric Brachmann and Carsten Rother. Expert sample consen-sus applied to camera re-localization. In ICCV, 2019. 3

[4] Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochre-iter. Fast and accurate deep network learning by exponentiallinear units (ELUs). arXiv:1511.07289, 2015. 1

[5] Daniel DeTone, Tomasz Malisiewicz, and Andrew Rabi-novich. SuperPoint: Self-supervised interest point detectionand description. In CVPR Workshops, 2018. 3

[6] Diederik P Kingma and Jimmy Ba. Adam: A method forstochastic optimization. arXiv:1412.6980, 2014. 1, 3

[7] Vinod Nair and Geoffrey E Hinton. Rectified linear unitsimprove restricted boltzmann machines. In ICML, 2010. 1

[8] Paul-Edouard Sarlin, Cesar Cadena, Roland Siegwart, andMarcin Dymczyk. From coarse to fine: Robust hierarchicallocalization at large scale. In CVPR, 2019. 3

[9] Johannes Lutz Schonberger and Jan-Michael Frahm.Structure-from-motion revisited. In CVPR, 2016. 3

[10] Johannes Lutz Schonberger, Enliang Zheng, Marc Pollefeys,and Jan-Michael Frahm. Pixelwise view selection for un-structured multi-view stereo. In ECCV, 2016. 3

[11] Karen Simonyan and Andrew Zisserman. Very deepconvolutional networks for large-scale image recognition.arXiv:1409.1556, 2014. 1

Page 5: Hierarchical Scene Coordinate Classification and Regression for … · 2020. 6. 11. · jdla, and Josef Sivic. NetVLAD: CNN architecture for weakly supervised place recognition

i7-S

cene

s

Heads Office Stairs

RGB ImageGround Truth Scene Coordinates

Inlier Scene Coordinates

Predicted Scene Coordinates

RGB ImageGround Truth Scene Coordinates RGB Image

Ground Truth Scene Coordinates

Inlier Scene Coordinates

Predicted Scene Coordinates

Inlier Scene Coordinates

Predicted Scene Coordinates

Our

sR

egre

ssio

n-O

nly

7-S

cene

si7

-Sce

nes

7-S

cene

s

Figure 4. We visualize the scene coordinate predictions for three test images from 7-Scenes/i7-Scenes. The XYZ coordinates are mappedto RGB values. The ground truth scene coordinates are computed from the depth maps, and invalid depth values (0, 65535) are ignored.Should a scene coordinate prediction be out of the scope of the corresponding individual scene, the prediction is treated as invalid and notvisualized. We also visualize the inlier scene coordinates retained after the pose optimization (PnP-RANSAC) stage. On both 7-Scenesand i7-Scenes, our method produces consistently better scene coordinate predictions with more inliers compared to the regression-onlybaseline.

Page 6: Hierarchical Scene Coordinate Classification and Regression for … · 2020. 6. 11. · jdla, and Josef Sivic. NetVLAD: CNN architecture for weakly supervised place recognition

Figure 5. We show the scene coordinate predictions for the Aachen dataset experiments. The scene coordinate predictions are visualized as2D-2D matches between the query (left) and database (right) images. For each pair, the retrieved database image with the largest numberof inliers is selected, and only the inlier matches are visualized. We show that our method is able to produce accurate correspondences forchallenging queries (left column). Failure cases are also given (right column).