Improving Fingerprint Indoor Localization Using Convolutional Neural Networks

Two obstacles lie in the traditional Signal Strength Fingerprint Positioning method. Initially, the algorithm cannot converge quickly and accurately due to massive data generated by large indoor environment. Secondly, it is difficult to determine a specific floor in a building using the received Signal Strength(RSS). This article proposes a method, which uses convolutional neural network (CNN) to classify the floor and location of Bluetooth RSS as well as magnetic field data to calculate the final coordinates, could apply Fingerprint Positioning into indoor environment with large areas and multiply floors. The method involves converting the collected Bluetooth RSS into the “fingerprint image” required for calculation and establishing the CNN for classification training. Subsequently, the real-time Bluetooth RSS are imported into the CNN to classify the floor and determine the transmitters’ location. Additionally, the observer’s coordinates are matched using the magnetic field data. Our experiments suggested that the proposed method can classify floors and transmitters’ locations with predictable bunds of 0.9667 and 0.9333, respectively. At the same time, the average positioning error is less than 1.2 m, which is 43.32% and 44.67% higher than the traditional Bluetooth and magnetic field fingerprint positioning. The accuracy of dynamic positioning is also within 1.55 meters.


I. INTRODUCTION
With the evolution of Internet and mobile communication technology, the demand for location information services is growing, and navigation and positioning services have become a critical part of many people's lives. The Global Navigation Satellite System (GNSS) has become one of the most important positioning tools for its real-time capability and its accuracy [1]- [3]. As satellite signals cannot penetrate walls, it is impossible to locate people and objects indoors, which is where people spend most of their daily lives. The need for indoor location information services, such as monitoring pedestrian flows at airports and stations, positioning people and stores in shopping malls, and monitoring the location of medicine in hospitals, is becoming increasingly The associate editor coordinating the review of this manuscript and approving it for publication was Di He . urgent. Therefore, the R&D of indoor positioning systems is also growing in importance.
Technologies such as Wi-Fi, RFID, infrared, and ZigBee have been developed for indoor positioning [4], [5]. Bluetooth low energy (BLE) positioning technology has become a research focus because of its low energy consumption, low cost, and compatibility, and because of the small size of BLE devices [6]. Because a Bluetooth module is integrated into most mobile devices, including mobile phones, laptops, and tablets, no additional device is needed. A common Bluetooth positioning method is based on received signal strength (RSS) [7]- [9]. There are two methods of signal strength positioning. The first is through the attenuation of the signal during transmission. By establishing a distance and signal attenuation model, the distance between the target and the launch station can be measured, and the coordinates of the target can then be calculated. However, when a Bluetooth signal is transmitted indoors, the problems of non-view distance propagation and multipath propagation inevitably occur. This is why the second method, fingerprint positioning [10]- [12], is often adopted. In this method, the positioning environment is divided into several grids. Signal fingerprints (such as Bluetooth signal strength) are collected at the grid points and stored in a fingerprint database. In the positioning process, received measurements are compared with the grid fingerprints to estimate the location by matching and similarity analysis.
While Bluetooth positioning has better practicability than other positioning technologies, it also has limitations. One advantage of Bluetooth fingerprint positioning is that the algorithm is simple, but this method needs to collect a large amount of fingerprint data in advance to establish a fingerprint database. During the positioning process, each fingerprint data in the fingerprint database needs to be matched, which takes up a large amount of computing resources. At the same time, due to the complexity and variability of the indoor environment, the quality of the signal strength data collected during the establishment of the fingerprint database and real-time positioning is likely to be poor, which ultimately leads to large positioning errors. The application of machine learning technology [13]- [15] to indoor positioning can solve the problem of matching positioning occupying a large amount of computing resources, and improve the stability of positioning, but most signal strength fingerprint positioning algorithms cannot distinguish floors. Because when multiple unknown points are on different floors they are difficult to locate, Bluetooth fingerprint positioning cannot locate its targets in large-scale indoor environments.
In this article, we use a convolutional neural network (CNN) in deep learning [16], [17] to solve these problems. CNNs are often used in tasks such as large-scale image recognition and natural language processing, because they can extract feature information and determine the category by comparing the feature information. Researchers are employing CNN technology when using visual positioning method for indoor positioning. By analyzing the CNN's image recognition, we can see that if we can turn the fingerprint data collected at the reference point into the image used for training in the CNN, and convert the data collected during positioning into the image to be recognized, then the CNN can be applied to the fingerprint location of Bluetooth signal strength. Because of the CNN's abilities to extract features and classify the data, this method can extract the features of the Bluetooth signal strength and then classify the floor and location area of the data to be fixed in the fingerprint positioning.
The experimental equipment in this article consists of a smartphone and 144 BLE base stations. First, in the construction of the ''fingerprint library picture,'' all the fingerprint data are spliced together to form the ''fingerprint image'' data for training. Then a CNN for floor classification and localization is built, and the data are convolved into the neural network for training to obtain a model for floor classification and a model for determining location areas. The received real-time positioning data are brought into the trained model to obtain the floor and location area of the unknown point, and then the magnetic field fingerprint map is used for matching to obtain the final location coordinates in order to realize the positioning function. Compared with traditional Bluetooth signal strength and magnetic field matching positioning, this method can use Bluetooth signal strength to quickly determine the area of the point to be measured, and improve the efficiency and positioning accuracy of magnetic field matching positioning. This method could apply fingerprint positioning into indoor environment with large areas and multiply floors.
The remainder of the paper is arranged as follows. Section 2 introduces the related literature on indoor positioning technology. Section 3 describes the establishment of the data and the construction of CNNs. Section 4 describes the experimental environment and equipment and analyzes the experimental results. Section 5 provides a summary of the paper.

