{'fraction_non_alphanumeric': 0.029188779378316907, 'fraction_numerical': 0.014357467778620167, 'mean_word_length': 4.684082951791004, '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': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Semi-Dense 3D Semantic Mapping from Monocular SLAM

The bundle of geometry and appearance in computer vision has proven to be a promising solution for robots across a wide variety of applications. Stereo cameras and RGB-D sensors are widely used to realise fast 3D reconstruction and trajectory tracking in a dense way. However, they lack flexibility of seamless switch between different scaled environments, i.e., indoor and outdoor scenes. In addition, semantic information are still hard to acquire in a 3D mapping. We address this challenge by combining the state-of-art deep learning method and semi-dense Simultaneous Localisation and Mapping (SLAM) based on video stream from a monocular camera. In our approach, 2D semantic information are transferred to 3D mapping via correspondence between connective Keyframes with spatial consistency. There is no need to obtain a semantic segmentation for each frame in a sequence, so that it could achieve a reasonable computation time. We evaluate our method on indoor/outdoor datasets and lead to an improvement in the 2D semantic labelling over baseline single frame predictions.


Introduction
Understanding 3D scene is more widely required but still challenging in many robotics applications. For instance, autonomous navigation in outdoor scene asks for a comprehensive understanding of immediate surroundings. In domestic robotics, a simple fetching task always requires knowledge of both what something is, as well as where it is located [13]. Semantic segmentation is an important and promising step to address this problem. The stateof-art Convolutional Neural Networks (CNNs) make great advances in the image-based 2D semantic segmentation. Combined with SLAM technology, mobile robotics could locate itself and meanwhile recognise objects in pixel-wise level. It means that a task like "move the chair behind the nearest desk" or "park ego-car in front of the left red one at the parking space" could be accurately accomplished. However, scaled sensors, such as stereo or RGB-D cameras,  Figure 1. semi-dense 3D semantic mapping: The figure shows an example of our system. The sequence of RGB images is used to reconstruct 3D environments and 2D semantic label is predicted on the input frame. Using a 2D-3D label transfer approach and map regularisation could improve the labelling accuracy in a semidense way.
only provide reliable measurements in their limited range. They lack of flexibility of seamless switch between indoor and outdoor scenes. In this work, we exploit a Large-scale Direct Monocular SLAM (LSD-SLAM) [5] provides cues of 3D spatial information working in both indoor and outdoor scenes and combine with recent advances of DeepLabbased CNN [1] to build a 3D scene understanding system. Most man-made environments, no matter indoor or outdoor scenes, usually exhibit distinctive spatial relations amongst varied classes of objects. Being able to capture, model and utilise these kinds of relations could enhance semantic segmentation performance [19]. In this paper, apart from semi-dense 3D mapping based on monocular SLAM and 2D semantic segmentation via using trained CNN model, 2D-3D transfer and map regularisation in the framework of semi-dense 3D reconstruction are considered as our main research contribution.
Our approach is to use stat-of-the-art deep CNN components to predict semantic information which are projected to globally consistent 3D map from a real-time monocular SLAM system. The 3D map is incrementally constructed by a sequence of selected frames with calculated depth information as tracking references. This allows the 2D CNN's semantic labelling attached to keyframes which can be fused into the 3D map in a semi-dense way, as shown in Figure 1. There is no need to segment each frame in a sequence, which could save a considerable amount of computation cost. Since the 3D map should have global consistent depth information, it would be regularised in light of its geometry. The regularisation process after the 2D-3D transfer is aimed to remove distinctive outliers and makes the components in the 3D map more consistent, i.e., local points with semantic label should be close in space. NYUv2 and CamVid/KITTI datasets were chosen to evaluate our approach, and we witness an improvement in 2D semantic segmentation. The unlabelled raw videos were used to reconstruct 3D map with semantic predictions in real-time (≈10Hz).
The paper is presented as follows. The next section gives an overview of related work. Section 3 describes the main components in this work. Section 4 discusses our experimental results of both indoor and outdoor scenes.

Related Work
Our work is motivated by [13] which contributes an indoor 3D semantic SLAM from a RGB-D input. They aimed towards a dense 3D map based on ElasticFusion SLAM [18] with semantic labelling. Pixel-wise semantic information is acquired from a Deconvolutional Semantic Segmentation network [15] with scaled RGB input and Depth as fourth channel. Depth information is also used to update surfel's depth and normal information to construct 3D dense map during loop closure. This system required a RGB-D input with reliable depth measurements, but it limited the scene switch. In addition, previous work, SLAM++ [16], created a map with semantically defined objects, but it is limited to predefined database and hand-crafted template models.
Visual SLAM usually contains sparse, semi-dense, and dense types depending on the methods of image alignment. Feature-based methods only exploited limited feature points -typically image corners and blobs or line segments, such as classic MonoSLAM [3] and ORB-SLAM [14]. They are not suitable for 3D semantic mapping due to rather limited feature points. In order to better exploit image information and avoid the cost on calculation of features, direct dense SLAM system, such as surfel-based ElasticFusion [18] and Dense Visual SLAM [9], have been proposed recently. Whereas, direct image alignment from these dense methods is wellestablished for RGB-D or stereo sensors [5], not for monocular camera. Semi-dense methods like LSD-SLAM [5] and SVO [7] provide possibility to build a synchronised 3D semantic mapping system.
Deep CNN has proven to be successful in the field of image semantic segmentation. Long et al. [11] firstly introduced an inverse convolution layer to realise an end-to-end training and inference process. Then, an encoder-decoder architecture with max unpooling and deconvolutional layers was proposed to avoid the separate step training problem in FCN network [15]. The cutting-edge method, namely, DeepLab, combines atrous convolutions and atrous spatial pyramid pooling (ASPP) to achieve a state-of-the-art performance on semantic segmentation. It also incorporates dense Conditional Random Field (CRF) which improves both qualitatively and quantitatively via a posterior process.
Our semi-dense approach is also inspired by dense 3D semantic mapping methods [8,19,17,12] in both indoor and outdoor scenes. The major contributions from these work are 2D-3D transfer and map regularisation. Especially, Hermans et al. proposed an efficient 3D Conditional Random Fields to regularise consistent 3D semantic mapping considering influence between neighbors of 3D points (voxels). In this work, we explore a similar strategy of utilising their semantic, visual, and geometrical information to enforce spatial consistency.

Approach
Our target is to create a 3D scene map with semidense and consistent label information online while robotics equipped with a monocular camera move through an unknown scene. The approach is decoupled into three separately running processes as shown in Figure 2. The 3D reconstruction process selects keyframes from the sequence of image frames captured by monocular camera. The selected keyframes are stacked to reconstruct the 3D map based on their pose graphs. This whole process runs within CPU in real time. Meanwhile, the 2D semantic segmentation process predicts the pixel-level classification on keyframes. The depth information of keyframes are iteratively refined by their consecutive frames. It creates local optimal depth estimation for each keyframe and correspondence between labelled pixels and voxels in the 3D point cloud. To obtain a globally optimal 3D semantic segmentation, we exploit the information over neighboring 3D points, involving the distance, color similarity and semantic label. This process achieves the update of 3D point's state and make a globally consistently 3D map. The following section describes each process in more detail.

2D Semantic Segmentation
In our work, deep CNN adopts the core layers as the DeepLab-v2 proposed by Chen et al. [1]. Two important components in DeepLab-v2 are the dilated convolution or named as atrous convolution and atrous spatial pyramid pooling (ASPP), which enlarge the field of view of filters and explicitly combine the feature maps of multiple scales. The final result comes from fusion of the bilinear interpolation of multi-scaled feature maps to the original image resolution. This method can capture the details and successfully Figure 2. Overview of our method: The input is only RGB frame in sequence. There are three separate processes, a Keyframe selection process, a 2D semantic segmentation process , and a 3D reconstruction with semantic optimization process. Keyframes are selected from the sequence of frames as tracking reference and the consecutive frames refine the depth and variance contained in Keyframes. The 2D semantic segmentation process classifies the image information in Keyframes. Finally, the 3D map is reconstructed with the incoming Keyframes and fused with accumulated semantic information. The 3D semantic map is then regularised by a dense CRF. The visualised intervals do not correspond to the actual situation.
handle both large and small objects in images. The encoder part of entire architecture is built based on the VGG 16layer network. For the inference, we use a softmax layer to obtain the final probabilistic score map.
For the indoor scene, we employ NYUv2 labelled dataset and adopt the predefined 14 classes, denoted as L = {l 1 , l 2 , . . . , l M }(M = 14), including floor, wall, sofa, and so on [2]. The NYUv2 dataset consists of 795 labelled training images and 654 labelled val images. On the other hand, we use CamVid dataset for training towards the outdoor scene within 11 classes, including sky, building, car, road and so on. The CamVid dataset is split into 367 labelled training images, 101 labelled val images and 233 labelled test images. Since there is no sequence of images in CamVid dataset, we use all labelled images for training and test our whole approach on the KITTI dataset. We finetune our model with COCO pre-trained model without depth information involved. We do not rescale our input images to the native resolution (224 × 224) as a traditional VGG16 network. The dimension of input in the training process is cropped to 321 × 321 × 3 due to the alignment of map after multiple scales subsampling. During the inference, we keep the original resolution of input image according to different datasets.

Semi-Dense SLAM Mapping
LSD-SLAM is a real-time and semi-dense 3D mapping method. The 3D environment is reconstructed as posegraph keyframes with associated semi-dense depth maps. The keyframe is selected from image frames in light of its distance from previous keyframe as tracking reference. Each keyframe (index i) K i = {I i , D i , V i , S i } consists of an image intensity I i : Ω i → R 3 , a depth map D i : Ω Di → R, the variance of depth map V i : Ω Di → R and a semantic score map S i : Ω i → R 3 . Depth map and variance are defined in subset of pixels as Ω Di ⊂ Ω i , which means semi-dense, only available for certain image regions of large intensity gradient. The semantic score map is with a size of H × W × M (H: height, W: width, M: number of classes) directly from deep CNN.
Spatial regularisation and outlier removal are incorporated in the creation of depth map and tracked image frames are used to refine depth map based on small-baseline stereo comparisons [6]. Next, directly scale-drift aware image alignment on sim(3) is carried on these stacked keyframes with refined depth map, which is used to align two differently scaled keyframes [5]. The scale-drift aware operation is against different scale environments, such as office rooms (indoor) and urban city road (outdoor). Due to the inherent correlation between depth map and tracking accuracy, depth residual is exploited to estimate the scaled transformation between keyframes. Consequently, we build a 3D point cloud based on the depth maps of keyframes with minimum of error of image alignment. It could run in real time on a CPU about 25 Hz.

Accumulated Labelling Fusion
Single 2D semantic segmentation would have inconsistent labelling between consecutive frames due to uncertainty of sensors and environments. Incremental fusion of semantic label information of stacked keyframes is similar to SLAM correspondences that allow us to associate probabilistic label from multiple keyframes in a Bayesian way, like the approach in [13]. For the 3D map at current keyframe K t , we denote the class distribution of a 3D voxel v d as l k , where our goal is to obtain the each 3D point independent probability over the class labels p(v d → l k |K t 0 ) given all stacked keyframes K t 0 = {K 0 , K 1 , . . . , K t }. We use a recursive Bayes' rule to transfer this: where Z t = p(K t |K t−1 0 ). Applying first Markov assumption to p(K t |K t−1 0 , l k ), then we have: We assume p(l k ) does not change over time and there is no need to calculate the normalisation factor p(K t )/Z t explicitly. Finally, we can update the semantic information of 3D point cloud when a new keyframe arrives as follows: This incremental fusion of semantic probabilistic information allows us to label 3D point based on whole existing keyframes in real-time. The following section describes how we explore dense CRF to regularise semi-dense 3D map using map geometry, which could propagate semantic information between spatial neighbors.

Semi-Dense Map Regularisation
Dense CRF is widely employed in 2D semantic segmentation to smooth noisy segmentation map. Some previous works [17,8,19] seek its application on 3D map to model contextual relations between various class labels in a fully connected graph. This algorithm aims at minimising the Gibbs energy E by means of mean-field approximation and message passing scheme to efficiently infer the latent variables. In a 3D environment, a voxel v d in the point cloud P is assigned a label l ∈ L. Then, a whole label assignment l ∈ L M has a corresponding Gibbs energy that consists of unary and pairwise potentials ψ i and ψ i,j : The unary potential is defined as the negative logarithm of the labelling's probability: The pairwise potential is modeled to be a linear combination of m Gaussian edge potential kernels: where µ (m) is a label compatibility function corresponding to the kernel functions k (m) (f i , f j ) and f denotes feature vector for voxel, v. For our application in 3D environments, we explore two Gaussian kernels for the pairwise potentials, similar to the work of Hermans et al. [8]. The first one is a spatial smoothness kernel as Eq. 7, which aims at enforcing a local, appearance-agnositc smoothness amongst voxels with similar normal vectors.
where p are the coordinates of 3D voxels and n are the respective surface normals. Most researches employ an appearance kernel as the second one, where c are the RGB/LAB color vectors of the corresponding voxels [13]. However, semi-dense LSD-SLAM only utilises the points of high intensity gradient to reconstruct 3D environment. These points are rather limited to capture contextual relations between different classes. Thus, we take a semantic score-related kernel in Eq. 9, which encourages the voxels in a given segment to take the same label and penalises partial inconsistency of voxels as similar as the work in [17].
where θ p,s θ p,n means we hope that semantic information flows across larger distances than geometrical structure and s is the probabilistic score of all classes.
In addition, we take a similar strategy as [19], by defining separate label compatibility functions µ (m) for both kernels. For the smoothness kernel, we use a simple Potts model: , while a more expressive kernel is defined for semantic potential to distribute the probabilistic score across different distances. Then, µ (2) is a full, symmetric 14 × 14 matrix, where all class relations are defined individually. We did not tune these parameters above. All implementations follow the default settings presented in the work [10].

Experiments on Indoor Scene
To demonstrate the performance of our approach, we firstly use the publicly available dataset NYUv2 towards the 2D semantic segmentation. We find that the "poly" stochastic gradient descent is better than the "step" one with a learning rate of 0.001, a step size of 2000, momentum of 0.9, and weight decay of 5 × 10 −4 . For each iteration, we use 10 batch for training and the number of total iterations is 10k, which runs on a Nvidia Titan X GPU about 6 hours. The results of our evaluation are presented in Table 1. We find that the results of 2D semantic segmentation on the NYU v2 dataset gain an improvement over previous work listed in [13]. Especially, it should be noted that RGBD [13] and Eigen [4] use depth information during the training and inference, while we only use the RGB image. In our work, the posterior dense CRF of 2D semantic segmentation contributes an improvement of 1.8% on the deep CNN on the value of pixel average, but it influence the real-time capability heavily. Thus, for online, it is disabled entirely and we apply it only on the final 3D map regularisation.
A typical example of indoor 3D environment is shown in Figure 1, which contains about 370k 3D points within a total of 30 generated keyframes (about 12k points for each keyframe). Since our approach only executes the 2D semantic segmentation on keyframes, it could run in 10Hz online. We're aware that the initialisation of LSD-SLAM is quite significant to calculate the accurate depth of keyframes in sequence. Excessive rotation and lacking translation at the beginning would lead to a poor mapping result. We select the sequences in NYU v2 which have effective initialisation. All tests were performed on an Intel Core i7-5930K CPU and a NVIDIA Titan X GPU.

Experiments on Outdoor Scene
Outdoor scenes usually demand larger range of measurement than indoor scenes. The training process on the CamVid dataset is similar to NYUv2 dataset, using a "poly" strategy within 10 batch in 10k iterations. Since LSD-SLAM works only based on consecutive images, we need to use image sequence to test our system. Thus, we choose raw image sequences of KITTI dataset in our experiments. The resolution of images in KITTI dataset is 1392 × 512. Take the 2011 09 26 drive 0093 clip as an example in Figure 3. There are 439 raw images of this clip with 43 seconds. Our system generates about 1600k 3D points within 56 keyframes (about 30k points for each keyframe). The inference process of KITTI image costs about 400 ms to generate a labelling score map of same resolution. Due to 3D reconstruction of selected keyframes, the 3D mapping could arrive at a speed of 10Hz. Moreover, we remove several keyframes at the beginning of sequence, due to limited initialisation of LSD-SLAM based on KITTI data.

Conclusions
We have presented a semi-dense 3D semantic mapping based on a monocular SLAM, which runs on a CPU coupled with a GPU. In contrast to previous work, this system does not use any scaled sensors but a single camera, and only selected frames for 2D semantic segmentation, which reduces the computation time. In addition, our scale-drift aware system could attain seamlessly switch between both indoor and outdoor scenes without extra effort on various scales. We explored a state-of-the-art deep CNN to accurately segment objects in various scenes. Direct monocular SLAM reconstructs a 3D semi-dense environment without any prior depth information, which is suitable for mobile robots working in both indoor and outdoor. The semantic annotations, even with inaccurate labels, are transferred into the 3D map and regularised with a CRF process. It achieves a promising result, and fit for online use. Significantly, we find the geometry of reconstructed map could help to segment objects in different depths.
In future work, we plan to introduce several state-of-theart SLAM technologies to improve the initialisation. Research on how labelling boosts 3D reconstruction of SLAM would be an interesting direction. And the deep learning method to solve depth estimation and spatial transformation for SLAM like [4] would be another interesting topic. bed  books  ceiling  chair  floor  furniture  objects  painting   sofa  table  tv  wall  window  class avg. pixel avg.