stat946w18/Predicting Floor-Level for 911 Calls with Neural Networks and Smartphone Sensor Data

From statwiki
Revision as of 17:59, 28 February 2018 by Wt6chen (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Introduction

During emergency 911 calls, knowing the exact position of the victim is crucial to a fast response. Problems arise when the caller is unable to give their position accurately. This can happen, for instance, when the caller is disoriented, held in hostage, or a child calling for the victim. GPS in our smartphones is useful in these situations. However, in a tall building, GPS fails to give an accurate floor level. Previous works have explored using Wi-Fi signal or beacons placed inside the buildings, but these methods are not self-contained and require prior infrastructure knowledge.

Fortunately, today’s smartphones are equipped with many more sensors including barometer and magnetometer. Deep learning can be applied to predict floor level based on these sensor readings. Firstly, an LSTM is trained to classify whether the caller is indoor or outdoor using GPS, RSSI, and magnetometer sensor readings. Next, an unsupervised clustering algorithm is used to predict the floor level depending on the barometric pressure difference. With these two parts working together, a self-contained floor level prediction system can achieve 100% accuracy, without any outside knowledge.

Data Description

The author developed an iOS app called Sensory and used it to collect data on an iPhone 6. The following sensor readings are recorded: indoors, created at, session id, floor, RSSI strength, GPS latitude, GPS longitude, GPS vertical accuracy, GPS horizontal accuracy, GPS course, GPS speed, barometric relative altitude, barometric pressure, environment context, environment mean building floors, environment activity, city name, country name, magnet x, magnet y, magnet z, magnet total.

The indoor-outdoor data has to be manually entered as soon as the user enters or exits a building. To gather the data for floor level prediction, the authors conducted 63 trials among five different buildings throughout New York City. The actual floor level was recorded manually for validation purposes only, since unsupervised learning is being used.

Methods

An LSTM network is used to solve the indoor-outdoor classification problem. Here is a diagram of the network architecture.

Figure 1: LSTM network architecture. A 3-layer LSTM. Inputs are sensor readings for d consecutive time-steps. Target is y = 1 if indoors and y = 0 if outdoors.

The LSTM contains three layers. Layers one and two have 50 neurons followed by a dropout layer set to 0.2. Layer 3 has two neurons fed directly into a one-neuron feedforward layer with a sigmoid activation function. The input is the sensor readings, and the output is the indoor-outdoor label. The objective function is the cross-entropy between the true label and the prediction.

\begin{equation} C(y_i, \hat{y}_i) = \frac{1}{n} \sum_{i=1}^{n} -(y_i log(\hat{y_i}) + (1 - y_i) log(1 - \hat{y_i})) \label{equation:binCE} \end{equation}

The main reason why the neural network is able to predict whether the user is indoor or outdoor is that walls of buildings interfere with the GPS signals. The LSTM is able to find the pattern in the GPS signal strength in combination with other sensor readings to give an accurate prediction. However, the change in GPS signal does not happen instantaneously as the user walks indoor. Thus, a window of 20 seconds is allowed, and the minimum barometric pressure reading within that window is recorded as the ground floor.

To determine the exact time the user makes an indoor-outdoor transition, two vector masks are convolved across the LSTM predictions.

\begin{equation} V_1 = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0] \end{equation}

\begin{equation} V_2 = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1] \end{equation}

The Jaccard distances is then calculated by the following equation:

\begin{equation} J_j = J(s_i, V_j) = \frac{|s_i \cap V_j|}{|s_i| + |V_j| - |s_i \cap V_j|} \label{equation:Jaccard} \end{equation}

If the Jaccard distance is greater than the threshold 0.4, it means the transition occurred in the vicinity of the range of the vector mask. These sets of transition windows are then merged if they are close together, and the center of the merged windows are marked as the transition points.

Here is the algorithm for finding indoor-outdoor transitions.

% -------------------------- % ALGORITHM TO FIND IO \begin{algorithm}[h] \caption{Find Indoor Outdoor transitions}\label{alg:IOAlgo} \begin{algorithmic}[1] \Procedure{FindIOIndexes}{T} \State $V_1 = [1, 1, 1, 1, 1, 0, 0, 0, 0, 0]$ \State $V_2 = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]$ \State $S = [ ]$\\

\Comment{Find Jacc $\geq 0.4$} \For{$i \in \{1, ..., |T| - |V_1|\}$} \State $s_i = \{t_i, ..., t_{i+|V_1|}\}$

   	\If{$J(s_i, V_1) >= 0.4$ or $J(s_i, V_2) >= 0.4$}
      	\State $S \gets i$
   	\EndIf

\EndFor \\

\Comment{Merge $s_i$ ranges} \State $merged = []$ \For{each $b_i \in S$}

   	\If{$b_{i}+2 <= b_{i-1}$}
      	\State $merged[i] \gets$ Merge($b_i, b_{i-1}$)
   	\EndIf

\EndFor \\

\State $transitions = []$ \For{each $m_i \in merged$} \State $transitions \gets Middle(m_i)$ \EndFor \\

\Return $transitions$

\EndProcedure \end{algorithmic} \end{algorithm} % -----------------------------------------------------------------