## 3 Clustering Methods to Compact the Visual Information  
In this section, the creation of topological models and how to compact them will be addressed. Subsequently, these models will be utilized to solve the localization problem. Only visual information and global appearance descriptors will be used in both tasks. This way, the problem will be addressed through the next two steps. 1. Learning: creating a map of the environment and compacting it. A set of omnidirectional images is captured from different positions, and a global appearance descriptor for each image is calculated. After that, a clustering method is used to determine the structure and compact the model. 2. Validation: Once the map is built, the robot obtains a new image from an unknown position, calculates the descriptor, and compares it with the set of descriptors obtained in the learning step. Through this comparison, the robot must be able to estimate its position. Focusing on the learning step, the robot moves around the environment and captures some images from different positions to cover the whole environment. This way, a set of omnidirectional images is collected \(I=\{im_{1},im_{2},...,im_{N}\}\) where \(im_{j}\in\mathbb{R}^{N_{x}\times N_{y}}\). After that, a global appearance descriptor is calculated for each image; hence, a set of descriptors is obtained \(D=\{\vec{d_{1}},\vec{d_{2}},...,\vec{d_{N}}\}\) where \(\vec{d_{j}}\in\mathbb{C}^{l\times 1}\). This set of descriptors can be considered as a straightforward model of the environments [43; 44], as some previous works do. However, in this mapping strategy, important problems appear when the environment has considerable dimensions. The larger the environment is, the more images have to be captured to model it completely. This leads to the requirement of more computational time and also more memory space in order to process and collect the information related to each captured image and to solve the subsequent localization problem. This way, the model should be compacted in such a way that it retains most of the visual information and permits solving the localization problem efficiently. In this work, we propose a clustering approach to compact the model, with the objective of creating a two-layer hierarchical structure. The low-level layer is composed of a set of descriptors and, to obtain the high-level layer, this set will be compacted via clustering. Each cluster is characterized by the common attributes of the instances that form that group. This way, the dataset \(D=\{\vec{d_{1}},\vec{d_{2}},...,\vec{d_{N}}\}\) is divided into \(n_{c}\) clusters \(C=\{C_{1},C_{2},...,C_{n_{c}}\}\) under the conditions:  
\[ \begin{gathered} C_{i}\
eq\emptyset,i=1,...,n_{c}\\ \bigcup_{i=0}^{m}C_{i}=D\\ C_{i}\bigcap C_{j}=\emptyset,i\
eq j,i,j=1,...,n_{c}.\end{gathered}  \tag{1}\]After this, each cluster is reduced to a unique representative descriptor, which is obtained in this work as the average of all the descriptors that compose that cluster. A set of representatives is obtained \(R=\{\overrightarrow{r_{1}},\overrightarrow{r_{2}},...,\overrightarrow{r_{n_{c}}}\}\), and therefore, the model is compacted. This set of representatives composes the high-level layer. Figure 3 shows how a sample map is compacted. Figure 3a shows the positions where panoramic images were captured to cover the whole environment. The result of the clustering process is presented in Figure 3b, and then, one representative per cluster is obtained (Figure 3c). The representative descriptor is obtained as the average descriptor among those grouped in the same cluster. Additionally, the position of this representative descriptor is calculated as the average position of the capture points of the images included in the same cluster. These positions are calculated just as a ground truth to test the performance of the compact map in a localization process, but they are not used either to build the map, nor to localize the robot. Only visual information is used with these aims. Different clustering methods will be analysed.