II. RELATED WORK
Increasing demand for indoor positioning has motivated much research. There are two main methods of Bluetooth positioning. The geometric method measures the distances or angles from known points to unknown points and uses their geometric relationship to locate the unknown points. Kotanen et al. [18] used the geometric method. Through a simple model, the attenuation of Bluetooth signal strengths from transmission to acceptance was converted to distances from which the three-dimensional coordinates of the unknown points were calculated using extended Kalman filter (EKF). However, the accuracy of this method depends on the accuracy of distance estimation, which is greatly affected by the environment. The complex indoor environment often leads to multipath effects in the propagation of a Bluetooth signal, which degrades the accuracy of distance estimation and affects positioning accuracy. For this reason, the second Bluetooth positioning method, which is based on signal strength matching, is used more often. With this method, the principle of Bluetooth positioning is similar to that of Wi-Fi positioning. The radio frequency RADAR system [19] developed by Microsoft in 2000 is an RSS-based indoor positioning system. Prior to the process of real-time positioning, it collects a large number of signal strength samples in the positioning area and establishes their mapping relationships with the coordinates of the location. The mobile terminal compares the signal value received at the wireless access point to the existing RSS and the geographic location mapping database, finds the most likely result, and completes the positioning. Subsequent Bluetooth positioning research based on signal strength is also based on this theory. Cruz et al. [20] proposed the use of the k-nearest neighbor (KNN) algorithm for Bluetooth positioning, which also selects a number of points with known coordinates in the positioning area, collects the signal strengths at these points, and stores the coordinates and corresponding signal strengths in the fingerprint database in the offline phase. In the online phase of real-time positioning, it matches the signal strengths received at unknown points to the fingerprint database to find the k-nearest sets of signal strengths and the corresponding coordinates, and calculates the coordinates of the unknown points using the KNN algorithm. The Bluetooth method based on signal strength matching is less affected by the environment than the geometric method and has a simpler calculation model, but has its limitations. The KNN algorithm uses the mean value of the coordinates of the K nearest reference points as the calculation result, which cannot accurately reflect the true position of the point to be measured. Therefore, various improvements have been made. Brunato and Battiti [21] proposed a weighted KNN algorithm (WKNN) to improve the positioning accuracy of KNN. As with the KNN algorithm, the k-nearest fingerprint point data are found in the fingerprint database, and the Euclidean geometric distances between the RSS of the fingerprint points and those of the target are calculated and weighted so that a point with a shorter distance gets a greater weight. With the introduction of the weight, the calculation becomes more practical, and the positioning accuracy is improved. Analysis of KNN and WKNN indicates that they have the same defect in positioning, which is the need to match the signal strength received in real-time positioning with all of the data in the fingerprint database, which requires a great deal of computational time, and there is so much data in the fingerprint database that real-time calculation is significantly affected. Castillo-Cara et al. [22] and others made some improvements to solve this problem. They used a support vector machine (SVM) to classify the data and determine the type of data in the fingerprint database that is received at the time of positioning, and used KNN for location calculation within that type of data. This reduces the calculation time and improves the accuracy and stability of positioning.
Magnetic field positioning is another important indoor positioning technology. Because indoor magnetic fields exist naturally and smartphones currently contain magnetic field sensors, the use of magnetic fields for indoor positioning does not require additional equipment. Many researchers are using magnetic field data for indoor positioning [23], [24]. Magnetic field positioning technology uses a magnetic field as a fingerprint signal and ultimately achieves positioning by matching the significant magnetic field characteristics of the indoor environment [25]. As with Bluetooth fingerprint matching, a magnetic field fingerprint library needs to be established first, and positioning is ultimately achieved by matching magnetic field features. Due to the spatial correlation distribution of magnetic field characteristics, in addition to single-point matching, magnetic field matching can also achieve more robust matching results through contour matching and multi-point contour matching. Zhang et al. [26] used crowdsourcing technology to build a magnetic field fingerprint database and used a Monte Carlo method to match the final position coordinates of the pending point. The positioning error of this method is within 5 m, but the amount of calculation required for position estimation is large and is resource intensive. To improve magnetic field positioning accuracy, Moreno et al. [27] used magnetic landmarks to improve positioning accuracy. The obtained magnetic field x, y, z three-axis data are stored as fingerprint data in the fingerprint database, and then clustered using the expectation maximization algorithm. Each cluster is used as a unique landmark for finding the location of users.
However, Bluetooth positioning and magnetic field positioning each has its own limitations. The research on these two fingerprint positioning methods shows two reasons why fingerprint positioning cannot be used on a large scale. First, in large-scale deployments of fingerprint positioning, there is a large amount of fingerprint data, and processing the data requires a good deal of computing resources, and the methods cannot determine the floor of the point to be measured. The second reason is that fingerprint positioning cannot accurately describe data changes in a complex and unstable indoor environment, which leads to unstable positioning.
Deep learning technology has facilitated the processing of large-scale data [28]- [31]. In deep learning, sample data are input into the algorithm model, and the model automatically extracts features from the sample [32]- [35]. As the model deepens, basic and higher-level features are combined so that large amounts of data can be processed, and the prediction results become stable. Introducing deep learning into indoor positioning can help overcome the shortcomings of fingerprint positioning. Researchers are now using deep learning methods for indoor positioning. For example, Xu et al. [36] used a CNN for indoor visual positioning.
This article uses the CNN method to first determine the floor in the building, so it can locate the Bluetooth fingerprint, then convert the signal strength fingerprint database received in offline database construction into a ''fingerprint image,'' establish the CNN required for positioning, and finally input the data collected by real-time positioning into the CNN. The trained model predicts the floor and location area. Once the location area is determined, the magnetic field data matching method is performed in the area to estimate the coordinates of the pending point. This method requires less preprocessing than traditional signal strength fingerprints and can reflect the changes of fingerprints more accurately. When predicting coordinates, this method can also reduce the impact of nonline-of-sight propagation caused by a complex indoor environment on positioning and improve positioning accuracy.

