Leica BLK2GO point cloud classification with Machine Learning algorithms: the case study of Sant’Eusebio’s crypt in Pavia (Italy)

: Valorisation of cultural heritage is a priority of international community, and the creation of 3D models is considered almost a mandatory requirement to any conservation activity. Geomatics has given its contribution to this purpose offering its competences and experiences in surveying. Methods and tools have progressively improved offering more realistic, accurate, and reliable products; among the most interesting systems currently available, there is the handheld mobile mapping Leica BLK2GO technology. The characteristics of this system are particularly useful when traditional methods are unfeasible due to accessibility problem, narrowness spaces and time constraints. Nevertheless, the system, as any new technology, needs to be tested in order to verify its capability to describe the world in a correct and reliable way; moreover, it is interesting to understand if established data classification procedures are still effective for SLAM (Simultaneous Localization and Mapping) data. The paper is framed in this context and illustrates the survey of an ancient crypt, located in Pavia (Italy), that is object of a preservation project. The characteristics of the monument and the acquisition strategies are described. For data classification three different Machine Learning approaches are test: Support Vector Machine (SVM), Decision Tree (DT) and Random Forest (RF). Seven architectural elements are considered: pavement, columns, half pilasters with structural function, walls, capitals, arches, and vaults. The analysis shows as Leica BLK2GO data owns all the characteristics feasible to produce useful point cloud; data classification performs well (with the exceptions of SVM) with higher accuracy, of about 90%, reached using RF.


INTRODUCTION
Conservation and valorisation of cultural heritage have become a priority of international community as they promote the access to and enjoyment of cultural diversity, enriching the social capital and creating a sense of belonging; indeed, historic preservation provides a link to the roots of the community and its people. Nowadays, the creation of 3D models is considered almost a mandatory requirement to any conservation and valorisation activity and geomatics has given its contribution to this purpose offering its competences and experiences in surveying, data management and analysis. Methods and tools have progressively improved offering more realistic, accurate, and reliable products. Among the most interesting systems currently available, there is the handheld mobile mapping Leica BLK2GO technology that combines: 1. LiDAR SLAM: the sensor identifies different surfaces and unique geometry in the LiDAR data, calculating its 3D position. 2. Visual SLAM: three panoramic cameras identify similarities between consecutive images to calculate the scanner's movement through 3D space. 3. IMU: the inertial unit senses the movements to determine the BLK2GO's change of position in 3D space. The characteristics of this system are particularly useful when traditional methods are unfeasible (Limongiello et al., 2020). Modern Terrestrial Laser Scanner (TLS) are largely used in cultural heritage surveying thanks to their capability to acquire detailed point cloud, having high precision, in relatively short time. However, TLS systems have historical limits connected to the necessity to have defined and stable setup. This implies that several scanning stations are necessary when complex geometries are involved, without the guarantee of surveying each single part. Moreover, these scanning positions must ensure steadiness, situation not granted for historical locations where the ground can cause instability. Instead, as any SLAM system, BLK2GO allows to capture the area by moving inside it and exploiting its small size to survey every cavities and ledges present. The result of the walk is a coloured point cloud that can be exploited to generate 3D model by fitting geometric primitives to it and performing texturing. This freedom of movement allows to survey structure almost impossible for a traditional TLS such as the stairs; a SLAM sensor, walking up and down the steps, can easily measure these elements. This versatility not only simplify the surveying of complex structures but reduce the acquisition time, bypassing the scan station concept. Time is a crucial aspect to consider in measurement operation and it is particularly important in cultural heritage context. The most trivial consideration is connected to costs: long surveying activities imply larger money effort. In historical places, short surveying time means also the reduction of closing period for location accessible to public visits. Besides, measurements could be taken in unsafe locations for operators; this condition could be due to structural hazards (maybe connected to the reason of preservation actions) or biological. An example is the surveying of the Cloaca Maxima, the old Roman sewer, in which some authors have been recently involved. The sewer is still used by Rome's citizens so the permanence inside this historical monument must be reduce as much as possible (less than one hour). In this case, a traditional survey is not viable, and SLAM seems to be the only advisable choice. However, it is important to underline that, as any new technology, SLAM data needs to be tested in order to verify their capability to describe the world in a correct and reliable way. Questions as: is BLK2GO data useful to effectively describe cultural heritage monuments? Are their accuracy and precision sufficient for restoration and preservation actions? Do point clouds generate by SLAM have appropriate characteristics to The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVIII-M-2-2023 29th CIPA Symposium "Documenting, Understanding, Preserving Cultural Heritage: Humanities and Digital Technologies for Shaping the Future", 25-30 June 2023, Florence, Italy exploit the consolidated Machine Learning approaches for classifications? The paper is framed in this context and illustrates the survey of an ancient crypt, located in Pavia (Italy), that is object of a preservation project promoted by the course of Architectural Restoration at the University of Pavia. The characteristics of the monument and the acquisition strategies are described; different Machine Learning approaches are then considered to classify the point cloud according to main considered architectural elements.

