# Parking Guidance System Based on Geomagnetic Sensors and Recurrent Neural Networks

Authors: Chengjuan Ren; Sukhoon Lee; Dongwon Jeong; Haotian Chen; Yan Xiao
Journal: Journal of Sensors
 (2022)

---

## Abstract

The increase of motor vehicles year by year has led to a number of parking difficulties and traffic congestion problems. The intelligent parking system can effectively alleviate the parking difficulties and has received wide attention. Geomagnetic sensors are widely used due to their low cost and easy deployment. However, traditional geomagnetic parking detection algorithms cannot cope with complex parking behaviors and have low vehicle detection performance. Therefore, in this paper, a new parking guidance system is proposed by integrating related technologies such as ZigBee, geomagnetic sensor, and RNN. With our limited knowledge, in the research branch of the parking guidance system, RNN is applied to geomagnetic vehicle detection for the first time to detect the status of parking spaces and obtain more accurate identification results of geomagnetic signals. The training data is obtained from real scenarios. It is experimentally demonstrated that our method receives 96.6% accuracy in the detection of vehicle status, which is 9% higher than the state-of-the-art method. Finally, a robust parking guidance system gets 97% accuracy.


---

## Body

## 1. Introduction

By the end of 2020, according to the report by the National Bureau of Statistics, the number of motor vehicles in China has soared to more than 448 million, among which the accumulative number of cars has reached 360 million resulting in a severe shortage of parking lot. Due to the increase in the number of cars, the shortage of parking lot in the city has also much impact on the market development lot of the city parking industry [1, 2]. Moreover, the National Development and Reform Commission explains about 5 percent of a car’s entire life is spent on the road, with the rest of the time sitting idle in the parking lot. Statistics further show that the ratio of cars to the parking lot in developed countries is about 1 : 1.3 while the same ratio in big cities in China reaches 1 : 0.8. The ratio of small and medium-sized cities is about 1 : 0.5, which is far lower than that of developed countries. The worse problem, the most inconvenient issue is to find a parking space, especially in an emergency. The larger the parking lot, the longer it takes to find the one which meets some queuing and congestion in the parking lots [2]. That is the more anxious, the more difficult to obtain the parking lot. However, the impact of difficult parking is far more than the surface seems so simple, such as environmental pollution and even traffic accidents. Therefore, difficult parking has become a serious social concern.The smart city refers to the use of various information technologies or innovative approaches to integrate the city’s constituent systems and services, improve resource utilization efficiency, optimize urban management and services, and ultimately improve the quality of life of citizens. In the real environment, the installation and maintenance of the parking system is not convenient, and the monitoring point is easy to be destroyed. The system is common high sensitivity or error detection rate. To solve the problem of difficult parking, researchers start from a smart city, and use scientific and technological means to promote urban development to speed up the implementation of smart traffic and smart parking, and create a more convenient and intelligent urban parking network. Recently, the effective management of parking lots, intelligent parking system, and other related studies have also attracted great attention to researchers. Collecting traffic information and the method of vehicle detection in intelligent parking systems are essential elements of the system which can effectively promote the development of intelligent urban transportation. At present, some common detection methods of the parking lots are mainly as follows [3]: microwave radar detection, infrared detection, induction coil detection, ultrasonic detection, video detection, geomagnetic detection, and acoustic detection. Geomagnetic sensors, inductive loop detectors, and camera detectors are used to collect traffic information. Induction loops and cameras are often used to detect vehicles on the road. However, there are many disadvantages when they are used in complex traffic scenarios. The weaknesses of induction circuits include high maintenance costs, difficult installation, and destroying road surfaces. Visual-based systems are weak to weather various, occlusion of motor vehicles, low image resolution, and attitude changes. Besides, vehicle detection or identification through cameras requires a huge amount of storage space and computing power [4]. The detection methods based on geomagnetic sensors detect vehicles by collecting geomagnetic fields around the parking lots. It has the advantages of compact size, convenient installation, and relatively robust interference to the environment and electromagnetic signals. But, the traditional geomagnetic detection methods are mainly based on the variation of the magnetic field detected by the geomagnetic sensor relative to the base value of the magnetic field, and the finite state machine is used to make the decision. The defects of the way are also obvious. The base value of the magnetic field drifts over time, and it is also be affected by the vehicles of adjacent space. Considering the cost, adaptability to the environment, and the difficulty of installation and replacement, the work finally selects the geomagnetic sensor to detect the vehicle [5]. To solve the low accuracy of geomagnetic detection and improve the performance of the parking system, the paper employs recurrent neural networks to optimize the detection method [6]. According to our limited knowledge, this is also the first time that RNN has been applied to the parking system to achieve excellent performance. A new parking guidance system is set up in our works.The rest of the article is arranged as follows. Section2 introduces the related works of work topic. Section 3 covers the description of the whole system. The core technology of system implementation is presented in Section 4. Section 5 shows the software and hardware design of the project. The performance evaluation is described in Section 6. Finally, the conclusion of the paper is presented.


## 2. Related Works