III. MODEL AND METHODS
The above analysis of an indoor positioning algorithm shows that current fingerprint location algorithms cannot identify the floor, making it impractical for large-scale applications. Therefore, this article proposes the use of CNNs for indoor positioning, which overcomes the limitation of use in large-scale applications due to the signal strength fingerprint location's inability to determine the floor. The Bluetooth signal strength is collected at the reference point as the feature data, and the floor number is used as the label to train the CNN in order to identify the floor where the unknown point is located. Once the floor is identified, the signal strength in fingerprint data is taken as the feature data, the region where the reference point is located is used as the label to train the CNN, and the model is used to determine the location area of the unknown point. Once the location area is determined, the collected magnetic field data are matched with the magnetic field data in the fingerprint database of the region, and the coordinates of the unknown point are calculated. The positioning process of the method is shown in Fig. 1. However, special instruments used in specific environments such as hospitals can affect magnetic field, resulting in inaccurate location coordinate calculations. Therefore, when these instruments are working, the coordinates of the reference points are used as the final coordinates of the points to be measured.
As with the traditional fingerprint location method, the method of signal strength fingerprint location using a CNN consists of an offline phase and an online phase. In the offline phase, it is necessary to collect the signal strength values of each anchor point (AP) on the selected reference points in the positioning field while recording the coordinates of these reference points and the floors on which they are located, then establish the corresponding fingerprint database and the CNN to train the data in order to obtain the classification model for determining the floor and location. In the online phase, the signal strength data on the unknown point is collected and put into the trained CNN to calculate the positioning result.
In the online phase, the signal strength data on the unknown point is collected and put into the trained CNN to calculate the floor and location area, and then calculate the final coordinates through magnetic field matching. Below we list the software and hardware required for the experiment and describe the format of the input data, the establishment of the CNN and the calculation of the magnetic field position.