The Sant'Eusebio's crypt history
Sant'Eusebio's crypt of Pavia (Italy) is what remains of the city's Arian Cathedral, probably built by the Lombard king Rothari (636-652). The crypt, although remodelled in the Romanesque period ( Figure 1) and truncated pyramid capitals reproduce different designs; some of these belong to the first Arian construction. In 1807 the Church was deconsecrated and transformed into a carpentry and then completely destroyed in 1921. In the 1960s the crypt was restored and now it represents an important archaeological heritage of the city of Pavia (Arrighetti and others, 2017).

Data acquisition
Like many other Italian urban archaeological sites, the crypt of Sant'Eusebio has some characteristics that make the traditional survey techniques quite complex. The crypt is located below street level and can only be accessed through few stairs. In the past years, to protect it, a concrete structure was built around it, as shown in Figure 2. This structure limits the visibility of the monument, creating several perspective obstructions, and interferes with the planning of any topography networks. The distance between the construction and the crypt itself is extremely small; in some places it is less than 60 cm (Figure 3, point A). Besides, in the back part, the presence of three ancient tombs that interrupt the path, prevents the setup of a tripod ( Figure 4 and Figure 3, point B). The internal area is instead a quite linear and minimalist environment characterized by the presence of many columns and several niches (Figure 1). A survey with a traditional TLS is possible but requires thorough planning with the use of numerous stations without the guarantee to reach each recess of the crypt. This solution considerably extends the time required for the surveying, consequently increasing the costs, and exposes the operators to possible dangers in a prolonged way (in this specific case the crypt is safe but, as explained in the introduction, some sites may need particular attention from this point of view).   For all the above reasons, a Leica BLK2GO system was used to survey the whole site. The sensor, briefly described in the introduction, is a portable device handheld during the survey. The measuring phase can be described like a simple walk in the environment to survey. Nevertheless, it must be paid attention to some aspects: walk speed, transition between different spaces, distance from the surfaces and light conditions. Point density is directly connected to walk speed so it is necessary to adopt a constant and adequate movement during all the survey. The transition between two different environments must be done allowing cameras to orient themselves from a space to the other one; this must be done surveying contemporary the two rooms pausing few seconds under the arch of the door. In the Sant'Eusebio crypt, the light condition is a particularly challenging issue: the lighting is present only in the internal part,

A B
The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVIII-M-2-2023 29th CIPA Symposium "Documenting, Understanding, Preserving Cultural Heritage: Humanities and Digital Technologies for Shaping the Future", 25-30 June 2023, Florence, Italy even if the system is not particularly efficient, and completely absent outside. For this reason the BLK2GO was coupled with a LED light system capable to illuminate all the dark areas during the surveying phases. The light system is in add-in also supplied by Leica. Figure 5. The Leica BLK2GO with the LED light system.
Overall, eight walks were performed, both inside and around the crypt. As this was the first experience with the system, the number of the walks is far too abundant and it could be certainly reduced. However, the survey of the area, 720 metres for almost 500 million of points, took less than 1 hour (

Data processing
The acquired data was processed with the software package Leica Cyclone Register 360 (BLK Edition). Thanks to the partial overlapping between clouds, all the walks have been aligned with each other in a simply cloud-to-cloud approach. The final registration precision is 7 mm, as indicated in the program report. Leica Cyclone Register is able to use the acquired images not only to colour the generated point clouds ( Figure 6) but also to produce panoramic imagery (Figure 7).  As the present paper is focused on the use of Machine Learning algorithms for point cloud classification, only this product is considered in the following. Furthermore, since the restoration project concerns mainly the inner space, only points belonging to it have been exported and used for the next phases.

Data classification
The proposed methodology follows a quite traditional workflow with the extraction and selection of remarkable features, and the successive training and testing Machine Learning algorithms for point classification. The procedure was implemented using CloudCompare, release 2.12.1, for eigenfeature calculation, and Matlab, release 2022b, for all the other steps.

Eigenfeatures extraction and selection
The adequate choice of a neighbourhood to determine the eigenfeature values of each point, depends on the characteristics of the cloud data especially to its point density and 3D shape. The choice can be based the on a-priori definition of the search area in terms of radius or number of points (Friedman et al., 1977;Arya et al., 1998), or by adapting this parameter according to the local geometry of the point cloud (Weinmann et al., 2015b;Farella et al., 2019). While the former requires an empiric knowledge of the scene, the latter is more versatile as it is not limited to a specific dataset. Since the interior of the crypt has traditional architectural structure, the procedure implemented in this paper follows the first strategy using different searching radius (Grilli et a., 2019). This last choice is due to historical remodelling of the crypt which led to a not neglectable difference in size and shape between architectural components. For each point belonging to the cloud, a list of neighbours, falling in considered search radius, can be associated. Then, for each 3D point and its neighbours, the derived normalized eigenvalues with = 1,2,3 can be extracted using the Principal The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVIII-M-2-2023 29th CIPA Symposium "Documenting, Understanding, Preserving Cultural Heritage: Humanities and Digital Technologies for Shaping the Future", 25-30 June 2023, Florence, Italy Component Analysis (PCA). These values, obtained from the covariance matrix, represent the variation of the points distribution along the three principal orthogonal directions. Eigenvalues can be combined to obtain some shape descriptors called eigenfeatures (Weinmann et al., 2015a;Farella et al., 2019) Roffo, 2016), it is often desirable to select a compact subset of the most relevant features which allows classification/clustering without significant loss of information. This selection has also the advantage of reducing the complexity of data processing. The MRMR (Minimum Redundancy Maximum Relevance) has been chosen for this task (Darbellay and Vajda, 1999;Ding and Peng, 2005). The MRMR algorithm finds an optimal set of features that is mutually and maximally dissimilar and can effectively represent the response variable effectively. The algorithm minimizes the redundancy of a feature set and maximizes the relevance of a feature set to the response variable. The algorithm quantifies redundancy and relevance using mutual information of variables.