Research institutes have developed many algorithms for vehicle detection in parking spaces have been developed by research institutes. There are various mainstream inspection methods, such as inductive coils [7], acoustic waves [8], infrared, video detection, and geomagnetic sensors.In 2015, Wang et al. [9] proposed a magnetic sensor-based vehicle detection method for urban environments, where magnetic sensors are deployed on one side of the road, filtered by a wavelet method to remove noise. The signal is sent wireless communication. The authors designed two algorithms to detect vehicles and performed experimental tests to obtain 90.9% and 84.1% accuracy. Djenouri et al. [10] from CERIST research center in Algiers, Algeria, designed vehicle monitoring with wireless sensor networks, where a new algorithm for vehicle detection with magnetic sensors is proposed. The algorithm is based on processing magnetic signals and analyzing the number of their oscillations. Bereik et al. [11] used a fluxgate sensor Mag556 to measure the effect of vehicles on the geomagnetic field and set two thresholds (high and low), the magnetic field value (below the low threshold to -1, the value above the high threshold to 1, and the intermediate value to 0) for simple vehicle detection judgment which achieved the excellent results. Dong et al. [12] proposed a novel vehicle detection algorithm based on short-term variance sequences converted from the original magnetic signal. A parking-sensitive module is introduced to enhance the robustness and adaptability of the detection method. Then, 42-D features are extracted from each vehicle signal by rich signal data, including statistical features of the whole waveform and short-term features of the fragmented signals. Sarcevic and Pletl [13] employed the Honeywell-made HMC5843 magnetic sensor to design an adaptive thresholding detection algorithm that works to reduce the error rate by eliminating the influence of neighboring vehicle positions and finally achieved an accuracy rate of 94.15%. In the literature [14], the authors proposed a multitemporal finite state machine (MiFSM) to deal with the thousand disturbances of moving vehicles, which solves the complex interference by the collaboration of adjacent sensors. The vehicle detection accuracy is 99.8%, and the vehicle departure detection accuracy is 99.9%. However, the shortcoming is that the system is sometimes out of control. The remote signal reset must be performed artificially whenever the out-of-control state occurs, which costs a huge maintenance fee in the parking network.The past few years have also seen many image processing-based approaches to detecting parking vacancies. Some systems mainly use established video surveillance techniques to manage parking lots. For example, Masaki [15] proposed a method to track and record the movement behavior of vehicles to identify vacant parking spaces. Some other systems attempt to do this through feature-based representations [16] or background model algorithms [17] to model the detection problem of the parking spots. The vacant parking spaces can be identified by extracting the ground view from the test image. Due to deployment difficulties, these methods are not specifically designed for idle parking detection. Perspective distortion and interobject occlusion often lead to detection errors. Also, the detection results may be disturbed by lighting changes and projected shadows, etc. In practical environments, to overcome the problem of uncontrollable view and height of video surveillance cameras, the work [18] proposed a multilayer discrimination framework (MLDF) for vacant parking space detection. Practical challenges in outdoor environments (illumination variations, shadow effects, perspective distortion, and interobject occlusion) are addressed to obtain a robust detection capability. In the proposed multilayer framework, camera calibration reduces perspective distortion; illumination variations are overcome by using the HOG function. The paper proposes a three-dimensional spatial inference method based on a multistage boosting structure to address interobject occlusion. Finally, the paper adopts an implicit strategy to overcome the shadow effect. With these designs, the MLDF proposed in the paper can effectively detect parking vacancies.In general, there are numerous studies on geomagnetic vehicle detection, and researchers and companies both at home and abroad are trying to find an efficient solution that can achieve the highest accuracy rate and want the whole system to have the advantages of low power consumption, long life, easy deployment, and easy maintenance. In order to meet the demand for smart parking systems, geomagnetic detection technology is indeed the most advantageous solution at present, considering all aspects.


## 3. System Description

Whether there are cars parked in the parking lots, it is necessary to timely know the occupied status of all parking lots for the application of parking guidance system, intelligent parking management system, automatic charging system, and shared parking space system. Therefore, it is the most basic and important part of intelligent parking to detect vehicles by using the Internet of Things and wireless sensor network, obtain the status of parking space occupation, and transmit it to users in real time.According to the real environment needs, the system is mainly applied to situations where there are many vehicles in our lives. It is impossible to find a vacant parking space quickly. To complete the design and implementation of an efficient, convenient, and reliable parking guidance system, the main structure of the system must be determined by the requirements of the application background. The system consists of three parts [1, 19]. One part is the geomagnetic sensor unit used to detect the parking status. The part is mainly responsible for designing and implementing the robust parking detection algorithm to develop the effective detection of the parking pace. The next is the network service terminal which is responsible for data transmission. The last one is to process the collection of data and realize the terminal of data display which is a good human-computer interaction interface to meet the user’s demand to view the current parking lots [20]. The system framework is shown in Figure 1. At first, the parking system collects parking lot information through the geomagnetic sensor detectors. The RNN algorithm is used to boost the accuracy of the sensor detection in the step. Then, the parking information is sent out through ZigBee wireless LAN, and the computer terminal obtains the data and extracts the parking lot information. In the end, the information is displayed on the user terminal. In the system, the geomagnetic sensor is buried underground in each parking lot to detect the status and obtain the information of each parking space.Figure 1
The system structure.


## 4. The Core Technologies of System Implementation

### 4.1. Principle of Geomagnetic Parking Space Detection

In parking space detection, only fluctuation and stability of magnetic field can be obtained from the perspective of detection nodes. The fluctuation state refers to the situation that the geomagnetic field fluctuates violently when it changes. However, whether the vehicle has correctly parked in the parking space is hidden from the perspective of the detection node, which needs to be determined by the algorithm. So, the ferromagnetic objects can be determined by measuring the changes in the strength of the magnetic field, which is disturbed by the vehicle’s entry into the field. Geomagnetic sensors are employed to detect vehicles and recognize them, which is to use the influence of the earth’s magnetic field when the vehicle passes the road to complete vehicle detection [21]. In the project, the signals collected by the geomagnetic sensor are magnetic field data of three axes: the X, Y, and Z, respectively. The variation process of magnetic field data of the three axes is similar, reflecting the parking process of the vehicles, which are entering the parking lot. When the vehicles drive and exit the parking lot, the magnetic field signal has an obvious shake [22]. The magnetic field signal is relatively stable when the vehicles are stabilized above the geomagnetic sensor in the parking lot. Z-axis data change relatively significantly because the geomagnetic sensors are located below the vehicles, and the magnetic field intensity obtained in the parallel or vertical direction of the Z-axis is the largest. There are three states of vehicles in the parking lot, entering, stopping, and driving out of the parking space. The geomagnetic sensors are combined with the detection algorithms to determine the status of the parking. In the actual parking space detection, there are some problems with equipment and algorithms. First, they are caused by the equipment, which is attributed to the bad channel and the node motion, etc. Their relevant influences can be reasonably avoided by designing the hardware and fixing the position of the detectors. Second, there is the deficiency issue of detection algorithms, which are mainly reflected in the misjudgment of the parking status after long parking.


### 4.2. BP Neural Network