A. SOFTWARE AND HARDWARE
The computer used for CNN calculation runs Windows 10 and uses the Python 3.7 programming environment and the TensorFlow framework tool for designing the CNN.
TensorFlow, developed by Google, supports all types of deep learning algorithms and has been applied to deep learning R&D by many technology companies and research institutes. The GPU version of TensorFlow was selected, because the CNN has a large amount of calculation data and is very computing resource-intensive. The computer used is a Hewlett-Packard notebook with 8 GB RAM. The graphics card is an Nvidia GeForce GTX 1650 with 4 GB of graphics memory. The configuration of software and hardware is shown in Table 1.

B. RSS IMAGE CREATION
The CNN usually processes images, meaning that the fingerprint data to be trained should be transformed into a ''fingerprint image'' prior to the convolution operation. This is very different from the conventional fingerprint method. In this article, 144 Bluetooth APs are used in the experimental environment. During the collection process, the mobile phone receives the signal strength of each AP at each reference point. The signal strength will be denoted as 100 if it cannot be received under the circumstances that the AP is far away from the mobile phone or is not on the same floor. The received data are shown in Fig. 2.
The first row of Fig.2 is the title of the variables, in which contains 149 columns of data in total. The first 144 columns are the signal strength data corresponding to the MAC addresses of each Bluetooth transmitting station. Columns 145 and 146 are the coordinates corresponding to the reference points; column 147 represents the floor where the reference point is located; column 148 represents the category number; column 149 represents the epoch of the data collection. Starting from the second row, each row of data is the complete fingerprint data recorded at a reference point. In the data preprocessing, after experimental verification, the Bluetooth signal strength of less than -100dbm or the data not received at each reference point is recorded as 100. There are 49 reference points selected in the positioning field of three floors. In order to ensure the classification accuracy of CNN, the trained classification model can accurately classify the Bluetooth signal strength data received at any time during positioning. During the offline Bluetooth fingerprint library collection, multiple sets of data were collected every day at each reference point for a week.
The signal strengths received at each reference point should be converted into a picture. Therefore, the signal strengths are taken as eigenvectors, and the 144 signal strengths collected at each reference point are converted into  a 12 × 12 eigenvector, as shown in Fig. 3. The eigenvector is then transformed into a grayscale image, as shown in Fig. 4. In this way, the complete reference point fingerprint data are transformed into a fingerprint image whose features are then extracted using the CNN, and the classification is then completed.

C. ESTABLISHMENT OF CNN
When the data are sorted out according to the prescribed format, it is necessary to establish its own CNN to identify the floor and estimate the position. The CNN includes an input layer for data input, a hidden layer, and an output layer for the output results. The hidden layer includes convolution layers, activation layers, pooling layers, and fully connected layers.