Machine Learning algorithms for classification
Point cloud classification was then performed using three different Machine Learning algorithms: Support Vector Machine (SVM), Decision Tree (DT), and Random Forest (RF) (Kavzoglu et al., 2020). Support Vector Machine is a nonparametric classifier method suggested for solving classification problems in datasets where patterns between the variables are unknown. SVM is based on statistical learning theory. Although mathematical algorithms are designed to classify data that are linear and have two classes, it is generalized to classify nonlinear and data multi-class data. The working principle of SVM classifier is based on the method of defining the hyperplane that distinguishes optimally the two classes optimally (Vapnik, 1995). Distance between support vectors are maximized and optimal decision function is created thanks to the obtained hyperplane. Decision Trees method is a classification method that is widely applied in the literature since tree structures has simple rules used to create it. In this classification method, the relationship between the dataset and the classes are handled in stages. A simple tree structure consists of three basic parts namely, knots, branches and leaves. In the tree structure, each attribute is represented by a node (Friedl and Brodley, 1997). The basic principle to create a tree structure by using the attribute information of the training data can be expressed as asking questions to the data and reaching the results as soon as possible according to the obtained answers. The most significant processing step in creating DT is the criteria by which branching in the tree will be done. Random Forest is based on the principle of using decision trees as the basic classifier and creating a collective learning model by combining multiple decision trees (Breiman, 2001). RF classifier outperforms most classifiers due to robustness against overfitting, ease of parametrization and speed (Kavzoglu, 2017). The main purpose of the RF classifier is to create multiple decision trees using bootstrapped sampling method. The training dataset used to create tree models in the decision forest is randomly selected from the original training dataset. Approximately, 2/3 of the randomly sampled data set is used to create the decision tree structure and the remaining part is used to test the validity of the created decision tree model (this proportion could be different according to the characteristics of the used dataset). The class label of an uncertain sample is determined using the estimated majority voting principle of each tree model in the decision forest. Regardless of classification method, the cloud has traditionally been split into two datasets: one for training and one for testing dataset. Furthermore, each point of the cloud has been characterized and labelled according to the main architectural elements: pavement, columns, half pilasters with structural function, walls, capitals, arches, and vaults.

RESULTS
The paper aims to examine if point clouds, generated by a SLAM system, have the suitable characteristics to be classify using traditional Machine Learning algorithms. The main issues are related to the uneven points distribution and the lower accuracy in the clouds, compared to common terrestrial laser scanners. Indeed, unlike TLS, whose measured points are perfectly equally spaced, the SLAM cloud presents irregular patterns with the presence of linear acquisition paths. This phenomenon can cause not homogeneous data in both density and precision; for this reason it was analysed. Figure 8 shows an example of a point cloud generated by the BLK2GO on a planar surface (in this case on a vertical wall). Even if all the should appear uniform, it is clear that some lines emerges from the whole. To evaluate this aspect a robust plane has been fitted on the cloud and perpendicular distances between each point and the plane are determined. Figure 9 shows the results in which this behaviour is emphasized; according to the scalebar, in centimetres, the colours represent the distances from the estimated plane. The maximum value is 3.3 cm while the overall noise is around 1 cm. To prevent this uniformity from affecting subsequent steps, denoising and regularization procedures were applied to the acquired data.

