Deep HMResNet Model for Human Activity-Aware Robotic Systems

Abstract: Endowing the robotic systems with cognitive capabilities for recognizing daily activities of humans is an important challenge, which requires sophisticated and novel approaches. Most of the proposed approaches explore pattern recognition techniques which are generally based on hand-crafted features or learned features. In this paper, a novel Hierarchal Multichannel Deep Residual Network (HMResNet) model is proposed for robotic systems to recognize daily human activities in the ambient environments. The introduced model is comprised of multilevel fusion layers. The proposed Multichannel 1D Deep Residual Network model is, at the features level, combined with a Bottleneck MLP neural network to automatically extract robust features regardless of the hardware configuration and, at the decision level, is fully connected with an MLP neural network to recognize daily human activities. Empirical experiments on real-world datasets and an online demonstration are used for validating the proposed model. Results demonstrated that the proposed model outperforms the baseline models in daily human activity recognition.

\section{Introduction}

There is a growing consensus about the need of adding some cognitive capabilities to the connected things and robots that are produced today in order to provide the added value of assistive services for dependent people. These services aim to improve their quality of life and their physical and mental well-being and to guarantee their safety \cite{SEBBAK2013}. In the context of ambient assisted living (AAL), daily human activity recognition (DHAR) is one of the interesting cognitive capabilities that must be present in any robotic system. In this context, some studies based on a new generation of data-driven approaches, deep learning models, were proposed recently in the literature \cite{plotz2011feature,yang2015deep,ronao2016human}.

The development of robotic systems with the capability of daily human activity recognition requires sophisticated and novel approaches. To enable an efficient recognition of daily activities in a dynamic environment, an exhaustive activities sensing with fusion techniques are required. Building efficient cognitive models for robotic systems requires a suitable architecture allowing the integration of heterogeneous sensors, objects, and robots.

In this paper, A novel Hierarchal Multichannel Deep Residual Network (HMResNet) model is proposed for robotic systems to recognize daily human activities in the ambient environments. The introduced model is comprised of multilevel fusion layers combined with residual shortcut connections. The proposed Multichannel 1D Deep Residual Network model is, at the features level, combined with a Bottleneck MLP neural network to automatically extract features and, at the decision level, is fully connected with an MLP neural network to recognize daily human activities. The hierarchical architecture of the proposed model gives the advantage of extracting more complex features than the traditional plain deep learning models and facilitates the training of more sparse and deep networks than those used in the literature.

The paper is organized as follows: First, we review the related works concerning daily human activity recognition in the robotics field. Then, we describe the proposed Hierarchal Multichannel Deep Residual Network (HMResNet) model for human daily activities recognition. We evaluate the performances of the proposed approach with extensive experiments on real-world datasets besides a scenario of cognitive daily exercises coaching. This paper is concluded with a short review of the proposed model and a summary of the ongoing works.

\section{Related Work}
\label{relwork}
Within the objective of developing added value services to assist dependent people in their daily activities, as well as identifying these activities receives much focus in recent years \cite{kashiwabara2012teroos}. One of the most challenging tasks in human activity recognition is the extraction of remarkable features from the raw inertial data. Most of the existing works are based on handcrafted engineered features, which are known as shallow features. The most commonly used features for human activity recognition are hand-engineered features \cite{anguita2012human}, time domain features such as mean, median, variance, skewness, kurtosis and range \cite{attal2015physical} and frequency domain features such as temporal fast Fourier transform (tFFT) \cite{sharma2008high}, Discrete Fourier Transform (DFT) and Power Spectral Density (PSD) \cite{attal2015physical}. To identify different daily human activities, classification approaches, such as, Hidden Markov Models \cite{lee2011activity}, Artificial Neural Network \cite{mantyjarvi2001recognizing}, Support Vector Machine (SVM) \cite{he2009activity} and naive Bayes classifiers \cite{yang2010implementation} rely on the latter features.

As evidenced, The traditional machine learning approaches have made significant progress in the last decade. However, these methods are based on heuristic hand-engineered features. Besides, the more amount of input data, the more inability of those approaches to come up with such relevant and consistent features. Moreover, the majority of the latter approaches depend on learning from static data, while the recognition of human activities in real life is based on data streaming from heterogeneous sensors that require durable online and incremental learning.

In recent years, a fast development of deep learning models has been started to compensate the drawbacks of the traditional data-driven approaches.
One of the first attempts to recognize human basic activities with a deep learning model is proposed in \cite{plotz2011feature}. This study based on the creation of Restricted Boltzmann Machines (RBM) allows extracting features from accelerometer raw data. In \cite{duffner20143d}, a convolutional neural network (ConvNet) model is proposed for recognizing basic gestures from the accelerometer and gyroscope raw data. This ConvNet model outperformed the other state-of-the-art models in gesture recognition such as Dynamic Time Wrapping (DTW) and Hidden Markov Model (HMM). A hierarchical ConvNets model is proposed in \cite{yang2015deep} and benchmarked against many datasets of daily activities to show its performance compared to other states of the art baseline models. In \cite{ronao2016human}, ConvNet model is proposed to recognize Human Activities using smartphone sensors.

Compared to the traditional machine learning approaches, deep learning approaches depend on learned-features that can be extracted from the raw data automatically. These features are more relevant and complex than the hand-engineered features used with the traditional machine learning approaches. Besides, the nature of the deep learning models structure allows performing online and incremental learning. Despite the above-mentioned advantages, compared to computer vision and natural language processing tremendous development, there are only a few attempts \cite{zheng2016exploiting,yang2015deep,lee2017human} that tried to exploit the hierarchical deep learning models to classify 1D time series which is the cornerstone of HAR.

\section{HMResNet Deep Learning Model}
\label{HMResNet}
In this paper, to recognize human daily activities in a dynamic environment, a new deep learning architecture based on Hierarchical Multichannel deep Residual Network (HMResNet) is proposed.
Compared to the state of the art deep learning models \cite{zheng2016exploiting,ronao2016human,yang2015deep,lee2017human}, the proposed model is based on multilevel fusion layers, with residual shortcut connections, and working on the multichannel raw data. At the features level fusion, a Multichannel 1D Deep Residual Network combined with a Bottleneck MLP neural network is proposed, for each sensor channel, to automatically extract features from raw data. At the decision level fusion, a multi-sensor fusion layer based on deep 1D ResNet followed by a fully connected MLP neural network is exploited for recognizing daily human activities. Indeed, the hierarchical architecture of the proposed model gives the advantage of extracting more relevant and complex features than the traditional plain deep learning models and facilitates the training of more sparse and deep networks than those used previously in the literature.

\subsection{Raw Data Preprocessing}
This step consists of data filtering, segmentation, and missing values replacement processes. In this paper, the Inertial Measurement Unit (IMU) sensors are used to measure linear and angular motion based on accelerometer and gyroscope raw data. Noise filters are used for preprocessing the sensors raw data (gyroscope and accelerometer). The sliding window algorithm is applied to segment the separated input signals into fixed-size windows. Finally, the preprocessed data are transferred to the feature extraction/fusion layers as a vector of sliding windows which contains accelerometer and gyroscope preprocessed raw data components, as shown in Fig.\ref{DetailedModel}.

\subsection{Feature Level Fusion}
At the feature level fusion, the 1D deep ResNet is exploited to extract features automatically from the preprocessed raw data, followed by a Bottleneck MLP neural network to create sensor level features fusion layer as shown in Fig.\ref{DetailedModel}.

\subsubsection{Deep Residual Network (ResNet)}
Basically, the Deep Residual Network $(ResNet)$ developed by Microsoft research labs, is exploited in \cite{he2016deep} for image recognition. ResNet got the first place in the five main tracks of COCO and ImageNet competitions, which covering object recognition, image classification, and semantic segmentation. Hence, many studies started to evaluate ResNet performance in different fields such as speech recognition \cite{xiong2017microsoft}, and question answering systems \cite{de2017modulating}. However, to our knowledge, a single attempt was proposed in \cite{wang2017time} to use ResNet for time series classification.