1) CONVOLUTION LAYER
The function of the convolution layer is to extract the features of input data. The convolution layer contains several convolution kernels used to extract the basic features of the image. The more convolution kernels there are, the more basic features that are obtained, which makes the convolution layer abstract and rich in high-order features. The feature map is obtained after convolution operation of the fingerprint data image. The convolution operation is shown in the formula as follows: where S is the identification of the feature map, whose coordinates are (i, j). K is the convolution kernel, I is the twodimensional matrix composed of image pixel values input by convolution operation, and (m, n) are the coordinates of the convolution kernel. Convolution layer parameters include convolution kernel size, step size, and filling, which together determine the size of the feature map output by the convolution layer, and are the CNN's hyperparameter. The convolution kernel size can be any value that is smaller than the size of the input image. The larger the convolution kernel, the more complex the input features extracted. The convolution step defines the distance between the positions of two adjacent scans when the convolution kernel scans the feature image. When the convolution step is 1, the convolution kernel will scan the elements of the feature map one by one; when the step size is n, it will skip n-1 pixels in the next scan. For fingerprint data, the convolution step is 1. The full filling is selected according to the nature of fingerprint.

2) ACTIVATION LAYER
In the CNN, the output of each layer is a linear function of the input of the upper layer. Thus, no matter how the network structure is constructed, the output is a linear combination of inputs. However, the actual data to be processed are nonlinear.
To solve this problem, an activation layer is added to the convolution layer and pooling layer. The most important part of the activation layer is the activation function, which mainly maps features to a high-dimensional nonlinear interval for interpretation and solves problems that the linear model cannot solve. Other activation functions include sigmoid function, ReLU function, and tanh function. The ReLU function offers calculation efficiency, solves the problem of gradient disappearance, and simplifies the calculation process, which is in line with the experimental requirements. Therefore, this article uses the ReLU function as the activation function, and its function analytical formula is

3) POOLING LAYER
The pooling layer of the CNN is composed of the pooling function. After obtaining features by convolution, the pooling layer uses these features for classification. In theory, all the features extracted by convolution can be the input of the classifier but that entails a tremendous amount of computation. Therefore, the pooling function is used to further process the feature map obtained by the convolution operation. Each convolution kernel can be regarded as a feature extractor, and different convolution kernels are responsible for extracting different features. After Max Pooling in the indoor localization experiment of the CNN, those kernels that can truly identify the features are extracted, and those not quite useful for extracting specific features are discarded. Therefore, in the subsequent calculation, the size of the feature map is reduced, so as to reduce the number of parameters and the amount of calculation without losing the effect.

4) FULLY CONNECTED LAYER
In the fully connected layer, all neurons are connected by weight. The fully connected layer is usually at the tail of the CNN. When the convolution layer accumulates enough features to identify the image, the next step is classification. The cuboid obtained at the end of the CNN is spread into a long vector, which is sent to the fully connected layer to cooperate with the output layer for classification. A dropout function is introduced to the fully connected layer to prevent overfitting during training, thereby improving the generalization ability of the model.
Using the characteristics of the experimental data and the environment, we established the CNN for floor determination and location classification. The CNN's structure is shown in Fig. 5. As shown in Fig. 5, the input data size is 12×12. Due VOLUME 8, 2020  to the small data size, in order to realize the two functions of floor classification and positioning, after continuous experimental tests, the input data after convolution layer do not directly carry out pooling calculation but continue to carry out the convolution operation before entering the pooling layer. After going through two convolution layers and one pooling layer, the pooled data enter the entire company layer and are finally classified accurately. To optimize the performance of the CNN, the selection of the convolution kernel size is also tested. Combined with the data size, the convolution kernel selection is 3 × 3, but when the convolution kernel is 5 × 5 or even larger, the computational performance will decline. By analyzing the data and referring to popular CNNs such as AlexNet and GoogLeNet, through the experimental test, the feature map of the first two CNNs is set to 64, the parameter quantity of each convolution layer is 640, the feature maps after pooling are 128, the number of feature maps of the last two convolution neural networks is 128, and the number of parameters in each convolution layer is 73,856. The structure of the CNN established in this article is shown in Table 2.

D. COORDINATE CALCULATION
After determining the floor and the area where the unknown point is located, the magnetic field data collected from the unknown point are used to match the magnetic field fingerprint data collected in the area, as shown in Fig. 6, and finally the position coordinates are calculated. In the fingerprint data collection, not only the Bluetooth fingerprint data of the reference point but also the magnetic field fingerprint data are collected at the four corners of the reference point control area. Kriging interpolation is used to interpolate the data into a magnetic field fingerprint map, and then the KNN algorithm is used to determine the magnetic field fingerprint location. Use convolutional neural network to quickly determine the range of magnetic field matching, improve positioning efficiency and accuracy.
However, some medical instruments change the magnetic field near the area, resulting in large errors or locating failure when positioning activities are near these instruments. However, the operation of these devices has minor effect on the received Bluetooth signal strength. Therefore, when these devices are running, if the fixed point is classified into the range controlled by the reference points near these devices, their coordinates will be replaced by the coordinates of the reference points in the matching area.