The BP (back-propagation) neural network was proposed in 1986 by a group of researchers led by Robert [23]. The neuron is a topological structure network established by biological research and the response mechanism of our brain, which simulates the process of nerve conflict. The ends of multiple dendrites receive external signals and transmit them to neurons for processing and fusion. Finally, the nerves are transmitted to other neurons or effectors through axons. The structure diagram of the neural network is given in Figure 2. Its basic structure consists of two parts, the forward propagation of the signal and the back-propagation of the error. In forward propagation, the input samples are transmitted from the input layer to the output layer after processing layer by layer through each hidden layer. If the actual value of the output layer is not consistent with the expected, the error is transferred to the back-propagation stage. In the back-propagation, the output is transmitted layer by layer through the hidden layer to the input layer, and the deviation is distributed to all units of each layer, which obtains the false signal of each unit. The false signal is utilized as the foundation for correcting the weight of each unit.Figure 2
The BP neural network structure.The BP network is composed of the input layer, hidden layer, and output layer. Training setz=x1,y1,x2,y2,⋯,xn,yn, xn∈Rd, yn∈Rd. It indicates that the input example consists of d attributes, output l-dimensional real value, and the core variable w of the system model.
(1)y=f∑i=1nwi∗xi.The error of the prediction result is shown by the least square method.(2)E=12∑i=1nYi−yi2.Thef function is considered as the activation function to enable the neurons. Tanh, ReLu, and Sigmoid are the common activation function. BP neural network can learn autonomously to achieve the output closest to the target value. Adjusting parameter size takes too much time and may lead to training failure.


### 4.3. Recurrent Neural Network

Recurrent neural network (RNN) is a special BP network. The RNN approaches have got increased attention in prediction tasks with various structures because of their excellent performance for dynamic system modeling.To conquer the memory conflict, Wang et al. [24] concentrated the memory methods and fused the RNN model with an assistant memory unit. Gelly and Gauvain [25] studied three types of RNN models and optimized the model parameters for neural network-based speech task detection. To improve the performance of the age estimation system, Zazo et al. [26] used long and short term memory as a special recursive neural network model and proved that the system can be deployed in online applications through experiments. Prokhorov et al. [27] discussed the action is a general consequence of previous training with fixed-weight RNN. Fang et al. [28] surveyed on research of RNN-based spatiotemporal sequence prediction algorithms, which give readers some suggestions to solve the problems.RNN is cyclic because it performs the same operation on each element in the series. Each operation depends on the result of the previous calculation. Another way to think about it is that the RNN remembers the information that has been calculated so far. Figure3 shows the structure of RNN expanded into a full network.Figure 3
The RNN structure.In the figure above, (a) is the diagram of the RNN model without time expansion, and (b) is the diagram of the RNN model with time series expansion.xt represents the input of the training sample at the sequence index t.ht is the hidden state of the model at the sequence index number t. htis jointly determined by xtand ht−1.
(3)ht=σzt=σUxt+Wht−1+b.σ is activity function and nonlinear. Parameter b is biased.
(4)ot=Vht+c.Prediction output is as follows:(5)y∧t=σot.ot is the output of the model at the sequence index number t and is determined only by the current hidden state ht of the model.yt is the real output of the training sample sequence at the sequence index t.U, W, and V are linear relation parameters of our model, which are shared in the whole RNN model.Lt is loss function, and compute the distance between y∧t and yt.With the above model, the forward propagation algorithm of RNN can be easily obtained. For any sequence indext, hidden state ht is from xt and ht−1:The RNN back-propagation algorithm is to obtain appropriate model parametersU, W, V, b, and C through round iteration of the gradient descent methods. The loss function is cross-entropy or others, and the output activation function is Softmax. The hidden layer activation function is ReLu or others. In RNN, each position has a loss function, so the final loss L is as follows:
(6)L=∑t=1TLt.The gradient ofV,c is as follows:
(7)∂L∂c=∑t=1T∂Lt∂c=∑t=1Ty∧t−yt,(8)∂L∂c=∑t=1T∂Lt∂V=∑t=1Ty∧t−ythtT.It can be seen that in RNN back-propagation, the gradient loss at a sequence positiont is determined by both the gradient loss corresponding to the output at the current position and the gradient loss at the sequence index position t+1. The gradient of hidden state of t position is as follows:
(9)δt=∂L∂ht=∂Ot∂htT∂L∂Ot+∂ht+1∂htT∂L∂ht+1.SoW,U,b gradient is as follows:
(10)δt=VTy∧t−yt+WTdiag1−ht+12δt+1,(11)∂L∂W=∑t=1Tdiag1−ht2δtht−1T,(12)∂L∂b=∑t=1Tdiag1−ht2δt,(13)∂L∂U=∑t=1Tdiag1−ht2δtxtT.A geomagnetic guidance parking system requires high detection accuracy, but the failure of geomagnetic detection usually appears in the actual detection. So, the RNN algorithm is added to the system to improve detection accuracy. Compared with other artificial neural networks, the RNN has robust nonlinear mapping, high self-learning, and self-adaptive power. Its structure is also simple and easy to implement. The way can not only accurately detect whether there is a parking space but also reasonably use the existing method to avoid the use of the high cost of high-precision sensors. A geomagnetic sensor measures the geomagnetic field values in the form of a 3-dimensional field vector, which is used as an input to the basic RNN model. We note the input vector at time t as (x1t,x2t,x3t) while the output of hidden node as ht and the final output as a 2-dimensional vector y=o1t,o2t in space.We use the base structure of the RNN model with three inputs and one output, as shown in Figure4. In our evaluation, we revised the number of hidden nodes from 50 to 300 to get an optimized RNN model. We can train the recurrent neural networks to memorize the changing rules of geomagnetic value sequence, rather than a single geomagnetic value, to distinguish the positions with the same magnetic value into different positions. There are several points worth noting here. ht captures information generated at all previous moments. Input ot depends only at t time. Unlike traditional deep neural networks where each layer uses different parameters, RNN shares the same parameters at all times. This reflects that the same task is being performed at each step, but with different inputs. This greatly reduces the number of parameters to learn in the model.Figure 4
The basic framework of the RNN in our system.