\begin{figure*}[!ht]
\centering
\includegraphics[scale=0.43]{RESNET.pdf}
\caption{Daily Human Activity Recognition based-Hierarchal Multichannel Deep Residual Network Model for robotic systems Exploiting $N$ IMUs}
\label{DetailedModel}
\end{figure*}

\begin{figure}
\centering
\includegraphics[scale=0.36]{BasicBlock_Unit.png}
\caption{Multilayer Convolution Feature Extractor Unit (MCFEU)}
\label{BasicBlock_Unit}
\end{figure}

\begin{figure}
\centering
\includegraphics[scale=0.29]{Resnet_Network.png}
\caption{Deep Residual Network Based on Stacked MCFEU units}
\label{ResnetNetwork}
\end{figure}

In the proposed model, the basic block of ResNet is $1D$ convolutional layer with kernel $(W_n)$ of size $(s)$ followed by Batch Normalization $(BN)$ \cite{DBLP:journals/corr/IoffeS15} and Rectified Linear Unit $(ReLU)$ layers. To avoid the problem of the vanishing gradient, ReLU activation function is used. The Batch normalization (BN) is applied to speed up the model convergence and improve the model generalization. Inspired by ResNet152 deep model \cite{he2016deep}, A plain network based on $3$ basic blocks are developed with different 1D kernel sizes, without strides, with 32, 64, and 64 feature maps respectively to create Multilayer Convolution Feature Extractor Unit (MCFEU) as shown in Fig.\ref{BasicBlock_Unit}. Both The kernel sizes and the number of feature maps have been chosen based on the empirical experiments which were conducted on different datasets \cite{ronao2016human,attal2015physical}. MCFEU is exploited to extract multilevel features from time series preprocessed raw data. The complete deep ResNet model is developed by stacking multiple MCFEU units, besides adding residual shortcut connection between the MCFEU units as shown in Fig.\ref{ResnetNetwork}. The shortcut connections are exploited to ensure that every MCFEU unit is learning more meaningful features and to solve the problem of the vanishing gradient for deep networks \cite{he2016deep}. Before feeding the extracted features to the decision level fusion layer, a Global Average Pooling $(GAP)$ layer \cite{lin2013network} is used to minimize the model overfitting by reducing the total number of the learned parameters.

\subsubsection{MLP Neural Network for Sensor Level Fusion}
In this paper, for every single IMU sensor, a bottleneck MLP neural network is exploited as a fusion layer for the sensor's channels as shown in Fig.\ref{DetailedModel}. The bottleneck MLP neural network acts as a nonlinear dimension reduction module, which is used for extracting low-dimensional features from the integrated deep ResNet output features. Finally, the outputs of all bottleneck MLP neural networks are integrated into a single feature vector, which is fed to the decision level fusion layer, see Algorithm \ref{MLPSensorFusion}. In this work, the bottleneck MLP neural network is comprised of :
\begin{itemize}
  \item Two fully connected hidden layers where each layer consists of 1000 nodes.
  \begin{itemize}
  \item Each layer is denoted by $l_{i}$, where $i$ is the layer index.
  \item Each node is denoted by $n_{i}^{j}$, where $i$ is the layer index and $j$ is the node index inside a layer.
  \end{itemize}
  \item The Dropout algorithm \cite{srivastava2014dropout} is applied on 30\% of the nodes to prevent the network from overfitting the training features.
  \item To break the symmetry of the neurons performance,  The network weights are randomly initialized with small values close to zero based on normal distribution with $\mu = 0$ and $\sigma ^{2} = 0.05$ .

  \begin{itemize}
  \item Each weight is denoted by $w_{i,j}^{k}$, which refers to the weight from the node $n_{i}^{j}$ to the node $n_{i+1}^{k}$.
  \end{itemize}
  \item For every node, the Rectified Linear Unit (ReLU) is exploited as an activation function.
  \begin{itemize}
  \item Each node activation is denoted by $a_{i,j}$.
  \end{itemize}
\end{itemize}

\begin{algorithm}
\caption{Bottleneck MLP neural network Sensor Fusion Layer (BMLP)}
\label{MLPSensorFusion}
\hspace*{\algorithmicindent} \textbf{Input: X $\rightarrow$ List of feature vectors with length $n$} \\
\hspace*{\algorithmicindent} \textbf{Parameters to be learned: $w_{i,j}^{k}$, $b_j$} \\
\hspace*{\algorithmicindent} \textbf{Output: $\hat{F} = BMLP(X)$}
\begin{algorithmic}[1]
\STATE \textbf{Randomly initialize the network weights}
\STATE $\hat{X} \leftarrow \textbf{Flatten the input features vector}$
\FOR{ each $n_{1}^{j}$}
\STATE $a_{1,k} \leftarrow RelU(\sum_{j}^{ } w_{1,j}^{k}.\hat{X}[j] + b_j)$
\STATE $A_{1}$.append($a_{1,k}$)
\ENDFOR \\
\STATE $A_{1} \leftarrow$ Dropout($A_{1}$,0.3)
\FOR{ each $n_{2}^{j}$}
\STATE $a_{2,k} \leftarrow RelU(\sum_{j}^{ } w_{2,j}^{k}.A_{1}[j] + b_j)$
\STATE $A_{2}$.append($a_{1,k}$)
\ENDFOR \\
\STATE $A_{2} \leftarrow$ Dropout($A_{2}$,0.3)
\STATE $\hat{F} \leftarrow flatten(A_{2})$ \\
\textbf{Return $\hat{F}$}
\end{algorithmic}
\end{algorithm}

\subsection{Decision level fusion}
At decision level fusion, both the 1D deep ResNet and the Bottleneck MLP neural networks are exploited to recognize daily human activities as shown in Fig.\ref{DetailedModel}. The Bottleneck MLP neural network is comprised of three fully connected layers. In the hidden layers, each layer consists of 1000 nodes which are based on ReLU activation function. The output layer consists of a number of nodes equal to the total number of target activities. Besides, the softmax activation function is used for the output layer, see Algorithm \ref{DecisionFusion}. During the training phase, the categorical cross entropy cost function is exploited to calculate the difference between the target labels and the predicted labels. This difference is exploited by the backpropagation algorithm \cite{hagan1994training} to update the parameters to be learned of both the feature level and decision level layers during the training phase. Finally, Adam algorithm \cite{kingma2014adam} is used for optimizing the MLP categorical cross-entropy cost function.

\begin{algorithm}
\caption{Decision Level Fusion Classifier}
\label{DecisionFusion}
\hspace*{\algorithmicindent} \textbf{Input: X $\rightarrow$ 1D Feature vector with length $n$} \\
\hspace*{\algorithmicindent} \textbf{Parameters to be learned: $w_{i,j}^{k}$, $b_j$} \\
\hspace*{\algorithmicindent} \textbf{Output: $\hat{Y} = Predict(X)$}
\begin{algorithmic}[1]
\STATE $\hat{X} \leftarrow ResNet(X) $
\FOR{ each $n_{1}^{j}$}
\STATE $a_{1,k} \leftarrow RelU(\sum_{j}^{ } w_{1,j}^{k}.\hat{X}[j] + b_j)$
\STATE $A_{1}$.append($a_{1,k}$)
\ENDFOR \\
\STATE $A_{1} \leftarrow$ Dropout($A_{1}$,0.3)
\FOR{ each $n_{2}^{j}$}
\STATE $a_{2,k} \leftarrow RelU(\sum_{j}^{ } w_{2,j}^{k}.A_{1}[j] + b_j)$
\STATE $A_{2}$.append($a_{1,k}$)
\ENDFOR \\
\STATE $A_{2} \leftarrow$ Dropout($A_{2}$,0.3)
\STATE $\hat{F} \leftarrow flatten(A_{2})$ \\
\FOR{ each $n_{3}^{j}$}
\STATE $a_{3,k} \leftarrow Softmax(\sum_{j}^{ } w_{3,j}^{k}.A_{2}[j] + b_j)$
\STATE $A_{3}$.append($a_{3,k}$)
\ENDFOR \\
\STATE $\hat{Y} \leftarrow A_{3}.getIndex(max(A_{3}))$) \\
\textbf{Return $\hat{Y}$}
\end{algorithmic}
\end{algorithm}