IV. EXPERIMENTS AND RESULTS
The experiment was carried out in Dongfang Hospital of Qiqihar city in China. The positioning fields were set up on the second, third, and fourth floors of the hospital, as shown in Figure 7. Each of the three floors is 27.6 m long and 12.8 m wide, for a total area of 1059.84 square meters. The iBeacon commercial base station produced by VOLIVAM Company was selected as the Bluetooth signal transmitting station, and a Nokia X7 mobile phone equipped with the Android 9.0 operating system was selected as the mobile device to be located. The sampling frequency of Bluetooth fingerprint data was 20 Hz, and that of magnetic field data was 50 Hz.
A total of 144 Bluetooth base stations were deployed in the positioning field of the three floors for positioning. The base stations were set on the wall 2.5 m above the ground in order to reduce the impact of indoor objects on signal transmission, taking into consideration that the base station was small, consumed little energy, and produced a stable signal. In order to ensure the diversity and complexity of the environment, a room is randomly selected for positioning on each floor outside the corridor. A total of 49 reference points were selected for Bluetooth fingerprint data collection, as shown in Fig. 8. Therefore, there were 49 categories that needed to be trained by the CNN we designed. The control area of each reference fingerprint point was 1.8 m × 1.8 m. The magnetic field fingerprint data were collected at each of the four corners of each control area, and the magnetic field map of each reference point control area was interpolated by the kriging method.
During the process of fingerprint data collection and positioning, the mobile phone was held horizontally to receive Bluetooth and magnetic field data, as shown in Fig. 9. In the control area of 49 reference points, 30 points of known floor and location area were selected as the points to be located for the experiment. In order to test the universality to the environment, 6 of the 30 points to be tested are located in the selected room. In order to reduce the impact of sudden changes in the indoor environment on the performance of the convolutional neural network, the training data can fully reflect the changes in signal strength with the environment and improve the classification accuracy. Data were collected at each of the 49 reference points for a week. The data collected in the first six days were used  for training, and the data from the seventh day were used for verification.

A. FLOOR CLASSIFICATION EXPERIMENT AND RESULTS
The main reason why the traditional signal strength fingerprint location method is not widely used is that the floor where the unknown point is located cannot be determined by matching the feature data of the received signal strength alone, and therefore it can only estimate the location once the floor is determined, making it difficult to be used in indoor environments of large area and with multiple stories. Compared with the traditional signal strength fingerprint location, a CNN can determine the particular floor without extra equipment and data. The Bluetooth signal strength fingerprint data are used as the feature matrix, and the floor number is taken as the label. The CNN is trained using the designed data format. The parameter settings of the CNN are shown in Table 3.
The parameters settings of the CNN are not fixed, and different parameters will lead to different calculation results. Taking into consideration the characteristics of the input data, after continuous testing, when the CNN is used for floor classification, the performance is optimal when the batch size is set to 30, the learning rate is set to 0.001, and the training epoch is set to 30. After setting the parameters, the data are trained. After the CNN is trained, the verification data are brought into the network to verify the accuracy of the calculation. Then, 30 points with known floors and coordinates are selected in the positioning field, and the Bluetooth signal strength data are collected on these points. The signal strength data collected on these 30 points are taken as test  data and put into the trained CNN for calculation. We use validation accuracy, loss, and testing accuracy to evaluate the performance of CNN. Validation accuracy represents the proportion of correctly classified data in validation data, and testing accuracy represents the proportion of test data correctly classified. The results of loss and validation accuracy are shown in Fig. 10.
It can be seen from Fig. 10 (a) that the loss value corresponding to each epoch decreases with the increase of epoch and tends to be stable after 20. From Fig. 10 (b), it can be seen that the validation accuracy increases with the increase of epoch and Validation accuracy stable at 0.9796. The final calculation results are shown in Table 4.
The calculation results show that validation accuracy reaches 0.9796, while testing accuracy reaches 0.9667, and loss is 1.014. Through the analysis of the calculation results, VOLUME 8, 2020 it can be seen that the floor where the unknown point is located can be determined using a CNN without extra equipment and feature data, making the signal strength fingerprint location method usable in indoor environments with large area and multiple stories. To verify the stability of the algorithm, data were collected at the same points 10 times at different times over three days. The calculation results are shown in Fig. 11. The results of the 10 times of calculation show that the lowest test accuracy was 0.9, the highest was 0.9667, and the average value of the 10 times was 0.93. The results indicate that the CNN model established in this article can classify the floors using only the Bluetooth signal strength and determine the floor where the unknown points are located. The average accuracy of the test was 0.93. Analysis of the experimental results shows that the use of convolutional neural network can be used to determine the floor of the signal strength received by the test point.