### 4.4. ZigBee Technology

ZigBee [29] is a low-power IoT standard based on IEEE 802.15.4, which supports star, tree, and mesh networks. ZigBee’s energy consumption is significantly lower than other wireless communication technologies. In addition, ZigBee has high security and reliability. Its development and use costs are low. It has three device types introduced as follows.ZigBee coordinator. It is the most powerful device, the root of the network tree, and can connect to other networks.ZigBee router. It is apart from running application functions, acts as an intermediate router, and passes data from other devices.ZigBee terminal device. It contains only sufficient functionality to communicate with the parent nodes. It cannot inherit data from other devices.In the protocol layer [30], the physical layer consists of the wireless signal frequency band, power setting, data transmission, and reception. The data link layers are divided into the logical link control layers and media access control layers. The logical link layers mainly provide packet segmentation, recombination, transmission, and guarantee services for the reliability of data transmission. The media access control layers are mainly responsible for the establishment, maintenance channel control, frame calibration, and other management [31]. The network layers contain joining and leaving the network nodes, building the path, establishing the network topology, and setting the security secret keys. The application layers provide users with various practical application services. The ZigBee protocol layer is shown in Figure 5.Figure 5
The ZigBee protocol layer.


## 4.1. Principle of Geomagnetic Parking Space Detection

In parking space detection, only fluctuation and stability of magnetic field can be obtained from the perspective of detection nodes. The fluctuation state refers to the situation that the geomagnetic field fluctuates violently when it changes. However, whether the vehicle has correctly parked in the parking space is hidden from the perspective of the detection node, which needs to be determined by the algorithm. So, the ferromagnetic objects can be determined by measuring the changes in the strength of the magnetic field, which is disturbed by the vehicle’s entry into the field. Geomagnetic sensors are employed to detect vehicles and recognize them, which is to use the influence of the earth’s magnetic field when the vehicle passes the road to complete vehicle detection [21]. In the project, the signals collected by the geomagnetic sensor are magnetic field data of three axes: the X, Y, and Z, respectively. The variation process of magnetic field data of the three axes is similar, reflecting the parking process of the vehicles, which are entering the parking lot. When the vehicles drive and exit the parking lot, the magnetic field signal has an obvious shake [22]. The magnetic field signal is relatively stable when the vehicles are stabilized above the geomagnetic sensor in the parking lot. Z-axis data change relatively significantly because the geomagnetic sensors are located below the vehicles, and the magnetic field intensity obtained in the parallel or vertical direction of the Z-axis is the largest. There are three states of vehicles in the parking lot, entering, stopping, and driving out of the parking space. The geomagnetic sensors are combined with the detection algorithms to determine the status of the parking. In the actual parking space detection, there are some problems with equipment and algorithms. First, they are caused by the equipment, which is attributed to the bad channel and the node motion, etc. Their relevant influences can be reasonably avoided by designing the hardware and fixing the position of the detectors. Second, there is the deficiency issue of detection algorithms, which are mainly reflected in the misjudgment of the parking status after long parking.


## 4.2. BP Neural Network

The BP (back-propagation) neural network was proposed in 1986 by a group of researchers led by Robert [23]. The neuron is a topological structure network established by biological research and the response mechanism of our brain, which simulates the process of nerve conflict. The ends of multiple dendrites receive external signals and transmit them to neurons for processing and fusion. Finally, the nerves are transmitted to other neurons or effectors through axons. The structure diagram of the neural network is given in Figure 2. Its basic structure consists of two parts, the forward propagation of the signal and the back-propagation of the error. In forward propagation, the input samples are transmitted from the input layer to the output layer after processing layer by layer through each hidden layer. If the actual value of the output layer is not consistent with the expected, the error is transferred to the back-propagation stage. In the back-propagation, the output is transmitted layer by layer through the hidden layer to the input layer, and the deviation is distributed to all units of each layer, which obtains the false signal of each unit. The false signal is utilized as the foundation for correcting the weight of each unit.Figure 2
The BP neural network structure.The BP network is composed of the input layer, hidden layer, and output layer. Training setz=x1,y1,x2,y2,⋯,xn,yn, xn∈Rd, yn∈Rd. It indicates that the input example consists of d attributes, output l-dimensional real value, and the core variable w of the system model.
(1)y=f∑i=1nwi∗xi.The error of the prediction result is shown by the least square method.(2)E=12∑i=1nYi−yi2.Thef function is considered as the activation function to enable the neurons. Tanh, ReLu, and Sigmoid are the common activation function. BP neural network can learn autonomously to achieve the output closest to the target value. Adjusting parameter size takes too much time and may lead to training failure.


## 4.3. Recurrent Neural Network

