{'fraction_non_alphanumeric': 0.0371066228276186, 'fraction_numerical': 0.01427378529304316, 'mean_word_length': 4.577499636151943, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Neural Geometric Parser for Single Image Camera Calibration

We propose a neural geometric parser learning single image camera calibration for man-made scenes. Unlike previous neural approaches that rely only on semantic cues obtained from neural networks, our approach considers both semantic and geometric cues, resulting in significant accuracy improvement. The proposed framework consists of two networks. Using line segments of an image as geometric cues, the first network estimates the zenith vanishing point and generates several candidates consisting of the camera rotation and focal length. The second network evaluates each candidate based on the given image and the geometric cues, where prior knowledge of man-made scenes is used for the evaluation. With the supervision of datasets consisting of the horizontal line and focal length of the images, our networks can be trained to estimate the same camera parameters. Based on the Manhattan world assumption, we can further estimate the camera rotation and focal length in a weakly supervised manner. The experimental results reveal that the performance of our neural approach is significantly higher than that of existing state-of-the-art camera calibration techniques for single images of indoor and outdoor scenes.


Introduction
This paper deals with the problem of inferring camera calibration parameters from a single image. It is used in various applications of computer vision and graphics, including image rotation correction [12], perspective control [21], camera rotation estimation [38], metrology [9], and 3D vision [16,23]. Due to its importance, single image camera calibration has been revisited in various ways.
Conventional approaches focus on reasoning vanishing points (VPs) in images by assembling geometric cues in the images. Most methods find straight line segments in the images using classic image processing techniques [15,2] and then estimate the VPs by carefully selecting parallel or orthogonal segments in the 3D scene as geometric cues [21]. In practice, however, line segments found in images contain a large amount of noisy data, and it is therefore important to carefully select an inlier set of line segments for the robust detection of VPs [13,28]. Because the accuracy of the inlier set is an important performance indicator, the elapsed time may exponentially increase if stricter criteria are applied to draw the inlier set.
Recently, several studies have proposed estimating camera intrinsic parameters using semantic cues obtained from deep neural networks. It has been investigated [31,32,18] that well-known backbone networks, such as ResNet [17] and U-Net [25], can be used to estimate the focal length or horizon line of an image without significant modifications of the networks. In these approaches, however, it is difficult to explain which geometric interpretation inside of the networks infers certain camera parameters. In several studies [38,33], neural networks were designed to infer geometric structures; however, they required a new convolution operator [38] or 3D supervision datasets [33].
In this paper, we propose a novel framework for single image camera calibration that combines the advantages of both conventional and neural approaches. The basic idea is for our network to leverage line segments to reason camera parameters. We specifically focus on calibrating camera parameters from a single image of a man-made scene. By training with image datasets annotated with horizon lines and focal lengths, our network infers pitch, roll, and focal lengths (3DoF) and can further estimate camera rotations and focal lengths through three VPs (4DoF).
The proposed framework consists of two networks. The first network, the Zenith Scoring Network (ZSNet), takes line segments detected from the input image and deduces reliable candidates of parallel world lines along the zenith VP. Then, from the lines directed at the zenith VP, we generate candidate pairs consisting of a camera rotation and a focal length as inputs of the following step. The second network, the Frame Scoring Network (FSNet), evaluates the score of its input in conjunction with the given image and line segment information.
Here, geometric cues from the line segments are used as prior knowledge about the man-made scenes in our network training. This allows us to obtain significant improvement over previous neural methods that only use semantic cues [32,18]. Furthermore, it is possible to estimate camera rotation and focal length in a weakly supervised manner based on the Manhattan world assumption, as we reason camera parameters with pairs consisting of a camera rotation and a focal length. It should be noted that the ground truth for our supervisions is readily available with Google Street View [1] or with consumer-level devices possessing a camera and an inertial measurement unit (IMU) sensor, in contrast to the method in [33], which requires 3D supervision datasets.

Related Work
Projective geometry [16,23] has historically stemmed from the study on imaging of perspective distortions occurring in the human eyes when one observes manmade architectural scenes [3]. In this regard, conventional methods of single image camera calibration [8,20,26,11,29,30,35,21] involve extracting line segments from an image, inferring the combinations of world parallel or orthogonal lines, identifying two or more VPs, and finally estimating the rotation and focal length of the camera. LSD [15] or EDLine [2] were commonly used as effective line segment detectors, and RANSAC [13] or J-Linkage [28] were adopted to identify VPs describing as many of the extracted line segments as possible. Lee et al . [21] proposed robust estimation of camera parameters and automatic adjustment of camera poses to achieve perspective control. Zhai et al . [37] analyzed the global image context with a neural network to estimate the probability field in which the horizon line was formed. In their work, VPs were inferred with geometric optimization, in which horizontal VPs were placed on the estimated horizon line.
Simon et al . [27] achieved better performance than Zhai et al . [37] by inferring the zenith VP with a geometric algorithm and carefully selecting a line segment orthogonal to the zenith VP to identify the horizon line. Li et al . [22] proposed a quasi-optimal algorithm to infer VPs from annotated line segments.
Recently, neural approaches have been actively studied to infer camera parameters from a single image using semantic cues learned by convolutional neural networks. Workman et al . proposed DeepFocal [31] for estimating focal lengths and DeepHorizon [32] for estimating horizon lines using semantic analyses of images with neural networks. Hold-Geoffroy et al . [18] trained a neural classifier that jointly estimates focal lengths and horizons. They demonstrated that their joint estimation leads to more accurate results than those produced by independent estimations [31,32]. Although they visualized how the convolution filters react near the edges (through the method proposed by Zeiler and Fergus [36]), it is difficult to intuitively understand how the horizon line is geometrically determined through the network. Therefore, [31,32,18] have a common limitation that it is non-trivial to estimate VPs from the network inference results. Zhou et al . [38] proposed NeurVPS that infers VPs with conic convolutions for a given image. However, NeurVPS [38] assumes normalized focal lengths and does not estimate focal lengths.
Inspired by UprightNet [33], which takes geometric cues into account, we propose a neural network that learns camera parameters by leveraging line segments. Our method can be compared to Lee et al . [21] and Zhai et al . [37], where line segments are used to infer the camera rotation and focal length. However, in our proposed method, the entire process is designed with neural networks. Similar to Workman et al . [32] and Hold-Geoffroy et al . [18], we utilize semantic cues from neural networks but our network training differs in that line segments are utilized as prior knowledge about man-made scenes. Unlike UprightNet [18], which requires the supervisions of depth and normal maps for learning roll/pitch (2DoF), the proposed method learns the horizon and focal length (3DoF) with supervised learning and the camera rotation and focal length (4DoF) with weakly supervised learning.
The relationship between our proposed method and the latest neural RANSACs [6,7,19] is described below. Our ZSNet is related to neural-guided RANSAC [7] in that it updates the line features with backpropagation when learning to sample zenith VP candidates. In addition, our FSNet is related to DSAC [6] in that it evaluates each input pair consisting of a camera rotation and focal length based on the hypothesis on man-made scenes. Our work differs from CONSAC [19], which requires the supervision of all VPs, as we focus on learning single image camera calibrations from the supervision of horizons and focal lengths.

Neural Geometric Parser for Camera Calibration
From a given input image, our network estimates up to four camera intrinsic and extrinsic parameters; the focal length f and three camera rotation angles ψ, θ, φ. Then, a 3D point (P x , P y , P z ) T in the world coordinate is projected onto the image plane as follows: where (p x , p y , p w ) T represents the mapped point in the image space, and R ψ , R θ , R φ represent the rotation matrices along x-, y-, and z-axes, with rotation angles ψ, θ, φ, respectively. The principal point is assumed to be on the image center such that c u = W/2 and c v = H/2, where W and H represent the width and height of the image, respectively. Under the Manhattan world assumption, calibration can be done once we obtain the Manhattan directions, which are three VPs corresponding to x-, y-, and z-directions in 3D [8]. In Sec. 3.1, we describe how to extract a set of candidate VPs along the zenith direction. Then, in Sec. 3.2, we present our weakly supervised method for estimating all three directions and calibrating the camera parameters.
We use LSD [15] as a line segment detector in our framework. A line segment is represented by a pair of points in the image space. Before estimating the focal length in Sec. 3.2, we assume that each image is transformed into a pseudo camera space as p = K −1 p (p x , p y , p w ) T , where K p represents a pseudo camera intrinsic matrix of K, built by assuming f as min(W, H)/2.

Zenith Scoring Network (ZSNet)
We first explain our ZSNet, which is used to estimate the zenith VP (see Fig. 2 top-left). Instead of searching for a single zenith VP, we extract a set of candidates that are sufficiently close to the ground truth. Similar to PointNet [24], ZSNet takes sets of unordered vectors in 2D homogeneous coordinates -line equations and VPs -as inputs. Given a line segment, a line equation l can be computed as a cross product of its two endpoints: where [·] × represents a skew-symmetric matrix of a vector. A candidate VP v can then be computed as an intersection point of the two lines: Motivated by [27], we sample a set of line equations roughly directed to the zenith L z = l 0 , . . . , l |Lz| from the line segments, using the following equation: where l = (a, b, c) T represents a line equation as in Eq. (2) and the angle threshold δ z is set to 67.5 • as recommended in [27]. Then, we randomly select pairs of line segments from L z and compute their intersection points as in Eq. (3) to extract a set of zenith VP candidates Z = z 0 , . . . , z |Z| . Finally, we feed L z and Z to ZSNet. We set both the number of samples, |L z | and |Z|, 256 in the experiments. The goal of our ZSNet is to score each zenith candidate in Z; 1 if a candidate is sufficient close to the ground truth zenith, and 0 otherwise. Fig. 2 top-left shows the architecture of our ZSNet.
In the original PointNet [24], each point is processed independently, except for transformer blocks, to generate point-wise features. A global max pooling layer is then applied to aggregate all the features and generate a global feature. The global feature is concatenated to each point-wise feature, followed by several neural network blocks to classify/score each point.
In our network, we also feed the set of zenith candidates Z to the network, except that we do not compute the global feature from Z. Instead, we use another network, feeding the set of line equations L z , to extract the global feature of L z that is then concatenated with each point-wise feature of Z (Fig. 2 is computed via a global max-pooling operation (gpool), and is concatenated to h z (z i ) as follows: where ⊗ represents the concatenation operation. Finally, the concatenated features are fed into a scoring network computing [0, 1] scores such that: where p zi represents the computed scores of each zenith candidate. The network s z (·) in Eq. (7) consists of multiple MLP layers, similar to the latter part of the PointNet [24] segmentation architecture.
To train the network, we assign a ground truth label y i to each zenith candidate z i using the following equation: where cossim(x, y) = |x·y| x y and z gt represents the ground truth zenith. The two angle thresholds δ p and δ n are empirically selected as 2 • and 5 • , respectively, from our experiments. The zenith candidates each of which y i is undefined are not used in the training. The cross entropy loss is used to train the network as follows: To better train our ZSNet we use another loss in addition to the cross entropy. Specifically, we constrain the weighted average of zenith candidates close to the ground truth, where estimated scores p zi are used as weights. To average the zenith candidates, which represent vertical directions of the scene, we use structure tensors of l 2 normalized 2D homogeneous points. Given a 2D homogeneous point v = (v x , v y , v w ) T , a structure tensor of the normalized point is computed as follows: Fig. 3. Sampling horizontal line segments into two groups: (a) Based on a zenith VP representative (green), we want to classify the line segments (blue) of a given image. (b) Line segments are classified as follows: vanishing lines of the zenith VP (green) and the remaining lines (red). (c) Junction points (cyan) are computed as the intersections of spatially adjacent line segments that are classified differently; line segments whose endpoints are close to junction points are selected. (d) Using a pseudo-horizon (dotted line), we divide horizontal line segments into two groups (magenta and cyan).
The following loss is used in our network: where · F represents the Frobenius norm. Finally, we select zenith candidates whose scores p zi are larger than δ c to the set of zenith candidates, as: where δ c = 0.5 in our experiments. The set Z c is then used in our FSNet.

Frame Scoring Network (FSNet)
After we extract a set of zenith candidates, we estimate the remaining two horizontal VPs taking into account the given set of zenith VP candidates. We first generate a set of hypotheses on all three VPs. Each hypothesis is then scored by our FSNet.
To sample horizontal VPs, we first filter the input line segments. However, we cannot simply filter line segments using their directions in this case, as there may be multiple horizontal VPs, and lines in any directions may vanish in the horizon. As a workaround, we use a heuristic based on the characteristics of most urban scenes.
Many man-made structures contain a large number of rectangles (e.g., facades or windows of a building) that are useful for calibration parameter estimation, and line segments enclosing these rectangles create junction points. Therefore, we sample horizontal direction line segments by only using their endpoints when they are close to the endpoints of the estimated vertical vanishing lines. Fig. 3 illustrates the process of sampling horizontal line segments into two groups. Let z est = (z x , z y , z w ) be a representative of the estimated zenith VPs, which is computed as the eigenvector with the largest eigenvalue of ST(z) in Eq. (11). We first draw a pseudo-horizon by using z est and then compute the intersection points between each sampled line segment and the pseudo-horizon. Finally, using a line connecting z est and the image center as a pivot, we divide horizontal line segments into two groups; one that intersects the pseudo-horizon on the left side of the pivot and the other that intersects the pseudo-horizon on the right side of the pivot. The set of horizontal VP candidates is composed of intersection points by randomly sampling pairs of horizontal direction line segments in each group. We sample an equal number of candidates for both groups.
Once the set of horizontal VP candidates is sampled, we sample candidates of Manhattan directions. To sample each candidate, we draw two VPs; one from zenith candidates and the other from either set of horizontal VP candidates. The calibration parameters for the candidate can then be estimated by solving Eq. (1) with the two VPs, assuming that the principal point is on the image center [20].
We design our FSNet for inferring camera calibration parameters to utilize all the available data, including VPs, lines, and the original raw image (Fig. 2, top-right). ResNet [17] is adapted to our FSNet to handle raw images, appending all the other data as additional color channels. To append the information of the detected line segments, we rasterize line segments as a binary line segment map whose width and height are the same as those of the input image, as follows: where (u, v) represents a pixel location of the line segment map. We also append the information of vanishing line segments (i.e., expanding lines are close to a VP) as a weighted line segment map for all three VPs of a candidate, where weights are computed using the closeness between the line segments and VPs. For a given VP v and the line equation l of a line segment, we compute the closeness between v and l using the conventional line-point distance as follows: Three activation maps are drawn for each candidate (x-, y-and z-directions), as: All the maps are appended to the original image as illustrated in Fig. 2. Finally, we append the Manhattan directions and the estimated focal length to each pixel of the concatenated map so that the input to the scoring network have size of (height, width, channel) = (224, 224, 17) (Fig. 2, top-right).
To train FSNet, we assign GT score to each candidate by measuring similarities between horizon and zenith of each candidate and those of the GT. For the zenith, we measure the cosine similarities of GT zenith and that of candidate as follows: where z gt and z i represent the GT and candidate zenith. For the horizon, we adapt the distance metric proposed in [5]. For this, we compute the intersection points between the GT and candidate horizons and left/right image boundaries. Let h l and h r be intersection points of the predicted horizon and left/right border of the image. Similarly, we compute g l and g r using the ground truth horizon. Inspired by [5], the similarity between the GT and a candidate is computed as: Our scoring network h score is then trained with the cross entropy loss, defined as: where σ = 0.1 and δ s = 0.5 in our experiments.
Robust score estimation using the Manhattan world assumption. Although our FSNet is able to accurately estimate camera calibration parameters in general, it can sometimes be noisy and unstable. In our experiments, we found that incorporating with the Manhattan world assumption increased the robustness of our network. Given a line segment map and three closeness maps (Eqs. (14) and (15)), we compute the extent to which a candidate follows the Manhattan world assumption using Eq. (21): and the final score of a candidate is computed as: Once all the candidates are scored, we estimate the final focal length and zenith by averaging those of top-k high score candidates such that: where ST(z i ) represents the structure tensor of a zenith candidate (Eq. (10)).
We set k = 8 in the experiments. z est can be estimated from ST est , and the two camera rotation angles ψ and φ in Eq. (1) can be computed from f est and z est . For the rotation angle θ, we simply take the value from the highest score candidate, as there may be multiple pairs of horizontal VPs that are not close to each other, particularly when the scene does not follow the Manhattan world assumption but the Atlanta world assumption. Note that they still share similar zeniths and focal lengths [5,21].

Training Details and Runtime
In training, we train ZSNet first and then train FSNet with the outputs of ZSNet. Both networks are trained with Adam optimizer with initial learning rates of 0.001 and 0.0004 for ZSNet and FSNet, respectively. Both learning rates are decreased by half for every 5 epochs. The mini-batch sizes of ZSNet and FSNet are set to 16 and 2, respectively. The input images are always downsampled to 224 × 224, and the LSD [15] is computed on these low-res images. At test time, it takes ∼0.08s for data preparation with Intel Core i7-7700K CPU and another ∼0.08s for ZSNet/FSNet per image with Nvidia GeForce GTX 1080 Ti GPU.

Experiments
We provide the experimental results with Google Street View [1] and HLW [32] datasets. Refer to the supplementary material for more experimental results with the other datasets and more qualitative results. Google Street View [1] dataset. It provides panoramic images of outdoor city scenes for which the Manhanttan assumption is satisfied. For generating training and test data, we first divide the scenes for each set and rectify and crop randomly selected panoramic images by sampling FoV, pitch, and roll in the ranges of 40 ∼ 80 • , −30 ∼ 40 • , and −20 ∼ 20 • , respectively. 13,214 and 1,333 images are generated for training and test sets, respectively. HLW [32] dataset. It includes images only with the information of horizon line but no other camera intrinsic parameters. Hence, we use this dataset only for verifying the generalization capability of methods at test time. Evaluation Metrics. We measure the accuracy of the output camera up vector, focal length, and horizon line with several evaluation metrics. For camera up vector, we measure the difference of angle, pitch, and roll with the GT. For the focal length, we first convert the output focal length to FoV and measure the angle difference with the GT. Lastly, for the horizon line, analogous to our similarity definition in Eq. (17), we measure the distances between the predicted and GT lines at the left/right boundary of the input image (normalized by the image height) and take the maximum of the two distances. We also report the area under curve (AUC) of the cumulative distribution with the x-axis of the distance and the y-axis of the percentage, as introduced in [5]. The range of x-axis is [0, 0.25].

Comparisons
We compare our method with six baseline methods, where Table 1 presents the required supervision characteristics and outputs. Upright [21] and A-Contrario Detection [27] are non-neural-net methods based on line detection and RANSAC. We use the authors' implementations in our experiments. For Upright [21], the evaluation metrics are applied after optimizing the Manhattan direction per image, Table 1. Supervision and output characteristics of baseline methods and ours. The first two are unsupervised methods not leveraging neural networks, and the others are deep learning methods. Ours is the only network-based method predicting all four outputs.  [21] N/A A-Contrario [27] DeepHorizon [32] Perceptual [18] UprightNet [33] Ours assuming the principal point as the image center. A-Contrario Detection [27] often fails to estimate focal length when horizon VP candidates are insufficient in the input. Thus, we exclude [27] in the evaluation of FoV. The AUC of [27] is measured, regardless of the failures in focal length estimations, with the horizon lines estimated by the method proposed in [27]. The other metrics of [27] are evaluated only for the cases that focal lengths are successfully estimated. DeepHorizon [32] and Perceptual Measure [18] are neural-network-based methods directly taking the global feature of an image and performing classifications in discretized camera parameter spaces. For fair comparisons, we use ResNet [17] as a backbone architecture in the implementations of these methods. Note that DeepHorizon [32] does not predict focal length, and thus we use ground truth focal length in the estimation of the camera up vector. Additionally, we train Perceptual Measure [18] by feeding it both the input image and the line map used in our FSNet (Sec. 3.2), and we assess whether the extra input improves the performance. UprightNet [33] is another deep learning method that requires additional supervision in training, such as camera extrinsic parameters and perpixel normals in the 3D space. Due to the lack of such supervision in our datasets, in our experiments, we use the author's pretrained model on ScanNet [10], which is a synthetic dataset.
The quantitative results with Google Street View dataset [1] are presented in Table 2. The results demonstrate that our method outperforms all the baseline methods in most evaluation metric. Upright [21] provides a slightly lower median roll than ours, although its mean roll is much greater than the median, meaning that it completely fails in some test cases. In addition, Perceptual Measure [18] gives a slightly smaller mean FoV error; however, the median FoV error is higher than ours. When Perceptual Measure [18] is trained with the additional line map input, the result indicates that it does not lead to a meaning difference in performance. As mentioned earlier, a pretrained model is used for UprightNet [33] (trained on ScanNet [10]) due to the lack of required supervision in Google Street View; thus the results are much poorer than others.  Table 2. Quantitative evaluations with Google Street View dataset [1]. See Evaluation Metrics in Sec. 4 for details. Bold is the best result, and underscore is the second-best result. Note that, for DeepHorizon [32]*, we use GT FoV to calculate the camera up vector (angle, pitch, and roll errors) from the predicted horizon line. Also, for UprightNet [33]**, we use a pretrained model on ScanNet [10] due to the lack of required supervision in the Google Street View dataset.

Method
Angle   Table 2. horizon lines and focal lengths. In each example in Fig. 5, we illustrate the Manhattan direction of the highest score candidate.
To evaluate the generalization capability of neural-network-based methods, we also take the network models trained on Google Street View training dataset and test them on the HLW dataset [32]. Because the HLW dataset only has the GT horizon line, Fig. 4(b) only reports the cumulative distributions of the horizon prediction errors. As shown in the figure, our method provides the largest AUC with a significant margin compared with the other baselines. Interestingly, Perceptual Measure [18] shows improvement when trained with the additional line map, meaning that the geometric interpretation helps more when parsing unseen images in network training.
We conduct an experiment comparing the outputs of ZSNet with the outputs of Upright [21] and A-Contrario [27]. Using the weighted average of the zenith candidates (in Eq. (11)), we measured the angle to the GT zenith cossim(z i , z gt ), as provided in Eq. (8). Table 3 show that our ZSNet computes the zenith VP more accurately than the other non-neural-net methods.

Ground Truth
Upright [21] A-Contario [27] DeepHorizon [32] Perceptual [18] Perceptual [18] +L Ours Fig. 5. Examples of horizon line prediction on the Google Street View test set (top two rows) and on the HLW test set (bottom two rows). Each example also shows the Manhattan direction of the highest score candidate.

Ablation Study
We conduct an ablation study using Google Street View dataset to demonstrate the effect of each component in our framework. All results are reported in Table 4, where the last row shows the result of our final version framework.
We first evaluate the effect of the entire ZSNet by ablating it in the training. When sampling zenith candidates in FSNet (Sec. 3.2), the score p zi in Eq. (7)  is not predicted but set uniformly. The first row of Table 4 indicates that the performance significantly decreases in all evaluation metrics; e.g., the AUC decreased by 9%. This indicates that ZSNet plays an important role in finding inlier Zenith VPs that satisfy the Manhattan/Atlanta assumption. In ZSNet, we also evaluate the effect of global line feature g l in Eq. (5) by not concatenating it with the point feature h z (z i ) in Eq. (6). Without the line feature, ZSNet is still able to prune the outlier zeniths in some extent, as indicated in the second row, but the performance is far inferior to that of our final framework (the last row). This result indicates that the equation of a horizon line is much more informative than the noisy coordinates of the zenith VP. In FSNet, we first ablate some parts of the input fed to the network per frame. When we do not provide the given image but the rest of the input (the third row of Table 4), the performance decreases somewhat; however, the change is less significant than when omitting the line map L (Eq. (13)) and the activation map A (Eq. (15)) in the input (the fourth row). This demonstrates that FSNet learns more information from the line map and activation map, which contain explicit geometric interpretations of the input image. The combination of the two maps (our final version) produces the best performance. In addition, the results get worse when the activation map score m i is not used in the final score of candidates -i.e., s i = s vhi in Eq. (22) (the fifth row).

Conclusion
In this paper, we introduced a neural method that predicts camera calibration parameters from a single image of a man-made scene. Our method fully exploits line segments as prior knowledge of man-made scenes, and in our experiments, it exhibited better performance than that of previous approaches. Furthermore, compared to previous neural approaches, our method demonstrated a higher generalization capability to unseen data. In future work, we plan to investigate neural camera calibration that considers a powerful but small number of geometric cues through analyzing image context, as humans do.

A.1 Comparisons on SUN360 [34] Dataset
Similar to the experiment in Sec. 4.1, we also compare our method with the baseline methods using SUN360 [34] dataset. We selected indoor and outdoor scenes in the SUN360 dataset that satisfied the Manhattan/Atlanta assumptions, and generated the training and test images in the same way as with Google Street View dataset, described in Sec. 4. 30, 837 and 878 images are generated for the training and test sets, respectively. Details of the evaluation metrics and baseline methods are provided in Sec. 4.1.
The quantitative results with SUN360 dataset [34] are reported in Table A1. The trends of the results are similar to those of the Google Street View experiment in Table 2. Our method provides the best performance for most of the evaluation metrics, and the second-best for the remaining evaluation metrics, such as the median roll error and mean FoV error. Our method has a very marginal difference with the best AUC. The qualitative results are presented in Fig. A1. Table A1. Quantitative evaluations with SUN360 dataset. Bold represents the best result, while an underscore represents the second-best result. Note that for DeepHorizon [32]*, we use the GT FoV to calculate the camera up vector (angle, pitch, and roll errors) from the predicted horizon line. In addition, for UprightNet [33]**, we use a pretrained model on ScanNet [10] due to the lack of required supervision in the SUN360 dataset.

Method
Angle   Fig. 3(d) in the paper), and the set of sampled candidates of Manhattan directions, respectively. Fig. A3(e) displays the prediction results of the horizons and their corresponding ground truths, as well as the Manhattan direction of the highest score candidate. Activation maps A with respect to the Manhattan directions are presented in Fig. A3(f). Notice that activation maps A in Fig. A3(f) explain much of their respective line segment maps L in Fig. A3(b), exemplifying how our method incorporates with the Manhattan world assumption. Fig. A3(g) superimposes the eight Manhattan directions of the top-8 highscoring candidates over the input images. As illustrated in Fig. A3(g), the zenith directions are almost the same between candidates, as the man-made scenes usually satisfies either the Manhattan or Atlanta world assumption [8,26]. For scenes satisfying the Manhattan world assumption (rows 1-4), the axes of eight frames almost overlap. For the last two scenes (rows 5 and 6) that follow the Atlanta world assumption, all the frames have zenith directions that are very close to each other. By utilizing these frames we can robustly and accurately estimate horizon lines and focal lengths of given scenes. [11] and ECD [29] We report the accuracy of Manhattan direction prediction using our method on YUD [11] and ECD [29] datasets and compare the result with those of the other methods. In the experiment, we took the network model trained on the Google Street View dataset and tested it on YUD [11] and ECD [29] datasets. For the evaluation, the Manhattan direction of the high score candidate is used. YUD [11] dataset contains 102 images under the Manhattan assumption, where each image is annotated with three VPs and a focal length. ECD [29] dataset contains 103 images under the Atlanta assumption, where each image is annotated with a zenith VP and more than two horizontal VPs on a horizon line. For ECD [29] dataset, the direction which is the closest to the prediction is used for comparisons. Table A2 shows the quantitative comparisons, in terms of the relative rotation angle, differences of FoV, and AUC. For FoV and AUC, we used the same setting as depicted in Sec. 4.1. As shown Table A2, our results are comparable to the ones of non-neural-net methods [21,27], which are highly optimized for YUD [11] and ECD [29] datasets. We remark that our networks are trained on a different dataset and also with weak and indirect supervision (horizon lines and focal lengths).

A.5 Parameter Sensitivity Test
We tested parameter sensitivity by varying our parameters including: the angle threshold for vertical lines (δ z in Eq. (4)), the angle thresholds for deciding the positive and negative samples of zenith candidates (δ p and δ n in Eq. (8)), the score threshold for ZSNet (δ c in Eq. (12)), the score threshold for FSNet (δ s in Eq. (19)), and the numbers of line segments and intersection points used in the network (|L z | and |Z|). Also, we tested sensitivity to line detection algorithm by varying the LSD algorithm parameter, − log (NFA), where NFA is the number of Table A2. Quantitative evaluations of Manhattan direction prediction with YUD [11] and ECD [29] datasets.
We used the network model trained with the Google Street View [1] dataset with default parameters and tested the model by varying the parameters, except for δ p and δ n in Eq. (8) and δ s in Eq. (19); these parameters change either the ground truth labels or the loss function. For those parameters, we finetuned our network from the pretrained model. All results are reported in Table A3. The highlighted rows show the results with default parameters. The results demonstrate that our method is robust to the change of the parameters. In our implementation, 1,024 for both lines and points was the maximum number to train the network with 11 GB GPU memory. However, more numbers of lines and points also significantly increase training time and GPU memory usage. For the sake of simplicity, all results reported in this paper were obtained with |L z | = |Z| = 256 both at training time and test time.

A.6 Visualization of FSNet Focus
In Fig. A4, we show more visualizations of the weights of the second last convolution layer in FSNet, as shown in Fig. 6. The network mostly focuses on the lines that pass the vanishing points. Fig. A5 shows failure cases of our framework. The failure cases occur when the computation of the focal length is unstable, such that: i) the scene is far from the Manhattan assumption, ii) only short or noisy line segments are detected in the scene, iii) the scene is almost perpendicular to the center of projection. Please notice that the estimated zenith directions are still reasonable in Fig.  A5, thanks to the semantic information learned by ResNet, the backbone of our FSNet. Therefore, even in the cases of Fig. A5, our framework is still applicable to image rotation corrections as shown in Fig. 1(a).

A.8 Experiment on KITTI [14] Dataset
We conducted an additional experiment with KITTI [14] dataset. The KITTI dataset contains wide-images captured by driving around urban cities and rural Table A3. Parameter sensitivity test results. The highlighted rows show the result with the default parameters. Bold is the best result, and underscore is the second-best result in each experiment. areas. We sample 8,675 images of urban scenes from the KITTI dataset and feed them to finetune our network from the pretrained model with the Google Street View dataset. We test our finetuned model to 481 images of urban and rural scenes from the KITTI dataset. Fig. A6 shows some examples of horizon predictions with the KITTI test set. Unfortunately, the GT horizons of the dataset are geometrically inaccurate due to the large influence of the vehicle's tilting angle during cornering. Nevertheless, we obtained interesting results where the estimated horizons of our framework do not deviate significantly from the GT horizons in urban areas. We believe the results come from the KITTI dataset, since there are little changes in the horizontal line and focal length. Another reason seems to be that the ResNet, the backbone of our FSNet, learned the scene context from the KITTI dataset. Table A4 reports the quantitative evaluations with KITTI dataset.