\section{Experiments and Evaluation}
\label{exp}

The proposed approach for daily human activities recognition is evaluated through empirical experiments on real-world datasets: Smartphones dataset \cite{anguita2013public} and Wearable Sensors dataset \cite{attal2015physical}. The proposed model is evaluated against the following baseline models : (i) k-NN with time domain and frequency domain features \cite{attal2015physical} using the Wearable Sensors dataset. (ii) Convnet combined with MLP neural network applied to raw data \cite{ronao2016human}, and Convnet with tFFT features \cite{ronao2016human}, using the Smartphones dataset. The architecture shown in Fig.\ref{DetailedModel} is used for both datasets, the only differences are the number of input sensors and the number of output classes since the input and output of the datasets are different. Both of the features level deep networks and the decision level deep networks are trained together to ensure the consistency of the learning process.

\subsection{Datasets}
Basically, human activities are divided into periodic, static, or sporadic activities. Periodic activities such as biking and walking, static activities such as standing, lying and seated, and sporadic activities are intention-oriented activities such as drinking from a cup, and opening door \cite{bulling2014tutorial}.

\subsubsection{Smartphone Dataset}
In this dataset, the data were collected using a smartphone with a built-in accelerometer and gyroscope tri-axial sensor. The dataset consists of 6 different activities performed by 30 volunteer subjects while holding a smartphone in a pocket tight around their waist. The activities are a mix of periodic and static activities such as \textit{WALKING, WALKING UPSTAIRS, WALKING DOWNSTAIRS, SITTING, STANDING, and LAYING}. The data were sampled at 50Hz and divided into fixed length windows of 128 samples with 50\% overlap. Butterworth low-pass filter is used to separate body acceleration and gravity from the accelerometer raw data. The data were separated into a training set with 7352 windows from 21 randomly selected subjects, and testing set of the remaining 2947 windows.

\begin{table}
\centering
\caption{Smartphone dataset Accuracy Evaluation}
\label{SmartPhoneACC}
\begin{tabular}{|c|l|l|c|l|}
\hline
\multicolumn{3}{|c|}{Method}                               & \multicolumn{2}{c|}{Accuarcy (\%)}          \\ \hline
\multicolumn{5}{|c|}{\textbf{Baseline Models \cite{ronao2016human}}}                                                      \\ \hline
\multicolumn{3}{|c|}{PCA+MLP}                              & \multicolumn{2}{c|}{57.10}           \\ \hline
\multicolumn{3}{|c|}{HCF+NB}                               & \multicolumn{2}{c|}{74.32}           \\ \hline
\multicolumn{3}{|c|}{HCF+J48}                              & \multicolumn{2}{c|}{83.02}           \\ \hline
\multicolumn{3}{|c|}{SDAE+MLP(DBN)}                        & \multicolumn{2}{c|}{87.77}           \\ \hline
\multicolumn{3}{|c|}{HCF+ANN}                              & \multicolumn{2}{c|}{91.08}           \\ \hline
\multicolumn{3}{|c|}{HCF+SVM}                              & \multicolumn{2}{c|}{94.61}           \\ \hline
\multicolumn{5}{|c|}{\textbf{Deep Learning Models \cite{ronao2016human}}}                                                 \\ \hline
\multicolumn{3}{|c|}{Convnet (inverted pyramid archi)+MLP } & \multicolumn{2}{c|}{94.79}           \\ \hline
\multicolumn{3}{|c|}{tFFT+Convnet (($J(L_1)$)=200)  }        & \multicolumn{2}{c|}{95.75}           \\ \hline
\multicolumn{3}{|c|}{\textbf{Proposed Model}}              & \multicolumn{2}{l|}{}                  \\ \hline
\multicolumn{3}{|c|}{\textbf{Hierarchal Multichannel Deep ResNet}}    & \multicolumn{2}{c|}{\textbf{97.619}} \\ \hline
\end{tabular}
\end{table}

\begin{table*}[!ht]
\centering
 \caption{HAR Using Smartphone dataset Confusion Matrix Evaluation}
\label{SmartPhoneConfMat}
\begin{tabular}{ccccccclcccccc}
\multicolumn{1}{l}{} & \multicolumn{6}{c}{\textbf{ConvNet Predicted classes}} & & \multicolumn{6}{c}{\textbf{Proposed Model Predicted classes}}\\
\cline{2-7} \cline{9-14}
\multicolumn{1}{c|}{\textbf{Actual class}}&\multicolumn{1}{c|}{\textbf{W}}& \multicolumn{1}{c|}{\textbf{WU}}&\multicolumn{1}{c|}{\textbf{WD}}  & \multicolumn{1}{c|}{\textbf{Si}}  & \multicolumn{1}{c|}{\textbf{St}}  & \multicolumn{1}{c|}{\textbf{L}}   & \multicolumn{1}{l|}{} & \multicolumn{1}{c|}{\textbf{W}}   & \multicolumn{1}{c|}{\textbf{WU}}  & \multicolumn{1}{c|}{\textbf{WD}}  & \multicolumn{1}{c|}{\textbf{Si}}  & \multicolumn{1}{c|}{\textbf{St}}  & \multicolumn{1}{c|}{\textbf{L}}   \\
\cline{1-7} \cline{9-14}
\multicolumn{1}{|c|}{\textbf{Walking}}& \multicolumn{1}{c|}{\textbf{491}} & \multicolumn{1}{c|}{3}            & \multicolumn{1}{c|}{2}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{l|}{} & \multicolumn{1}{c|}{\textbf{496}} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            \\
\cline{1-7} \cline{9-14}
\multicolumn{1}{|c|}{\textbf{W. upstairs}}   & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{\textbf{471}} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{l|}{} & \multicolumn{1}{c|}{3}            & \multicolumn{1}{c|}{\textbf{468}} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            \\
\cline{1-7} \cline{9-14}
\multicolumn{1}{|c|}{\textbf{W. downstairs}} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{\textbf{420}} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{l|}{} & \multicolumn{1}{c|}{2}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{\textbf{417}} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{1}            & \multicolumn{1}{c|}{0}            \\
\cline{1-7} \cline{9-14}
\multicolumn{1}{|c|}{\textbf{Sitting}}       & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{\textbf{436}} & \multicolumn{1}{c|}{34}           & \multicolumn{1}{c|}{21}           & \multicolumn{1}{l|}{} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{1}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{\textbf{438}} & \multicolumn{1}{c|}{52}           & \multicolumn{1}{c|}{0}            \\
\cline{1-7} \cline{9-14}
\multicolumn{1}{|c|}{\textbf{Standing}}      & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{1}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{24}           & \multicolumn{1}{c|}{\textbf{496}} & \multicolumn{1}{c|}{11}           & \multicolumn{1}{l|}{} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{10}           & \multicolumn{1}{c|}{\textbf{522}} & \multicolumn{1}{c|}{0}            \\
\cline{1-7} \cline{9-14}
\multicolumn{1}{|c|}{\textbf{Laying}}        & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{43}           & \multicolumn{1}{c|}{23}           & \multicolumn{1}{c|}{\textbf{471}} & \multicolumn{1}{l|}{} & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{0}            & \multicolumn{1}{c|}{\textbf{537}} \\
\cline{1-7} \cline{9-14}
\end{tabular}
\end{table*}