Recurrent neural network (RNN) is a special BP network. The RNN approaches have got increased attention in prediction tasks with various structures because of their excellent performance for dynamic system modeling.To conquer the memory conflict, Wang et al. [24] concentrated the memory methods and fused the RNN model with an assistant memory unit. Gelly and Gauvain [25] studied three types of RNN models and optimized the model parameters for neural network-based speech task detection. To improve the performance of the age estimation system, Zazo et al. [26] used long and short term memory as a special recursive neural network model and proved that the system can be deployed in online applications through experiments. Prokhorov et al. [27] discussed the action is a general consequence of previous training with fixed-weight RNN. Fang et al. [28] surveyed on research of RNN-based spatiotemporal sequence prediction algorithms, which give readers some suggestions to solve the problems.RNN is cyclic because it performs the same operation on each element in the series. Each operation depends on the result of the previous calculation. Another way to think about it is that the RNN remembers the information that has been calculated so far. Figure3 shows the structure of RNN expanded into a full network.Figure 3
The RNN structure.In the figure above, (a) is the diagram of the RNN model without time expansion, and (b) is the diagram of the RNN model with time series expansion.xt represents the input of the training sample at the sequence index t.ht is the hidden state of the model at the sequence index number t. htis jointly determined by xtand ht−1.
(3)ht=σzt=σUxt+Wht−1+b.σ is activity function and nonlinear. Parameter b is biased.
(4)ot=Vht+c.Prediction output is as follows:(5)y∧t=σot.ot is the output of the model at the sequence index number t and is determined only by the current hidden state ht of the model.yt is the real output of the training sample sequence at the sequence index t.U, W, and V are linear relation parameters of our model, which are shared in the whole RNN model.Lt is loss function, and compute the distance between y∧t and yt.With the above model, the forward propagation algorithm of RNN can be easily obtained. For any sequence indext, hidden state ht is from xt and ht−1:The RNN back-propagation algorithm is to obtain appropriate model parametersU, W, V, b, and C through round iteration of the gradient descent methods. The loss function is cross-entropy or others, and the output activation function is Softmax. The hidden layer activation function is ReLu or others. In RNN, each position has a loss function, so the final loss L is as follows:
(6)L=∑t=1TLt.The gradient ofV,c is as follows:
(7)∂L∂c=∑t=1T∂Lt∂c=∑t=1Ty∧t−yt,(8)∂L∂c=∑t=1T∂Lt∂V=∑t=1Ty∧t−ythtT.It can be seen that in RNN back-propagation, the gradient loss at a sequence positiont is determined by both the gradient loss corresponding to the output at the current position and the gradient loss at the sequence index position t+1. The gradient of hidden state of t position is as follows:
(9)δt=∂L∂ht=∂Ot∂htT∂L∂Ot+∂ht+1∂htT∂L∂ht+1.SoW,U,b gradient is as follows:
(10)δt=VTy∧t−yt+WTdiag1−ht+12δt+1,(11)∂L∂W=∑t=1Tdiag1−ht2δtht−1T,(12)∂L∂b=∑t=1Tdiag1−ht2δt,(13)∂L∂U=∑t=1Tdiag1−ht2δtxtT.A geomagnetic guidance parking system requires high detection accuracy, but the failure of geomagnetic detection usually appears in the actual detection. So, the RNN algorithm is added to the system to improve detection accuracy. Compared with other artificial neural networks, the RNN has robust nonlinear mapping, high self-learning, and self-adaptive power. Its structure is also simple and easy to implement. The way can not only accurately detect whether there is a parking space but also reasonably use the existing method to avoid the use of the high cost of high-precision sensors. A geomagnetic sensor measures the geomagnetic field values in the form of a 3-dimensional field vector, which is used as an input to the basic RNN model. We note the input vector at time t as (x1t,x2t,x3t) while the output of hidden node as ht and the final output as a 2-dimensional vector y=o1t,o2t in space.We use the base structure of the RNN model with three inputs and one output, as shown in Figure4. In our evaluation, we revised the number of hidden nodes from 50 to 300 to get an optimized RNN model. We can train the recurrent neural networks to memorize the changing rules of geomagnetic value sequence, rather than a single geomagnetic value, to distinguish the positions with the same magnetic value into different positions. There are several points worth noting here. ht captures information generated at all previous moments. Input ot depends only at t time. Unlike traditional deep neural networks where each layer uses different parameters, RNN shares the same parameters at all times. This reflects that the same task is being performed at each step, but with different inputs. This greatly reduces the number of parameters to learn in the model.Figure 4
The basic framework of the RNN in our system.


## 4.4. ZigBee Technology

ZigBee [29] is a low-power IoT standard based on IEEE 802.15.4, which supports star, tree, and mesh networks. ZigBee’s energy consumption is significantly lower than other wireless communication technologies. In addition, ZigBee has high security and reliability. Its development and use costs are low. It has three device types introduced as follows.ZigBee coordinator. It is the most powerful device, the root of the network tree, and can connect to other networks.ZigBee router. It is apart from running application functions, acts as an intermediate router, and passes data from other devices.ZigBee terminal device. It contains only sufficient functionality to communicate with the parent nodes. It cannot inherit data from other devices.In the protocol layer [30], the physical layer consists of the wireless signal frequency band, power setting, data transmission, and reception. The data link layers are divided into the logical link control layers and media access control layers. The logical link layers mainly provide packet segmentation, recombination, transmission, and guarantee services for the reliability of data transmission. The media access control layers are mainly responsible for the establishment, maintenance channel control, frame calibration, and other management [31]. The network layers contain joining and leaving the network nodes, building the path, establishing the network topology, and setting the security secret keys. The application layers provide users with various practical application services. The ZigBee protocol layer is shown in Figure 5.Figure 5
The ZigBee protocol layer.


## 5. System Software and Hardware Design

### 5.1. System Software Design

The main software functions include the information collection and processing, building the wireless network information transmission layer based on ZigBee, and the user application functions. The application layer is an important part of the customer experience. Users can query the total number and the number of available parking lots in the application layer. Users can also know the parking lot location information displayed on the map, which assists the owner to search the parking space. When the vehicle enters or leaves the parking lot, the client immediately displays hint information including the current time, parking duration, parking number, and the vehicle dynamics through scrolling text. This function is mainly aimed at administrators to facilitate parking lot management. User-oriented functions also include booking, display of parking time, payment, and query of historical parking information. User functions are shown in Figure6.Figure 6
User functions.


### 5.2. System Hardware Design

The design of hardware devices in the project is mainly composed of detectors, routers, and coordinators. The hardware design framework of the system is shown in Figure7. The detector’s functions are the signal acquisition, sending, and receiving of parking lot information. The hardware framework mainly includes the power supply module, the geomagnetic detection module, and the radio frequency module. The routers are responsible for data forwarding which mainly contains the power supply module and the radio frequency module. The coordinators preside over the management of the whole network. The hardware system MCU uses TI’s CC2530 chip which features relatively strong network nodes with very low total material cost and supports the latest ZigBee communication protocol. The chips are integrated with 51 single-chip microcomputers, wireless communication modules, and ADC modules, which not only improve the reliability of the combination of single-chip microcomputers and wireless communication modules but also greatly reduce the peripheral circuit and chip volume.Figure 7
Hardware design framework of the system.To enhance the expansion and portability of the device, the hardware design of the project is mainly divided into the core board and the bottom board. The core board is the radio frequency modules, which are mainly designed around the MOJ radio frequency circuit. It is considered that the detectors use wireless power supply mode, and the radio frequency modules are adopted without PA with low power consumption. As routers and coordinators need to send and receive data in real-time over a long distance, the PA radio frequency modules are adopted. This paper adopts the module which adopts Honeywell’s HMC5883L. The module is a highly incorporated module with a surface mount and the weak Horo sensor chip with a digital interface, which is applied in the field of the low-cost compass and magnetic field induction detection. The line direction of the HMC5883L module is controlled by IIC digital interface [32, 33]. The SCL and SDA pins in IIC are, respectively, connected with interfaces P13SCL and P12SDA.