Eigenfeatures extraction and selection
First step of our procedure is the extraction of the eight eigenfeatures for each point of the two clouds (Section 2.3.1). Three different searching radius, 12.5 cm, 25 cm and 50 cm are used, according to architectural elements. Covariance matrix and eigenvalues are then determined, and eigenfeatures are calculated using CloudCompare and the formulas showed in Table 2.
Eigenfeatures are then normalized to the interval [0,1] and stored in a matrix having as many rows as the number of points, and 48 columns (16 columns for each searching radius); an additional 49-th column has been added containing the Z component. The MRMR method is then applied to select main relevant features. As the final choice must be suitable for the whole dataset, the feature rank is estimated three times, one for each searching radius. The so-obtained result are inserted in one final ranking list, as shown in Figure 10: the bars represent the score obtained for each feature, ordered from the lowest to the highest value. A threshold of 0.5 is set to define which eigenfeature to use for the next steps; this fixes to 17 the number of parameters, including the Z coordinate, inserted by default. Figure 10. The ranking of the considered eigenfeatures.

Point cloud classification
Three Machine Learning algorithms are tested: support vector machine, decision tree, and random forest. Preliminarily, the cloud has been manually classified subdividing the point cloud into the seven categories already mentioned. Moreover, as classification procedure requires, the cloud was split into two different datasets: training and testing. The former, corresponding approximately to the 18.6% of the whole data ( Figure 11), is used to train the algorithms. Figure 12 shows in detail the training set where the architectural elements are displayed with different colours: Table 3 reports the correspondence between features, colours and the labels used during classification procedures.   To evaluate the classification results, the confusion matrices are calculated: each point of the manual classification is compared to the corresponding one of the automatic segmentations.
On the confusion matrix plot (an example is showed in Figure  13), the rows correspond to the true classes and the columns correspond to the predicted ones, therefore the diagonal cells correspond to observations that are correctly classified, and the off-diagonal cells to incorrectly ones. The column on the far right of the plot shows the percentages of all the examples belonging to each class that are correctly and incorrectly classified. These metrics are often called the recall (or true positive rate) and false negative rate, respectively. The row at the bottom of the plot shows the percentages of all the examples predicted to belong to each class that are correctly and incorrectly classified. These metrics are often called precision (or positive predictive value) and false discovery rate, respectively.  Figure 13 reports the confusion matrix obtained using SVM learning model. As it is evident, results are extremely unsatisfying: two classes, capitals and walls, are completely ignored by the classifier while almost the whole cloud is labelled as pavement. The overall accuracy is about 20%. Figure 14 reports the result of the for the classification for the testing dataset, showing as SVM model performs bad. The image also underlines as columns are incorrectly classified almost completely as vaults. Using DT, classification results significantly improve. Figure 15 reports the confusion matrix obtained with this second learning method. Many architectural elements, such as pavement, walls, and echinus, are correctly labelled; some uncertainties remain for arches, columns and walls. The overall accuracy is about 85%. Figure 16 reports the classified point cloud of the testing dataset: the image shows visually as RD performs well using the SLAM data.   Finally, RF learning model is tested and confusion matrix ( Figure  17) is analysed. Results are like DT, with a general improvement that has mainly concerned arches and columns classification. The overall accuracy is almost the 90%. The overall accuracy is about 90%. Figure 18 reports, once again, the obtained labelled point cloud: the image is like the previous one, but a greater cleanliness is evident, especially between the arches and the vaults.

CONCLUSION
The paper aims to examine if point clouds, generated by a SLAM system, such as Leica BLK2GO, have the suitable characteristics to be classified using traditional machine learning algorithms. The main issues are connected to not uniform points distribution and to less accuracy in the clouds, in comparison to common terrestrial laser scanners. A dataset acquired on a historical place in Pavia, the Sant'Eusebio crypt, has been used for testing three well-known classification algorithms: Support Vector Machine, Decision Tree and Random Forest. A set of seven architectural elements is considered: pavement, columns, half pilasters, walls, capital, arches, and vaults. The test-site presents a couple of criticisms: a low light conditions and an irregularities of architectural structures. To face the first issue, the BLK2GO has been coupled with a lightning kit; the second problem has been overcome extracting eigenfeatures with different searching radius in order to adapt the algorithms to different geometry. Support Vector Machine is the learning method that has encountered the greatest difficulties: the algorithms seem to be not able to segment many elements and the overall accuracy is extremely poor (20%). Algorithms based on tree structures seem instead to reach good performance with an accuracy between 85% (Decision Tree) and 90% (Random Forest). The obtained results are similar to those achieved by other authors (Grilli et a., 2019), even if the crypt has a complex and not perfectly repetitive structure. Tha paper shows as SLAM data seems to have all the suitable characteristics to describe and analyse cultural heritage sites.