B. POSITIONING EXPERIMENTS AND RESULTS
After performing floor classification, the CNN is used for estimate position. As with floor classification, first, the signal strength fingerprint data collected by the mobile phone are sorted by corresponding format, then brought into the program to be transformed into the corresponding feature matrix, while the area data in the fingerprint data are selected as the label. The feature matrix and label data are trained in the CNN established to estimate position. The Bluetooth signal strength data and magnetic field data are collected on the unknown points, and the Bluetooth RSS data are taken into the trained CNN as the feature matrix, and then the region where the unknown points are located can be estimated, thereby completing a rough positioning. The parameter settings of the CNN for positioning are shown in Table 5. First, the verification data are brought into the CNN for verification. Then, the Bluetooth signal strength data collected on the 30 unknown points are put into the trained CNN for classification calculation in order to determine the location area of the unknown points.  Taking into account the characteristics of the input training data, the batch size, learning rate, and training epochs are finally set to 50, 0.0001, and 30, respectively. Continuous experimental tests showed that the CNN has the best performance. The training results are shown in Fig. 12. Fig. 12 (a) shows the loss of each epoch in the training process, and Fig. 12 (b) represents the variation of validation accuracy with each epoch.
The final calculation results of the CNN used for positioning are shown in Table 6. The loss of the CNN is 1.107, the validation accuracy is 0.9592, and the testing accuracy is 0.933. The results indicate that the CNN can classify the unknown points, and then determine the area where they are located.
Once the area where the unknown points are located is determined using the CNN, the magnetic field map data of the area are obtained from the fingerprint database, which is matched with the magnetic field data collected on the unknown points to estimate the final coordinates. To verify the accuracy of the positioning results, the Bluetooth fingerprint data are collected on the magnetic field data collection points to establish the fingerprint database, and   the KNN algorithm is used to perform traditional fingerprint positioning on these 30 test points. At the same time, the traditional magnetic field positioning method is used to locate these 30 points. The results of the comparison between the three positioning methods are shown in Table 7. The minimum positioning error of 30 points tested is 0.2306 m, the maximum positioning error is 2.0995 m, and the average positioning error is 1.1753 m, which are all better scores than those of the traditional Bluetooth and magnetic field matching algorithms. The maximum error value appears at the point where the matching error occurs.
The positioning error of each point is then analyzed, and the cumulative error distribution is shown in Fig. 13. The comparison results show that the CNN can classify the data categories of the fingerprint database more precisely, which improves the accuracy and stability of positioning. To verify the stability of the algorithm, the collected data from 10 times were also brought into the CNN for positioning. The testing accuracy of the 10 repeated location classification experiment tests are shown in Figure 14. The average testing accuracy of the 10 tests is 0.92, which meets the positioning requirements and can accurately determine the location area of the unknown points. The positioning accuracy of the 10 tests is significantly improved compared to traditional Bluetooth and magnetic field fingerprint positioning accuracy. The average positioning results of 10 repeated experiments are shown in Table 8.
The comparison results of the average positioning error of the 10 repeated tests indicate that the average positioning error using CNN is less than that of traditional Bluetooth and magnetic field fingerprint positioning, positioning accuracy increased by 43.32% and 44.67% respectively.
Some instruments in the hospital will interfere with the magnetic field at work, resulting in large errors in the magnetic field matching positioning result. Therefore, when the  Bluetooth data received at the unknown point is classified to be near these devices by CNN, their coordinates will be replaced by the reference point coordinates of the area. To verify the rationality of the scheme, we conducted experimental verification in rooms where the described instruments were installed. Specifically, the room where reference points 13-18 and 46-49 are located. 5 unknown points are selected in each of the two rooms for the experiment as shown in the figure 15. Before the experiment, the effect of instrument status (i.e. working and not working) on the received Bluetooth signal strength was verified, and it is concluded that whether these instruments worked or not has no effect on Bluetooth signal. In the experiment, when the instrument is turned off, the location classification of the Bluetooth signal is performed using CNN. Then, the coordinates are calculated using the magnetic field matching method. When the device is working, since the received Bluetooth signal will be classified into the area controlled by corresponding reference points, the coordinates of these reference points are used as the coordinates of the unknown points. The positioning errors of the 10 selected unknown points calculated in the two cases above are shown in Table 9.
Through the error analysis of each point, it can be seen that when the instrument is turned on, the average error of using the reference point coordinates as the pending coordinates is 0.782m, which is less than the positioning error of traditional KNN Bluetooth fingerprint. The classification accuracy of CNN is 0.9 m. The maximum positioning error occurs at point 8 of the misclassification. It is shown that the error is quite small when the unknown points are close to the reference points, and the error is larger when the reference points are far away. All the errors are less than 1.273m, which meet the precision requirements. The comparison of the two cases at each point shows that the stability of positioning accuracy of the proposed method is weaker than that of the positional results calculated by the magnetic field when the instrument is not working.
To further verify this conclusion, 10 repetitive experiments were performed on these 10 points. The cumulative score of the positioning error is shown in Figure 16. The above conclusion is verified through error analysis.
The experiments suggest that: (1) compared with traditional fingerprint location methods, using the CNN for signal strength fingerprint location can accurately identify the floor where the unknown points are located.(2) CNN can accurately classify their location area, so as to improve the accuracy and stability of the final coordinate estimation, thereby enabling the signal strength fingerprint location method to be used in large-area indoor environments.