## 5.1. System Software Design

The main software functions include the information collection and processing, building the wireless network information transmission layer based on ZigBee, and the user application functions. The application layer is an important part of the customer experience. Users can query the total number and the number of available parking lots in the application layer. Users can also know the parking lot location information displayed on the map, which assists the owner to search the parking space. When the vehicle enters or leaves the parking lot, the client immediately displays hint information including the current time, parking duration, parking number, and the vehicle dynamics through scrolling text. This function is mainly aimed at administrators to facilitate parking lot management. User-oriented functions also include booking, display of parking time, payment, and query of historical parking information. User functions are shown in Figure6.Figure 6
User functions.


## 5.2. System Hardware Design

The design of hardware devices in the project is mainly composed of detectors, routers, and coordinators. The hardware design framework of the system is shown in Figure7. The detector’s functions are the signal acquisition, sending, and receiving of parking lot information. The hardware framework mainly includes the power supply module, the geomagnetic detection module, and the radio frequency module. The routers are responsible for data forwarding which mainly contains the power supply module and the radio frequency module. The coordinators preside over the management of the whole network. The hardware system MCU uses TI’s CC2530 chip which features relatively strong network nodes with very low total material cost and supports the latest ZigBee communication protocol. The chips are integrated with 51 single-chip microcomputers, wireless communication modules, and ADC modules, which not only improve the reliability of the combination of single-chip microcomputers and wireless communication modules but also greatly reduce the peripheral circuit and chip volume.Figure 7
Hardware design framework of the system.To enhance the expansion and portability of the device, the hardware design of the project is mainly divided into the core board and the bottom board. The core board is the radio frequency modules, which are mainly designed around the MOJ radio frequency circuit. It is considered that the detectors use wireless power supply mode, and the radio frequency modules are adopted without PA with low power consumption. As routers and coordinators need to send and receive data in real-time over a long distance, the PA radio frequency modules are adopted. This paper adopts the module which adopts Honeywell’s HMC5883L. The module is a highly incorporated module with a surface mount and the weak Horo sensor chip with a digital interface, which is applied in the field of the low-cost compass and magnetic field induction detection. The line direction of the HMC5883L module is controlled by IIC digital interface [32, 33]. The SCL and SDA pins in IIC are, respectively, connected with interfaces P13SCL and P12SDA.


## 6. The Performance Evaluation

### 6.1. Data Preparation

The RNN model optimizes the signals detected by geomagnetic sensors and compressed by upload. In order to train the RNN model, a large amount of data needs to be collected and labeled. In this work, 52 parking spaces were used and 2000 data were collected from the real scene. Each sample was manually labeled: parking space has been parked (label A), the car has left (label B), and other (label C). The number of A, B, and C is 1210, 556, and 234, respectively.To avoid model overfitting, data augmentation techniques are used. The original sample is expanded to 10000 samples. After data augmentation, the RNN can be made insensitive to the translation of the signal. A sample is labeled unchanged after data augmentation, making the network-aware that this translation does not change the nature of the event.


### 6.2. Deployment of Geomagnetic Parking Module

A geomagnetic sensor terminal is installed under the pavement in the middle of each parking space in Figure8. The dots show where the geomagnetic sensor is installed. The geomagnetic sensor terminal can detect the magnetic field strength signal near this parking space and process the signal. This paper first designs a signal processing algorithm in the geomagnetic terminal to process the magnetic field strength signal detected by the geomagnetic sensor and upload it to the server. The uploaded data is then identified and classified using the RNN model.Figure 8
Deployment diagram of the geomagnetic module.


### 6.3. The Results of RNN Model Training

In the process of network training, the number of nodes, the size of the batch, the number of iterations, the learning rate, etc., all affect the experiment results. We transform these parameters to get the optimal model. We used python 3.6 and SGD (Stochastic Gradient Descent) as the optimizer and cross-entropy as the loss function. The learning rate was set for 0.001. The momentum was 0.9. The batch size was 32. The hidden nodes of the model varied from 50 to 300. The test results of RNN model with different hidden nodes are shown in Figure9. At last, the RNN model included 150 hidden nodes which were designed to identify and classify the parking space geomagnetic signals.Figure 9
Error rates for different models.In this paper, k-fold cross-validation is used to partition the data set. By settingk=6, the data are randomly divided into 6 equal parts: 5 parts are the training sets and 1 part is the validation set. In this way, the training sets of each cross-validation can be trained with 6 models. k-fold cross-validation can avoid model overfitting. Table 1 gives the results of the k-fold cross-validations between RNN, the adaptive threshold method, and SVM. From the results of this experiment, it can be seen that the classification of geomagnetic signals in the RNN model has an accuracy of 96% which is higher than the traditional method. Unlike conventional geomagnetic detection algorithms, RNN does not rely on any statistics to obtain the base value of the magnetic field, nor does it set a fixed threshold, but purely uses the signal waveform of the wave dynamics corresponding to each event, because the waveform within the wave dynamics is not related to the base value. So, the proposed algorithm is not also affected by the base value drift. This result fully demonstrates that the variation of the magnetic field intensity waveform contains information that can determine the parking behavior. Figures 10 and 11 show the performance of model training and validation, iteration vs. loss, and iteration vs. accuracy (nodes=150). As the number of iterations increases, the loss gradually decreases and accuracy increases, and the model begins to converge.Table 1
The result comparison of k-fold cross-validation between RNN and other methods (nodes=160, k=6).
k-fold123456Average accuracyOur method (RNN)0.9430.9560.9580.9670.9860.9870.966Adaptive threshold0.8410.8530.8740.8760.8810.8920.870SVM0.8620.8710.8610.8560.8860.8740.868Figure 10
Model training and validation iterations vs. loss (nodes=150, k=6).Figure 11
Model training and validation iterations vs. accuracy (nodes=150, k=6).In addition, we selected 10 geomagnetic sensors arranged in the parking space. The detection algorithm was loaded into the geomagnetic sensor node. A single node is set up in the middle of the area to collect real-time data for testing. A total of 93 vehicles were tested in the morning. In our sample, label 1 notes two-compartment vehicles. Label 2 is saloon car. Labels 3 and 4 are SUV and bus, respectively. From the below Table2, it can be seen that there are some instances of missed and false detection. The missed detection is mainly because the detected vehicle does not pass over the sensor node, resulting in a slight change in the collected signal amplitude. At the same time, the vehicle speed also impacts the detection results. Table 2 also shows that bus detection has a high false detection rate. The bus in the sensor node stops too long, so a vehicle is detected as two.Table 2
Vehicle test results in real environment.
VehicleQuantityRecognition resultsAccuracyTwo compartment31290.944Saloon car29280.966SUV21200.952Bus12110.917In the parking space detection application of the algorithm, the variation amplitude of the geomagnetic signal is large between when the vehicle enters and leaves the parking space. The state of the parking space is judged depending on the geomagnetic signal when there is a car or not in the parking space. So the filtering is applied only in the two states of no vehicle and after the vehicle is parked. Figures12 and 13 show the change in data.Figure 12
Raw data of vehicles entering and exiting parking spaces with detection nodes.Figure 13
Filtered data of vehicles entering and exiting parking spaces with detection nodes.