\subsubsection{Wearable Sensors dataset}
In this dataset, the data were collected using three IMU sensors placed on the chest, the right thigh and the left ankle of the subject. Each IMU sensor has built-in tri-axial accelerometer, gyroscope, and magnetometer. The dataset consists of $12$ different activities performed by $6$ volunteer subjects. The activities are a mix of periodic and static activities with transitional activities such as \textit{A1: WALKING DOWNSTAIRS, A2: STANDING, A3: SITTING DOWN, A4: SITTING, A5: FROM SITTING TO SITTING ON THE GROUND, A6: SITTING ON THE GROUND, A7: LYING DOWN, A8: LYING, A9: FROM LYING TO SITTING ON THE GROUND, A10: STANDING UP, A11: WALKING, and A12: WALKING UPSTAIRS}. The dataset was sampled at $25$Hz and no sliding window was applied to the raw data.

\subsection{Baselines}
With regard to smartphone dataset, the baseline consists of two deep learning models which are applied to both the raw data and tFFT features extracted from a single smartphone IMU sensor \cite{ronao2016human}. The first baseline consists of ConvNet combined with MLP neural network to extract features automatically from the IMU sensor raw data. The second baseline consists of the ConvNet applied to tFFT features extracted from smartphone IMU sensor raw data. Both the latter baselines aim to recognize 6 static and periodic activities. The baseline models were evaluated over a test set of randomly selected 9 volunteers.

With regard to wearable sensors dataset, the baseline consists of multiple traditional machine learning models which are applied to both the raw data and time domain, frequency domain features extracted from 3 different IMU sensors \cite{attal2015physical}. The baseline models aim to recognize a set of static, periodic and transitional activities. The baseline models evaluated over 10 folds cross-validation with 25 samples and 80\% overlap sliding windows.

In this paper, To ensure a fair comparison with the baseline models, The same number of cross-folds, number of samples per sliding window, and sliding windows overlapping configurations are applied as the reference models.

\subsection{Results}

\begin{figure}
\centering
\includegraphics[scale=0.43]{ConfMatrix.png}
\caption{Confusion Matrix obtained by HMResNet using wearable sensors dataset}
\label{confmatrix}
\end{figure}

With regard to smartphone dataset, In terms of accuracy, The results of the proposed model compared to eight baseline models are shown in Table \ref{SmartPhoneACC}. Besides, The confusion matrix of the best baseline model (ConvNet) compared to the proposed model (HMResNet) is shown in Table. \ref{SmartPhoneConfMat}. The best results are highlighted in bold for both tables.

From the Accuracy results, The proposed HMResNet model has significantly outperformed the baseline models and obtained better classification accuracy.
Compared to the best baseline model (ConvNet), The confusion matrix shows that a significant improvement can be observed for static activities such as $SITTING$, $STANDING$, and $LAYING$, which constituted a major impediment for the baseline model to classify them correctly. For $LAYING$ activity, the number of the correctly classified classes improved by 12.3\% with no misclassified classes. For $STANDING$ activity, the number of the correctly classified classes improved by 4.8\%, Besides the number of misclassified classes decreased by  4.5\%. For $SITTING$ activity, the number of the correctly classified classes improved by 0.4\%, Besides the number of misclassified classes decreased by 0.6\%.
Based on the results, the proposed model shows that the hierarchal architecture with multilevel fusion layers combined with residual shortcut connections succeed to extract more relevant features for both static and periodic activities than both the hand engineered features and the plain CNN learned features. Besides, the proposed model is more accurate than both the traditional machine learning and deep learning baseline models for recognizing human daily activities based on a single accelerometer and gyroscope tri-axial sensor.

To evaluate the extendability and the robustness of the proposed model regardless of the hardware configuration, The proposed model was benchmarked against another baseline models using wearable sensors dataset. In terms of average precision-recall values, The results of the proposed model compared to eight base line models are shown in Table \ref{Werable}.

With regard to baseline models, The K-nearest neighbor (k-NN) algorithm applied to time-domain, and frequency-domain features achieves the best results in terms of average recall, and precision values, followed by Random Forest (RF), then k-NN without features and finally the Supervised Learning Gaussian Mixture Models (SLGMM) without features obtains relatively the worst results. As shown in Table \ref{Werable}, the proposed model outperforms the baseline models which are evaluated on raw data as well as on the hand-crafted features. The obtained results show that the proposed model improved the values of precision-recall to be $99.22$\% and $98.88$\% respectively compared to the baselines methods that are varying from $69.88$\% to $98.85$\% and from $69.99$\% to $98.85$\%. The best results are highlighted in bold for in the table. The proposed model obtained almost perfect results as shown in the confusion matrix in Fig. \ref{confmatrix}.

Because of the small size of the dataset, the results show a slight difference when comparing the results of the proposed (HMResNet) model to the best baseline (k-NN with features) model. Even though the small difference, the extraction of features phase requires integrating additional models and algorithms to the baseline models. Besides, the feature extraction phase needs extra computation time, which is not practical for real-time applications.

From the latter empirical evaluation experiments, The proposed HMResNet model succeeded to outperforms the baseline models, extract more relevant features, and recognize periodic, transitional, and static daily human activities from single IMU sensor up to $3$ IMU sensors, which shows the robustness of the proposed model regardless of the hardware configuration.

\begin{table}[!ht]
\centering
\caption{Wearable Sensors dataset Evaluation}
\label{Werable}
\centering
\begin{tabular}{|l|c|c|l|}
\hline
\multicolumn{1}{|c|}{Model}                                  &Precision(\%) &Recall(\%)                          \\ \hline
\multicolumn{3}{|c|}{\textbf{Without features \cite{attal2015physical}}}            \\ \hline
\multicolumn{1}{|c|}{KNN}                           & 94.62                 & 94.57                      \\ \hline
\multicolumn{1}{|c|}{RF}                            & 83.46                 & 82.28                      \\ \hline
\multicolumn{1}{|c|}{SVM}                          & 90.33                 & 90.98                       \\ \hline
\multicolumn{1}{|c|}{SLGMM}                        & 69.88                 & 69.99                       \\ \hline
\multicolumn{3}{|c|}{\textbf{With features \cite{attal2015physical}}}               \\ \hline
\multicolumn{1}{|c|}{KNN}                          & 98.85                 & 98.85                        \\ \hline
\multicolumn{1}{|c|}{RF}                           & 98.25                 & 98.24                          \\ \hline
\multicolumn{1}{|c|}{SVM}                          & 92.90                 & 93.15                          \\ \hline
\multicolumn{1}{|c|}{SLGMM}                        & 73.61                 & 74.44                         \\ \hline
\multicolumn{3}{|c|}{\textbf{Proposed Model}}                                                         \\ \hline
\textbf{Deep Multichannel ResNet} & \textbf{99.22}                 & \textbf{98.88}  \\ \hline
\end{tabular}
\end{table}

\subsection{Real World Use case: Cognitive daily exercises coaching}

\begin{figure}[!ht]
\centering
\includegraphics[scale=0.3]{imgs/scense.png}
\caption{Scene extracted from the smart home environment}
\label{showroom}
\end{figure}

To validate the proposed approach for real-time activity recognition, a use case of cognitive daily exercises coaching for a diabetic person is studied, see Fig.\ref{showroom}. This use case consists of a robot, called Pepper, that is acting as a training coach of a diabetic person, called Alice. Indeed, Pepper recognizes and guide the daily exercises which were prescribed by a doctor for \textit{Alice}. This work is reported in a multimedia video that is available on \textit{LISSI}'s Website \footnote{\url{http://www.lissi.fr/videos/HMResNet.php}}.

By extending a previously proposed cognitive architecture \cite{ayari17a}, Pepper can detect and monitor Alice's activities continuously based on the proposed HMResNet model. During this use case, a set of complex activities are recognized and analyzed by integrating the proposed HMResNet approach with previously proposed Narrative Knowledge Representation Language (NKRL) reasoning rules \cite{ayari17a,ayari17b,ayari16},  see Fig.\ref{arch}.

At the low level, a \textit{communication service} is implemented to enable the entities populating the ambient environment to connect and subscribe to cloud services as well as to interchange knowledge. The \textit{communication service} is based on standard communication technologies such as (XMPP, REST, etc.). In addition to the \textit{communication service}, HMResNet Activity recognition, and Multi-modal data sensing services are implemented at the low level.