C. DYNAMIC POSITIONING
After verifying the positioning accuracy of the unknown points, a dynamic positioning experiment is carried out on the 4th floor of the hospital. All the instruments in the hospital were working properly during the experiment. The real trajectory was shown in Figure 17with Bluetooth and geomagnetic data sampled at the same frequency as in the above experiment. To verify the accuracy of dynamic positioning, ten repeated experiments were performed on this trajectory. After CNN classification and coordinate calculation, the positioning error of each point is analyzed. The distribution of cumulative positioning error is shown in Figure 18.
We found that the error of dynamic positioning is larger than that of static positioning due to accuracy of CNN classification (91.667%, which is lower than that of static positioning). The average error of dynamic positioning is 1.526 m, which is significantly improved compared with traditional KNN Bluetooth positioning. In the vicinity of the room where the instrument changes the magnetic field, the positioning accuracy also meets requirements. Therefore, whether in static or dynamic positioning, improving fingerprint indoor localization using Convolutional Neural Networks (CNN) can improve positioning accuracy.

V. CONCLUSION
The main work of this article consists of two components. The Bluetooth signal strength data in the fingerprint library are converted into a ''fingerprint image'' using the characteristics of the CNN to accurately classify image data, so as to apply the CNN to the fingerprint positioning method.
First, the CNN is used to classify floors, and through fingerprint data training, the floor of the pending point can be determined only by receiving the Bluetooth signal strength in real-time positioning. Here, the test accuracy rate reaches 96.7%. Second, the CNN is used for positioning. After training, it can accurately determine which reference point the pending point is in the real-time positioning process. The test accuracy rate reaches 93.33%, and the unknown point is calculated by the magnetic field matching method. The final coordinate of the point, which is the positioning error, is less than 1.4 m. The CNN is used for dynamic positioning, the accuracy of classification exceeds 91%. The accuracy of dynamic positioning is also within 1.55 meters. The fingerprint location method based on convolutional neural network can be used in multi-floor large-area indoor environment, which solves the problem that traditional fingerprint location cannot judge the floor and cannot be used in a large range, and improves the practicality of fingerprint location