### 6.4. The Evaluation of System Performance

In performance tests of our system, the types of parking spaces include parallel, perpendicular, and diagonal ways. Therefore the system faces complex environmental conditions and parking styles and realistic scenario testing with various models having different materials and structures that have different effects on geomagnetism. Over four months, we tested the system, from late spring until late summer, in temperatures between 20 and 40 degrees centigrade, covering the hot sun, rain, and foggy days. Different owners parked their vehicles in and out at different speeds and in different habits. Table3 shows the test results of our system in the natural environment on the whole space. The system’s accuracy achieves 95.6%, which satisfies the detection of most parking statuses and verifies the system’s reliability. However, there are still cases of missed detection or wrong judgment. For example, when a bicycle or motorcycle is parked, the algorithm does not consider this factor, which may lead to wrong detection. In addition, the detector is touched or damaged is also a cause of loss of detection rate.Table 3
The test results on the whole space.
Total number of parkingNumber of correct detectionNumber of error detectionNumber of missing detectionA52150994B41440068Accuracy97%2%2%The real-time data transmission is related to the quality of network communication. The network communication functions in the system include ZigBee wireless networking, coordinator and server network communication, and server networking. Since the coordinator and server communication, server and computer terminal communication use a fixed public network, which belongs to the normal communication state? The main test is on the real-time ZigBee wireless networking in the system. Signal transmission equation is as follows:(14)LdB=P0+10nlgdd0+Xσ.P0 is the signal strength value, and n notes the path loss index. Xσ is the Gaussian distribution with mean 2, and d is between transmitter node and receiver node. SmartRFStudio was used to count the received signal strength. The method of signal strength detection between detection nodes and gateway nodes is to transmit packets to each other. RSSI is within the normal range of [-93, -113]. From Table 4, we can see that packet loss occurs when the distance is greater than 600 meters. There are many reasons, such as weather and deployment structure. The usual solution is to add routing nodes between each node to ensure communication stability. The above experiments prove the usability of the system.Table 4
The test results of receiving signal strength.
Distance (m)Packet loss rate (%)RSSI (dBm)<6000Normal7001.69%Normal9007.32%Normal


## 6.1. Data Preparation

The RNN model optimizes the signals detected by geomagnetic sensors and compressed by upload. In order to train the RNN model, a large amount of data needs to be collected and labeled. In this work, 52 parking spaces were used and 2000 data were collected from the real scene. Each sample was manually labeled: parking space has been parked (label A), the car has left (label B), and other (label C). The number of A, B, and C is 1210, 556, and 234, respectively.To avoid model overfitting, data augmentation techniques are used. The original sample is expanded to 10000 samples. After data augmentation, the RNN can be made insensitive to the translation of the signal. A sample is labeled unchanged after data augmentation, making the network-aware that this translation does not change the nature of the event.


## 6.2. Deployment of Geomagnetic Parking Module

A geomagnetic sensor terminal is installed under the pavement in the middle of each parking space in Figure8. The dots show where the geomagnetic sensor is installed. The geomagnetic sensor terminal can detect the magnetic field strength signal near this parking space and process the signal. This paper first designs a signal processing algorithm in the geomagnetic terminal to process the magnetic field strength signal detected by the geomagnetic sensor and upload it to the server. The uploaded data is then identified and classified using the RNN model.Figure 8
Deployment diagram of the geomagnetic module.


## 6.3. The Results of RNN Model Training