At the high level, Knowledge representation services are proposed to model the dynamic knowledge. The knowledge representation services exploited the narrative knowledge representation language (NKRL) based n-ary ontologies, to avoid the problems experienced by binary ontologies for dynamic knowledge representation \cite{Tenorth2015,Lemaignan2016}. The representation services create NKRL predicates occurrences and save them in a shared knowledge base, thus the reasoning model query the predicates occurrences back when necessary.

\begin{figure}
\centering
\includegraphics[scale=0.45]{arch.png}
\caption{Cognitive Architecture for Human Activities Aware Robotic Systems}
\label{arch}
\end{figure}

During the experiment, The proposed model was evaluated by streaming 6974 sliding windows of 1.5 seconds and the average processing time to recognize a single activity was $0.2$ seconds. Therefore, The processing time is reasonably fitting the constraints of real-time activity recognition.

This use case is a part of $MEDOLUTION$ European project \footnote{https://itea3.org/project/medolution.html} which is funded by $ITEA3$ Research, Development and Innovation (RDI) program.

\section{Conclusion}
\label{conc}

In this paper, a new deep learning architecture based on Hierarchical Multichannel deep Residual Network (HMResNet) is proposed for robotic systems to recognize daily human activities in ambient environments. The introduced model consists of multilevel fusion layers. The proposed Multichannel 1D Deep Residual Network model is, at features level, combined with Bottleneck MLP neural network to automatically extract relevant features and, at decision level, fully connected with MLP neural network to recognize daily human activities.

The performance of the daily human activity recognition based on HMResNet model is shown through two datasets. The proposed automatic features extraction model is more relevant than both the hand engineered features and the plain CNN learned features. It is able to recognize perfectly, in terms of precision, the static activities: \textit{SITTING, STANDING,}  and \textit{LAYING}. In general, results demonstrated that the proposed model outperforms baseline methods exploiting the same datasets.

To validate the proposed approach for real time activity recognition, a use case of daily exercises coaching for a diabetic person is studied.

The ongoing works address the extension of the proposed approach to explain human behavior through recognized activities over time. Besides, The further study of the hyper-parameters tunning,  and the extracted features by HMResNet model to evaluate them against the well-known baseline deep learning models should be addressed. Even though HMResNet neural networks can be a cornerstone technique for the
Human Activity Recognition, further study of the method and evaluating
larger datasets should be conducted.


Exploring Social Ties for Enhanced Device-to-Device Communications in Wireless Networks

Abstract: Device-to-device (D2D) communications is seen as a major technology to overcome the imminent wireless capacity crunch and to enable novel application services. In this paper, we propose a novel, social-aware approach for optimizing D2D communications by exploiting two network layers: the social network and the physical, wireless network. First we formulate the physical layer D2D network according to users' encounter histories. Subsequently, we propose a novel approach, based on the so-called Indian Buffet Process, so as to model the distribution of contents in users' online social networks. Given the online and offline social relations collected by the Evolved Node B, we jointly optimize the traffic offload process in D2D communication. Simulation results show that the proposed approach offload the traffic of Evolved Node B successfully.

\section{Introduction}
\vspace{-0.15cm}
The recent proliferation of smartphones and tablets is seen as a key enabler for anywhere, anytime wireless communications. The rise of websites, such as Facebook and YouTube, significantly increases the frequency of users' online activities. Due to this continuously increasing demand for wireless access, a tremendous amount of data is circulating over today's wireless networks. This increase in demand is straining current cellular systems, thus requiring novel approaches for network design.

In order to cope with this wireless capacity crunch, device-to-device (D2D) communications underlaid on cellular systems has recently emerged as a promising technique that can significantly boost the performance of wireless networks. In D2D communication, user equipments (UEs) transmit data signals to each other over a direct link instead of through the wireless infrastructure, i.e., the cellular network's Evolved Node Bs (eNBs). The key idea is to allow direct D2D communications over the licensed band and under the control of the cellular system's operator \cite{Xu.2012}. Furthermore, as D2D communication often occurs over shorter distances, it is expected to yield higher data rates for the UEs than infrastructure-based communications. D2D communication is regarded as a promising technology for improving the spectral utilization of wireless systems.

Recent studies have shown that the majority of the traffic in cellular systems consists of the download of content such as videos or mobile applications. If we can cut off the traffic of this part, a large amount of capacity can be freed out. Usually, popular contents, such as certain YouTube videos, are requested by much more frequently than others. As a result, the eNBs often end up serving different mobile users with the same contents for multiple times. As the eNB has already sent the contents to mobile users, the contents are now locally accessible to other users in the same area, if cellular UEs' resource blocks (RBs) can be shared with others. Upcoming users who are within the transmission distance can request the contents from those users through D2D communication. In this case, the eNB will have to only serve those users who request ``new" content, which has never been downloaded before. Through this D2D communication, we can reduce considerable redundant requests to the eNB, so that the traffic burden of eNB can be released.

The main contribution of this paper is to propose a novel approach to D2D communications that allows to exploit the social network characteristics so as to improve the performance and reduce the load on the wireless cellular system. To achieve this goal, there are some key points we are going to discuss. The first of all is to establish a stable D2D subnetwork to maintain the data transmission successfully. A stable connection should guarantee that once the D2D communication is set up, the link should not be dropped easily. As a D2D subnetwork is formulated by individual users, the connectivity among users sometimes is intermittent. If the connection is too sensitive to users' movement and easy to interrupt, it can neither offload the traffic of eNB nor meet users' satisfaction. It is difficult to employ such dynamic information to make reasonable decisions. However, the social relations in real world tend to be stable over time. Such social ties can be utilized to achieve efficient data transmission in the D2D subnetwork. We name this social relation assisted data transmission network by offline social network (OffSN).

Second, we assess the amount of traffic that can be offloaded to D2D communication, i.e., what probability the requested contents can be served locally. To analyze this problem, we study the probability that a certain content is selected. This probability is affected by two different aspects: the external (external influence from media, friends, etc.), and internal (user's own interests) aspects. While users' interests are hard to know, the external influence is more easier to estimate. The choices of the users are mutually dependent. Consequently, the network operator (e.g., via the eNB) can generate an online social network (OnSN) to keep track of users' access to online websites, and maintain the distribution over OffSN users' selection. If we can estimate people's selection based on external influences, we can get the probability of contents being served locally.

In this paper, We will adopt practical metrics to establish OffSN, and involve the novel learning process-Indian Buffet Process to model the influence in OnSN. Then we can get solutions for the previous two problems. Latter we will integrate OffSN and OnSN to carry out the traffic offloading algorithm for the cellular network. Our simulations also proved our analysis for the traffic offloading performance.
\vspace{-0.25cm}
\section{System Model}
\vspace{-0.15cm}
Consider a cellular network with one eNB and $N$ users. The UEs can receive signals from the eNB through cellular network, or from other UEs through D2D pairs using licensed spectrum resources. In the system, two network layers exist over which information is disseminated. The first layer is OnSN. The links of contents spread out on popular websites, users access the links to contents. Hence, the OnSN is the platform over which users acquire the links of contents. Once a link is accessed, the data package of contents must be transmitted to the UEs through the actual physical network. Taking advantage of the social ties, OffSN is the physical layer network for contents behind the links spread out.
\begin{figure}[!t]
  \begin{center}
    \includegraphics[width=0.9\columnwidth,height=0.28\textwidth]{figure8.eps}
    \vspace{-0.15cm}
    \caption{\label{fig:OnSN and OffSN}Information dissemination in both OnSN and OffSN.}
  \end{center}\vspace{-0.8cm}
\end{figure}

An illustration of this proposed model is shown in Fig. \ref{fig:OnSN and OffSN}. Each user active in the OnSN corresponds to an UE in the OffSN. Users access the link of a content in an increasing order of their labels. In OnSN, the link of a content is spread out according their popularity from frequent users to regular users. In particular, a group of users, which we refer to as $\emph{frequent users}$, have a high online activity, and, thus, are the main source of influence and information dissemination. In this respect, the choices of the $\emph{regular users}$, who access the OnSN less frequently, are usually influenced by the frequent users. In the OffSN, the first request of the content is served by the eNB. Subsequent coming users can thus be served by previous users who hold the content, if they are within the D2D communication distance. In this section, we will study the properties of OffSN and OnSN, and quantify the relation between these two networks, before developing the proposed offloading algorithm.
\vspace{-0.05cm}
\subsection{Offline Social Network Model}
\vspace{-0.05cm}
In the area covered by an eNB, the distribution of the users can often be properly modeled. For instance, in public areas such as office buildings and commercial sites, the density of users is much higher than in other locations such as sideways and open fields. In addition, users are less likely to browse the web when they are walking or driving. Indeed, the majority of the data transmissions occurs in those fixed places. In such high density locations, forming D2D network as OffSN becomes a natural process. Thus, we can distinguish two types of areas: highly dense areas such as office buildings, and ``white" areas such as open fields. In the former, we assume that D2D networks are formed based on users' social relations. While in the latter, due to the low density, the users are served directly by the eNB. D2D communications carry out in those subnetworks can effectively improve the cellular system throughput. If proper resource management is adopted, the interference among each subnetwork can be restricted \cite{Golrezaei.ICC2012}. Thus, each OffSN can be mutually independent from others to some extent. Optimizing the performance of each OffSN can improve the overall performance of the cellular network.

The OffSN is a reflection of local users' social ties. Proper metrics need to be adopted to depict the degree of the connections among users in the OffSN. For example, users who are within the D2D communication range and more regularly meet can be seen as more robust connection. Due to mobility, grouping users by using only their last known location, can lead to dropped connections. Indeed, in public areas such as airports and train stations, most of the users have high mobility patterns and it is difficult to predict their future locations. However, if we define users connection degree in OffSN according to their encounter history or daily routes, stable D2D connections can be formed. For example, officemates, classmates and family members always meet one another more regularly and frequently than others. Thus, those social ties lead to higher probabilities to transmit data among users. If any two UEs are within the D2D communication distance, the eNB can detect and mark them as encountered. But the specific way to collect data is not our main focus in this paper.

The contact duration distribution between two users is assumed to be a continuous distribution, which has a positive value for all real values greater than zero. For users who regularly meet, their encounter duration usually centers around a mean value. So we can adopt a $Gamma(k,\theta)$ distribution to model the encounter duration between two users. This distribution is widely used in modeling the call durations and has been shown to have a high accuracy \cite{Guo.WiCom 2007}. To find the value for the two parameter $k$ and $\theta$, we need to derive the mean and variance of the contact duration.

As shown in Fig. \ref{fig:encounter history}, given the contact duration $X_n$ and the number of encounters $N_{i,j}$ between user $i$ and user $j$, an estimate of the expected contact duration length $M_{i,j}$:
\vspace{-0.2cm}
\begin{equation}\vspace{-0.2cm}
M_{i,j} = \frac {\sum_n X_n}{N_{i,j}}.
\end{equation}\vspace{-0.2cm}

\begin{figure}[!t]
  \begin{center}
    \includegraphics[width=0.7\columnwidth,height=0.13\textwidth]{figure1.eps}
    \vspace{-0.3cm}
    \caption{\label{fig:encounter history}Encounter history between user i and j.}
  \end{center}\vspace{-0.7cm}
\end{figure}

The variance represents the fluctuation in the contact period. If two cases have the same average contact period, the one with larger fluctuations would be less preferable since the contact length would be more uncertain. Thus, we measure the variance of the contact period distribution to reflect the fluctuation using an irregularity metric $I_{i,j}$ defined by \cite{Li.IEEE Conf2009}:
\vspace{-0.2cm}
\begin{equation}\vspace{-0.25cm}
I_{i,j} = \frac {\sum_n (X_n - M_{i,j})^2} {N_{i,j}}.
\end{equation}\vspace{-0.15cm}

Given the mean and variance of the encounter period, we can derive the encounter duration distribution: $X\sim Gamma(k,\theta)= Gamma(\frac{M_{i,j}^2}{I_{i,j}}, \frac{I_{i,j}}{M_{i,j}})$. The probability density distribution (PDF) of encounter duration is:
\vspace{-0.1cm}
\begin{equation}\vspace{-0.2cm}
f(x; k, \theta) = \frac{1}{\theta^k}\frac{1}{\Gamma(k)}x^{k-1}e^{-\frac{x}{\theta}},
\end{equation}\vspace{-0.05cm}
where $\Gamma(k)=\int_0^\infty t^{k-1}e^{-t}dt$. Then, we can calculate the probability of the contact durations that are qualified for data transmission. If the contact duration is not enough to complete a data package transmission, the communication session cannot be carried out successfully. We adopt a closeness metric, $w_{i,j}$ to represent the probability of establishing a successful communication period between two UEs $i$ and $j$, which ranges from $0$ to $1$. The qualified contact duration is the complementary of the disqualified communication duration probability, so $w_{i,j}$ can be represented as:
\vspace{-0.1cm}
\begin{equation}\vspace{-0.25cm}
w_{i,j}=1-\int_0^{X_{min}}f(u;k,\theta)du=1-\frac{\gamma(k,\frac{X_{min}}{\theta})}{\Gamma(k)},
\end{equation}\vspace{-0.05cm}
where $X_{min}$ is the minimal contact duration required to successfully transmit one content data package. $X_{min}$ is a random variable that depends on the channel conditions between the two UEs (e.g., the higher the signal strength between the UEs, the smaller $X_{min}$). Moreover, $X_{min}$ should depend on the content size. $\gamma(k,\frac{X_{min}}{\theta})=\int_0^{X_{min}} t^{k-1}e^{-t}dt$ is the lower incomplete gamma function. Larger closeness $w_{i,j}$ indicates a better future contact opportunity between user $i$ and user $j$.

An OffSN can be seen as a D2D network that is constructed by a group of users with stable connections. Hence, we can use the closeness metric $w_{i,j}$ to describe the communication probability between two users, which can also be seen as the weight of the link between user $i$ and user $j$. Then, a threshold $w_T$ can be defined to filter the boundary between different OffSNs and ``white" areas.

If we have lower $w_T$, more users will be added in, and the covered area of the OffSN will increase. Even though the probability that a user will be served locally will increase, it is likely that the group members who own the content are located far away. In this case, the prospective gain would not compensate the cost on associated power consumption for relaying and transmitting. Also, OffSNs may overlap with each other, and cause inter-OffSN interference which can further complicate the analysis. On the other hand, if $w_T$ is too high, only a small number of users can be grouped which makes it difficult to perform D2D communication. Therefore, one important problem is to find a proper $w_T$ that can balance the tradeoff between the cost and gain, and thus to get the best performance for the system.
\vspace{-0.05cm}
\subsection{Online Social Network Model}
\vspace{-0.05cm}
First, we define the number of users in OnSN as $N$ which is corresponding to $N$ UEs in OffSN. The total number of available content in OnSN is denoted by $K$. Given the large volume of data available online, we can assume that $K = K_h + K_0$, $K \rightarrow \infty$. $K_h$ represents the set of contents that have viewing histories and $K_0$ is the set of contents that do not have any viewing history. In OnSN, users select contents partially based on external influence. It is possible to predict current users' selections by analysing the OnSN activities of previous users within the same OffSN. To draw the probability of current user's selection, we adopt the Indian Buffet Process (IBP) \cite{Griffiths.ML 2011} which serves as a powerful analytical tool for predicting users' behaviors.

In an IBP, there are infinite dishes for customers to choose. The first customer will select its preferred dishes according to a $Poisson$ distribution with parameter $\alpha$. Since all dishes are new to this customer, no reference or external information exists so as to influence this customer's selection. However, once the first customer completed the selection, the following customers will have some prior information about those dishes based on the first customer'’s feedback. Therefore, the decisions of subsequent customers are influenced by the previous customers'’ feedback. Customers learn from the previous selections to update their beliefs on the dishes and the probabilities with which they will choose the dishes.

The behavior of content selection in OnSN is analogous to the behavior of dish selection in an IBP. If we view OnSN as an Indian buffet, the online content as the infinite number of dishes, and the users as customers, we can interpret the contents spreading process online by an IBP. Users enter OnSN sequentially to download their desired content. When a user downloads its content, the recorded downloading times of contents changed. This action will affect the probability that this content to be requested. Popular contents will be requested more frequently. While those contents that are only favored by a few number of people, or those new produced content will be requested less frequently. So the probability distribution can be implemented from the IBP directly.

\begin{figure}[!t]
  \begin{center}
    \includegraphics[width=\columnwidth]{figure7.eps}
    \vspace{-0.3cm}
    \caption{\label{fig:IBP}Indian Buffet Process.}
  \end{center}\vspace{-0.7cm}
\end{figure}
In Fig. \ref{fig:IBP}, we show one realization of IBP. Customers are labeled by ascending numbers in a sequence. The shaded block represent the $n$th user selected dish $k$. In IBP, the first customer selects each dishes with equal probability of $\frac{\alpha}{K}$, and ends up with the number of dishes follows $Poisson(\alpha)$ distribution. For subsequent customers $n = 2,\ldots,N$, the probability of also having dish $k$ already belonging to previous customers is$ \frac{m_k^{n-1}}{n}$, where $m_k^{n-1}$ is the number of customers prior to $n$ with dish $k$ \cite{Griffiths.ML 2011}. Repeating the same argument as the first customer, customer $n$ will also have $m_n^0$ new dishes not tasted by the previous customers follows a $Poisson(\frac{\alpha}{n})$ distribution.

The probabilities of selecting certain dishes act as the prior information $\pi(m_k^{n-1})$. For ``old" dishes which have been tasted before, $m_k^{n-1}\neq 0$. For ``new"’ dishes which have not been sampled before, $m_k^{n-1}= 0$. After user $n$ completes its selection, the prior will be updated to $\pi(m_k^{n})$. This learning process is also illustrated in Fig. \ref{fig:IBP}. $K_0^n$ is the number of dishes that have not been sampled before user $n$'s selection session. We can see the selection probability for dish $k$ updated every time after each customer's selection.
\vspace{-0.03cm}
\section{Proposed Traffic Offloading Algorithm}
\vspace{-0.03cm}
\subsection{Data Rate in OffSN}
\vspace{-0.05cm}
As the inter-OffSN interference of D2D communication can be restricted by methods such as power control \cite{Xu.2012}\cite{Golrezaei.ICC2012}. For simplicity, we place an emphasis on the intra-OffSN interference due to resource sharing between D2D and cellular communication. In the OffSN that acts as the subnetwork of cellular network, the D2D transmissions and the eNB transmissions will interfere. During the downlink period of D2D communication, UEs will experience interference from other cellular and D2D communications as they share the same subchannels. In this respect, the received power of link $i$ to $j$ can be expressed as \cite{Xu.2012}:
\begin{equation}\vspace{-0.25cm}
P_{r,ij}= P_i\cdot h^2_{ij}=P_i\cdot d_{ij}^{-\eta}\cdot h^2_0,
\end{equation}\vspace{-0.05cm}
where $P_i$ is the transmit power, $\eta$ is path loss exponent which ranges from $2 \leq \eta \leq 5$, $h_{ij}$ is the channel response of
the link $i$ to $j$, $h_0$ is the complex Gaussian channel coefficient that follows the complex normal distribution $\textsl{CN}(0,1)$.

Thus, we can define the transmission rate of users served by the eNB and by D2D communication with co-channel interference \cite{Xu.2012}:
\begin{equation}\vspace{-0.25cm}
R_c= \log_2 \left(1+\frac {P_Bh_{Bc}^2}{\sum_d\beta_{cd}P_dh_{dc}^2+N_0}\right),
\end{equation}
\begin{equation}
R_d= \log_2 \left(1+\frac {P_dh_{dd}^2}{P_Bh_{Bd}^2+\sum_{d'}\beta_{dd'}P_{d'}h_{d'd}^2+N_0}\right),
\end{equation}
where $P_B$, $P_d$ and $P_{d'}$ are the transmit power of eNB, D2D transmitter $d$ and $d'$, respectively, $N_0$ is the additive white Gaussian noise (AWGN) at the receivers, and $\beta_{cd}$ represents the presence of interference from D2D to cellular communication, satisfying $\beta_{cd} = 1$, otherwise $\beta_{cd} = 0$. Here, $d\neq d'$, so $\sum_{d'}\beta_{dd'}P_{d'}h_{d'd}^2$ represents the interference from the other D2D pairs that share spectrum resources with pair $d$.

The transmission rate of the users that are only serviced by the eNB and that do not experience co-channel interference in the OffSN is given by:
\begin{equation}\vspace{-0.25cm}
V_c= \log_2 \left(1+\frac {P_Bh_{Bc}^2}{N_0}\right).
\end{equation}\vspace{-0.1cm}
\vspace{-0.05cm}
\subsection{Content Selection in OnSN}
\vspace{-0.05cm}
In the studied model, the eNB maintains the contents distribution of each OnSN. When the $n$th user starts to surf online, this user will sample the content based on the prior information $\pi(m_k^{n-1})$. To this end, this user will access old content with probability $\frac{m_k^{n-1}}{n}$, and access new content with a $Poisson(\frac{\alpha}{n})$ distribution. After content selection, $\pi(m_k^{n-1})$ is updated to the posterior probability $\pi(m_k^n)$. The total amount of content each user selected can be draw from a $Poisson$ distribution
\begin{equation}\vspace{-0.25cm}
m_n \sim Poisson(\alpha).
\end{equation}\vspace{-0.3cm}
\vspace{-0.15cm}
\subsection{System Utility}
\vspace{-0.1cm}
In the proposed model, the users aim at maximizing their data rate while minimizing the cost. Without loss of generality, we assume that every content has the same size. Consequently, we propose the following utility function for user $n$:
\begin{equation}\vspace{-0.25cm}
U_u(n)=\left[\sum_{k=1}^{K_h}\frac {m_k^{n-1}}{n}\right] (R_d-C_t)+m_n^0 (R_c- C_m),
\end{equation}
where $C_t$ is the cost related to the D2D transmission power $P_i$ in (6). $C_m$ is the cost paid by the user  to the eNB for the data flow. The utility function consists of two parts. The first part is the utility of receiving old content via D2D communication. The second part is the utility of downloading new content from the eNB.

From the eNB perspective, the goal is to maximize the overall data rate while also offloading as much traffic as possible. Even though eNB can offload traffic by D2D communication, controlling the switching over cellular and D2D communication causes extra data transmission. There thus exists some cost such as control signals transmission and information feedback during the access process \cite{Xu.2012}. Therefore, for the eNB that is servicing a certain user $n$, we propose the following utility function:
\begin{equation}\vspace{-0.15cm}
U_B(n)=\left[\sum_{k=1}^{K_h}\frac {m_k^{n-1}}{n} \right]R_d+m_n^0 R_c - m_n C_c,
\end{equation}
where $C_c$ is the cost for controlling the resource allocation process. The total traffic eNB offloaded by D2D communication is $m_n V_c-m_n C_c-m_n^0 R_c$.
\vspace{-0.2cm}
\subsection{Proposed Algorithm}
\vspace{-0.5cm}
\begin{algorithm}
\caption {Proposed Traffic Offloading Algorithm}
\SetAlgoLined
\KwData {$X_n$, $N_{i,j}$, $P_B$, $P_d$, $P_{d'}$}
\KwResult{$U_u(n)$, $U_B(n)$}
\textbf{1. OffSN Generation}\;
eNB collects encounter information in cellular network\;
Locate the frequent users in high user density areas\;
Find the closeness $w_{i,j}$ between two users\;
\If {$w_{i,j}\geq w_T$}{
Add user $i$ and user $j$ into OffSN\;
}
\textbf{2. User Activity Detection}\;
\While {user $n$ is accessing the tagged websites}{
eNB detects user's location\;
 \If {user $\in$ ``white" areas}{
  eNB serves all requests directly\;
 }
 \If{user $\in$ an OffSN}{
 eNB keep watching user's activities\;
 }
}
\textbf{3. Service based on OnSN Activities}\;
\While{User $n$ is selecting contents online}{
eNB maintains prior information $\pi(m_k^{n-1})$\;
\If {old content}{
eNB locates the content holder with highest closeness $w_{n,i}$ to user $n$ in OffSN\;
Establish D2D communication\;
eNB monitors the communication process\;
 \If {communication failed}{
 eNB revert back to continue the transmission\;
 }
}
\If {new content}{
 eNB serves the request directly\;
 }
update $\pi(m_k^{n})$\;
}
\vspace{-0.15cm}\end{algorithm}
\vspace{-0.35cm}
We propose a novel algorithm form which consists of multiple stages. In the first stage, the eNB focuses on high user density areas, and collects the encounter history between users. The eNB locates one frequent user and its neighboring users via well-known algorithms \cite{{Irfan.2013}} in order to compute their closeness $w_{i,j}$. By checking if $w_{i,j}\geq w_T$, i.e., if user $i$ and user $j$ satisfy the predefined closeness threshold, the eNB can decide on whether to add this user into the OffSN or not. By choosing a proper $w_T$ and power control, the interference among different OffSNs can be avoided. This process will continue until no more user can be further added to the eNB's list. Then, the users in the established OffSN can construct a communication session with only intra-OffSN interference.

For websites that provide a portal to access content, such as Facebook and YouTube, the eNB will assign a special tag. Once a user visits such tagged websites, the eNB will inspect whether the user is located in an OffSN or a ``white" area. If the user is in ``white" area, user's any requests will be served by the eNB directly. If the user is located in an OffSN, the eNB will wait until the user requests contents. By serving previous user's requests, the eNB has already built up a history file including the prior information $\pi(m_k^{n-1})$ of the content distribution in the OnSN. As soon as receiving user requests data, the eNB detects if there are any resources in the OffSN, and then choose to set up a D2D communication or not based on the feedback. For old content, the eNB will send control signal to the $i$th UE with the highest closeness $w_{n,i}$ with user $n$. Then UE $n$ and UE $i$ establish the D2D communication. Even if the D2D communication is setup successfully, the eNB still wait until the process finishes successfully. If the D2D communication fails, the eNB will revert back to serving the user directly. For new content, the eNB serves the user directly. After the selection is complete, the prior information updates to the posterior probability $\pi(m_k^n)$. The proposed D2D communication algorithm is summarized in Algorithm $1$.
\vspace{-0.15cm}
\section{Simulation Results and Analysis}
\vspace{-0.1cm}
In this section, we give the simulation results to show traffic offloading performances of the system from different aspects and provide numerical results of how different parameters affect the system's performance. Consider $32$ active users than are randomly distributed in an OffSN. The size of the content library is unbounded. We assume that the content selection process has been carried on for a period of times. So the eNB can obtain the prior information of the content distribution. In our simulation, we have proved that, once the parameters are specified, the order in which the users perform their selection does not affect the performance of the system.
The main physical layer parameters are listed as follows. The radius of an OffSN is set up as $80$m. Noise spectral density is $-174$dBm/Hz. Noise figure at device is $9$dB. Antenna gains and transmit power of eNB is $14$dBi and $46$dBm. For device, it is $0$dBi and $23$dBm, respectively.

\begin{figure}[!t]
  \begin{center}
    \includegraphics[width=0.825\columnwidth,height=0.275\textwidth]{figure15.eps}
    \vspace{-0.25cm}
    \caption{\label{fig:Traffic and Alpha}The impact of the parameter $\alpha$ on offloading traffic.}
  \end{center}\vspace{-0.5cm}
\end{figure}

In Fig. \ref{fig:Traffic and Alpha}, we investigate whether the user online activity degree will affect the amount of traffic that can be offloaded. As we can see from Fig. \ref{fig:Traffic and Alpha}, with the increase of parameter $\alpha$, the amount of traffic that is offloaded from the eNB decreases, but traffic still can be released compared to the eNB serving only system. The data rate is nearly $0$ when $\alpha$ is small. This result is due to the fact that, when $\alpha$ is low, users are more likely to choose old content. Here, the requests are served by D2D communication in most of the cases, and cause nearly no traffic on the eNB. As $\alpha$ increases, the data rate begins increase. Indeed, when the users tend to make more selections, they may choose more new content. The offloaded traffic amount generally decreases with the increase of online activities, which is coincidence with the common sense that, more contents downloading will cause more traffic to eNB. The traffic includes not only the contents data, but also the control signals the eNB needs to send for the D2D communication arrangement.
\begin{figure}[!t]
  \begin{center}
    \includegraphics[width=0.825\columnwidth,height=0.275\textwidth]{figure14.eps}
    \vspace{-0.25cm}
    \caption{\label{fig:Traffic and Distance}The relationship between the offloading traffic and maximum D2D communication distance.}
  \end{center}\vspace{-0.45cm}
\end{figure}

As the D2D communication distance increases, the eNB will have more possibilities for detecting available contents providers. As a result, the performance of traffic offloading will be better with larger maximum distance. This assumption is shown in Fig. \ref{fig:Traffic and Distance}. In this figure, we can see that, with $\alpha$ setting to $8$, increasing the maximum communication distance, yields a decrease in the eNB's data rate and an increase in the amount of offloaded traffic. However, we note that, with the increase of the transmission distance, the associated UE costs (e.g., power consumption) will also increase. Thus, the increase of D2D communication distance will provides additional benefits to the eNB, but not for users.

\begin{figure}[!t]
  \begin{center}
    \includegraphics[width=0.825\columnwidth,height=0.275\textwidth]{figure13.eps}
    \vspace{-0.25cm}
    \caption{\label{fig:Traffic and eNB Cost}Average sum-rate at the eNB, as the cost for control signaling varies.}
  \end{center}\vspace{-0.85cm}
\end{figure}
In Fig. \ref{fig:Traffic and eNB Cost}, we show the variation of the sum-rate at the eNB as the cost for control signal varies. As the eNB has to arrange the inter change process between cellular and D2D communication, necessary control information are needed. Moreover, additional feedback signals are required for monitoring the D2D communication and checking its status. Those costs will affect the traffic offloading performance of the system. In our simulation, we define the cost as the counteract to the gain in data rate from 5\% to 50\%.  As we can see from Fig. \ref{fig:Traffic and eNB Cost}, increasing the cost on control signal, the offload traffic amount is decreased.
\vspace{-0.05cm}
\section{Conclusion}
\vspace{-0.05cm}
In this paper, we have proposed a novel approach for improving the performance of D2D communication underlaid over a cellular system, by exploiting the social ties and influence among individuals. We formed the OffSN to divide the cellular network into several subnetworks for carrying out D2D communication with only intra-OffSN interference. Also we established the OnSN to analyse the OffSN users' online activities. By modeling the influence among users on contents selection online by Indian Buffet Process, we obtain the distribution of contents requests, and thus can get the probabilities of each contents to be requested. With the algorithm we proposed, the traffic of eNB has been released. Simulation results have shown that different parameters for eNB and users will lead to different traffic offloading performances. Users with more online activities will increase and fluctuate the data rate of the eNB. Enable larger maximum D2D communication distance will release more traffic burden of the eNB. While if the cost on D2D communication arrangement is high, the traffic offloading performance will decrease.

\vspace{-0.05cm}

Social and Information Networks (cs.SI); Networking and Internet Architecture (cs.NI)