In the process of network training, the number of nodes, the size of the batch, the number of iterations, the learning rate, etc., all affect the experiment results. We transform these parameters to get the optimal model. We used python 3.6 and SGD (Stochastic Gradient Descent) as the optimizer and cross-entropy as the loss function. The learning rate was set for 0.001. The momentum was 0.9. The batch size was 32. The hidden nodes of the model varied from 50 to 300. The test results of RNN model with different hidden nodes are shown in Figure9. At last, the RNN model included 150 hidden nodes which were designed to identify and classify the parking space geomagnetic signals.Figure 9
Error rates for different models.In this paper, k-fold cross-validation is used to partition the data set. By settingk=6, the data are randomly divided into 6 equal parts: 5 parts are the training sets and 1 part is the validation set. In this way, the training sets of each cross-validation can be trained with 6 models. k-fold cross-validation can avoid model overfitting. Table 1 gives the results of the k-fold cross-validations between RNN, the adaptive threshold method, and SVM. From the results of this experiment, it can be seen that the classification of geomagnetic signals in the RNN model has an accuracy of 96% which is higher than the traditional method. Unlike conventional geomagnetic detection algorithms, RNN does not rely on any statistics to obtain the base value of the magnetic field, nor does it set a fixed threshold, but purely uses the signal waveform of the wave dynamics corresponding to each event, because the waveform within the wave dynamics is not related to the base value. So, the proposed algorithm is not also affected by the base value drift. This result fully demonstrates that the variation of the magnetic field intensity waveform contains information that can determine the parking behavior. Figures 10 and 11 show the performance of model training and validation, iteration vs. loss, and iteration vs. accuracy (nodes=150). As the number of iterations increases, the loss gradually decreases and accuracy increases, and the model begins to converge.Table 1
The result comparison of k-fold cross-validation between RNN and other methods (nodes=160, k=6).
k-fold123456Average accuracyOur method (RNN)0.9430.9560.9580.9670.9860.9870.966Adaptive threshold0.8410.8530.8740.8760.8810.8920.870SVM0.8620.8710.8610.8560.8860.8740.868Figure 10
Model training and validation iterations vs. loss (nodes=150, k=6).Figure 11
Model training and validation iterations vs. accuracy (nodes=150, k=6).In addition, we selected 10 geomagnetic sensors arranged in the parking space. The detection algorithm was loaded into the geomagnetic sensor node. A single node is set up in the middle of the area to collect real-time data for testing. A total of 93 vehicles were tested in the morning. In our sample, label 1 notes two-compartment vehicles. Label 2 is saloon car. Labels 3 and 4 are SUV and bus, respectively. From the below Table2, it can be seen that there are some instances of missed and false detection. The missed detection is mainly because the detected vehicle does not pass over the sensor node, resulting in a slight change in the collected signal amplitude. At the same time, the vehicle speed also impacts the detection results. Table 2 also shows that bus detection has a high false detection rate. The bus in the sensor node stops too long, so a vehicle is detected as two.Table 2
Vehicle test results in real environment.
VehicleQuantityRecognition resultsAccuracyTwo compartment31290.944Saloon car29280.966SUV21200.952Bus12110.917In the parking space detection application of the algorithm, the variation amplitude of the geomagnetic signal is large between when the vehicle enters and leaves the parking space. The state of the parking space is judged depending on the geomagnetic signal when there is a car or not in the parking space. So the filtering is applied only in the two states of no vehicle and after the vehicle is parked. Figures12 and 13 show the change in data.Figure 12
Raw data of vehicles entering and exiting parking spaces with detection nodes.Figure 13
Filtered data of vehicles entering and exiting parking spaces with detection nodes.


## 6.4. The Evaluation of System Performance

In performance tests of our system, the types of parking spaces include parallel, perpendicular, and diagonal ways. Therefore the system faces complex environmental conditions and parking styles and realistic scenario testing with various models having different materials and structures that have different effects on geomagnetism. Over four months, we tested the system, from late spring until late summer, in temperatures between 20 and 40 degrees centigrade, covering the hot sun, rain, and foggy days. Different owners parked their vehicles in and out at different speeds and in different habits. Table3 shows the test results of our system in the natural environment on the whole space. The system’s accuracy achieves 95.6%, which satisfies the detection of most parking statuses and verifies the system’s reliability. However, there are still cases of missed detection or wrong judgment. For example, when a bicycle or motorcycle is parked, the algorithm does not consider this factor, which may lead to wrong detection. In addition, the detector is touched or damaged is also a cause of loss of detection rate.Table 3
The test results on the whole space.
Total number of parkingNumber of correct detectionNumber of error detectionNumber of missing detectionA52150994B41440068Accuracy97%2%2%The real-time data transmission is related to the quality of network communication. The network communication functions in the system include ZigBee wireless networking, coordinator and server network communication, and server networking. Since the coordinator and server communication, server and computer terminal communication use a fixed public network, which belongs to the normal communication state? The main test is on the real-time ZigBee wireless networking in the system. Signal transmission equation is as follows:(14)LdB=P0+10nlgdd0+Xσ.P0 is the signal strength value, and n notes the path loss index. Xσ is the Gaussian distribution with mean 2, and d is between transmitter node and receiver node. SmartRFStudio was used to count the received signal strength. The method of signal strength detection between detection nodes and gateway nodes is to transmit packets to each other. RSSI is within the normal range of [-93, -113]. From Table 4, we can see that packet loss occurs when the distance is greater than 600 meters. There are many reasons, such as weather and deployment structure. The usual solution is to add routing nodes between each node to ensure communication stability. The above experiments prove the usability of the system.Table 4
The test results of receiving signal strength.
Distance (m)Packet loss rate (%)RSSI (dBm)<6000Normal7001.69%Normal9007.32%Normal


## 7. Conclusion

With the booming economy, the increase of car ownership has brought many new challenges to transportation. Firstly, the paper analyzed the pros and cons of the existing geomagnetic parking system. Secondly, to solve the issues of parking difficulties and advance the robustness of the parking guidance system, RNN was used to improve the classification problem of geomagnetic signals. The experiment proved that the introduction of RNN achieved more accurate classification than the traditional method on the geomagnetic parking induction system. Finally, the new parking guidance system was designed, which was integrated with a variety of technologies, such as ZigBee and magnetic detection. The test results of the actual installation were presented that the system had high detection accuracy and reliability.The use of a single geomagnetic sensor of the vehicle detection algorithm is often difficult to obtain excellent results. The intricate vehicle behavior and the decision of the geomagnetic signal have diversity. So, we can consider the use of a variety of sensors to assist in the detection of joint detection. The choice of what kind of sensor and how to carry out joint detection is also a worthwhile point of continued research. At the same time, the traditional algorithm can also be combined with the introduction of magnetic field base values and set thresholds for auxiliary judgment. In addition, to satisfy real demand, we are going to expand the work to larger-size commercial environments in future tasks with more advanced artificial neural network models.



---

*Source: 7481064-2022-05-31.xml*