Wavelet-based algorithm for auto-detection of daily living activities of older adults captured by multiple inertial measurement units (IMUs)

A recent trend in human motion capture is the use of inertial measurement units (IMUs) for monitoring and performance evaluation of mobility in the natural living environment. Although the use of such systems have grown significantly, the development of methods and algorithms to process IMU data for clinical purposes is still limited. The aim of this work is to develop algorithms based on wavelet transform and discrete-time detection of events for the automatic segmentation of tasks related activities of daily living (ADL) from body worn IMUs. Seven healthy older adults (73  ±  4 years old) performed 10 ADL tasks in a simulated apartment during trials of different durations (3, 4, and 5 min). They wore a suit (Synertial UK Ltd IGS-180) comprised of 17 IMUs positioned strategically on body segments to capture full body motion. The proposed method automatically detected the number of template waveforms (representing each movement separately) using discrete wavelet transform (DWT) and discrete-time detection of events based on angular velocity, linear acceleration and 3D orientation data of pertinent IMUs. The sensitivity (Se.) and specificity (Sp.) of detection for the proposed method was established using time stamps of10tasks obtained from visual segmentation of each trial using the video records and the avatar provided by the system’s software. At first, we identified six pertinent sensors that were strongly associated to different activities (at most two sensors/task) that allowed detection of tasks with high accuracy. The proposed algorithm exhibited significant global accuracy (Nevents  =  1999, Se.  =  97.5%, Sp.  =  94%), despite the variation in the occurrences of the performed tasks (free living). The Se. varied from 94% to 100% for all the detected ADL tasks and Sp. ranged from 90% to 100% with the worst Sp.  =  85 and 87% for Release_mid (reaching for object held just beyond reach at chest height) and Turning_Left tasks, respectively. This study demonstrated that DWT in conjunction with a nonlinear transform and auto-adaptive thresholding process for decision rules are highly efficient in detecting and segmenting tasks performed during free-living activities. This study also helped to determine the optimal number of sensors, and their location to detect such activities. This work lays the foundation for the automatic assessment of mobility performance within the segmented signals, as well as potentially helps differentiate populations based on their mobility patterns and symptomatology.


Introduction
In the last decade, concerted efforts have been deployed for the development of ambulatory movement monitors and human motion analysis using inertial measurement units (IMUs) (Zhou and Hu 2008). Recent technological advances have led to the production of small body-worn IMUs enabling synchronized data collection from multiple sensor sources and smart monitors with online data processing for high-speed analysis and high-frequency data sampling Hu 2008, Barbour andSchmidt 2001). By combining the signals from multiple, synchronized sensors (e.g. linear accelerations, gyroscopes, and magnetometers that measure heading with respect to the Earth's magnetic field) with models of human body motion, whole-body joint kinematics and spatiotemporal aspects of mobility could be estimated in the clinic and in real-life conditions (Jasiewicz et al 2006, Roetenberg et al 2009. Indeed, the small size and ease of application of body-worn sensors allow unobtrusive monitoring during clinical testing (Horak et al 2015).
Despite these technological advances, the use of IMUs system in a free-living environ ment for long-term monitoring of mobility is still limited and challenges remain, such as the development of methods and algorithms for tasks' auto-detection/segmentation to handle large volumes of data, which will help perform quick diagnosis of patients. For instance, the segmentation of activities during daily living is a crucial step in assessing motor performance of individuals in their living environment. Since visual segmentation on large set of data is unpractical (e.g. 3-5 h to segment a 3 min free living trial), methods for automatic segmentation of motions is crucial to reduce/handle large volumes of data collected from IMUs. The present study is dedicated specifically to the description of the algorithm complexity and the details of the analysis process to auto-detect and segment 10 commonly observed tasks related to daily living activities (see table 1). It is important to point out that the tasks were performed randomly and can overlap (occur at the same time) in a free-living environment, which enhanced the complexity of the auto-detection process.
To date, several methods and algorithms were proposed to infer: activity type/intensity (Plasqui and Westerterp 2007); falls (Boissy et al 2007, Bourke et al 2007, Nyan et al 2008, mobility monitoring (Najafi et al 2003, Godfrey et al 2011, Pineau et al 2014 and gait analysis and balance evaluation (González et al 2010, Hundza et al 2014. However, the range of activities detected in these studies was limited by the extent of sensor information available; thus, the proposed approaches were validated only on small samples of overall human behaviors, either during isolated activities or over short durations in a controlled laboratory-like environments. Recently, Moncada-Torres et al (2014) addressed the activity classification using inertial and barometric pressure sensors placed on different anatomical locations during activities such as drinking and writing. Chernbumroong et al (2013) proposed an activity recognition and classification method (support vector machine) for detection of the ADLs (feeding, walking, dressing, sweeping, washing dishes, watching TV and sleeping/lying down) of an elderly person by combining a data (temperature, and altimeter with accelerometer sensors) from a wrist worn sensors. The proposed method achieved an overall accuracy of 90.23%. Lowering from standing position on standard chair.

T2-Walk
Walking at a normal speed.

T3-Release_down
Bending down in front and on both sides to release an object on the ground.

T4-Reach_ground
Bending down in front and on both sides for reaching an object held beyond reach on the ground.

T5-Reach_down_Chair
Bending down in front and on both sides for reaching an object held beyond reach on the chair. T6-Step_over_obstacle Step over the obstacle.

T7-Reach_Up
Reaching in front and on both sides for object held just beyond reach at head height.

T8-Reach_Mid
Reaching in front and on both sides for object held just beyond reach at chest height.

T9-Turn_Left
Turning left (45°,90°,180° and 145°) T10-Turn_Right Turning right (45°,90°,180° and 145°) However, the segmentation methodology was unclear, and using only sensors in the upper limb could become a problem when arm swing is not present, or if two tasks are performed at the same time (e.g. walking and manipulating an object). Another study (Bergmann et al 2014) focused on measuring aspects of arm movement, which represents only a small part of human behavior overall.
Recently (Nguyen et al 2015), we developed algorithms for auto detection and segmentation of scripted tasks during a timed-up-and-go (TUG) based on linear filtering. However, such linear filtering methods may not be suitable for the detection of more complex tasks, especially if they are performed at will in an environment that may require the person to alter their movement patterns. Discrete wavelet transform (DWT) has been widely applied in biomedical engineering areas for solving a variety of physiological signals processing problems (Adeli et al 2003, Chouakri et al 2011. DWT is an appropriate tool for analysis and representing various aspects of non-stationary signals; such as trends, discontinuities, and repeated patterns. Other signal processing approaches are not as effective; simple filtering operation as bandpass filtering can seriously alter sharp features of movement patterns in the signal. DWT, however, enables us to preserve these features and to represent them by a relatively small number of coefficients. In the present paper, we proposed a new robust algorithm based on wavelet transform and discrete-time detection of events using IMUs for detection and auto-segmentation of 10 ADL tasks (see table 1). For feasibility, comfort and affordability reasons, the ultimate goal should be to use as few sensors as possible to detect and evaluate movements. In this study we wanted to do away with preconceptions of which sensors are important, and where they should be positioned on the body. This is why all recordings were performed using a 17-IMU system so as to obtain full body kinematics. This allowed us to use the three-dimensional (3D) avatar built by the system's software to verify the accuracy of our automated algorithms to detect and segment the tasks. In addition, it allowed us to identify pertinent sensors, and their position on the body, so as to obtain the highest degree of accuracy possible.

Materials and methods
In contrast to many previous studies who validated their approach during relatively slow activities, or over short duration, the performance of the proposed detection and segmentation algorithm were evaluated for the 10 tasks cited in table 1, this over trials that lasted either 3, 4 and 5 min. This represents a more complicated context where participants performed unscripted tasks in a continuous and free fashion in a defined/controlled space (25 m 2 ) simulating an apartment (figure 1(a)).

Participants
Seven healthy older adults (three females; 69 ± 10 years old; four males; 72 ± 10 years old) were recruited through the Centre de Recherche de l'Institut Universitaire de Gériatrie de Montréal (CRIUGM). Participants were screened for comorbidities and cognitive deficits. None of the participants exhibited any physical limitations or pain that could affect their ability to perform the tasks at hand. The institutional research ethics review board of the CRIUGM approved this study and each participant provided informed consent (ethic number: CRIUGM 10-11-012).

Motion capture apparatus
Participants performed these tasks while wearing the IGS-180 motion capture suit (Synertial UK Ltd, Brighton, UK). The IGS-180 (figures 1(c) and (d)) is equipped with 17 inertial sensing modules (OS3D, Inertial Lab, VA, USA) positioned on each limb in order to capture full-body 3D movement (figure 1(d)). Each sensor module is comprised of 3-axis linear acceleration (accelerometer), angular velocity (gyroscope) and magnetic north heading (magnetometer). Raw data (acceleration, angular velocity) and fused data (3D orientation in degrees estimated from a fusion algorithm) from each sensor were acquired at 60 Hz. Since we had no a priori expectation as to which sensors were suitable markers for detection and segmentation, all 17 inertial sensors were active during the recordings. Based on the specificities/indications provided by the system IGS-180 and Animazoo Software, the head sensor was attached to a cap worn by the participants, which positioned it on the right side of the head. The trunk sensor was located on the midline over T1, while the hip sensor was positioned at the level of L5. For upper extremities, shoulder sensors were positioned over the scapula; upper arm sensors were positioned between the shoulder and elbow while forearm sensors were positioned between the elbow joint and wrist. Hand sensors were attached to an open-finger glove, and positioned on the dorsum surface of the hands. In the lower extremity, thigh sensors were positioned on the outer side of the limb segment between the hip and knee. Shin sensors were positioned between the knee and ankle. Foot sensors were attached to the dorsum of the shoes worn by the participants.

Experimental protocol
In this study, participants were asked to perform ADL tasks such as walking, turning, sit to stand, stand to sit, reaching to the ground to pick or to put down objects on the floor and step an obstacle, this in casual fashion. The database used to test the algorithm was built from the data recorded on the seven participants for a total of fifteen trials; four participants performed three trials of 3, 4 and 5 min and three participants performed one trial of 3 min. Participants were instructed to start sitting on the departure chair. Before the start of recording, participants received instructions to pick at least three objects over the course of one trial, and put them in, or beside designated baskets as if they were doing some cleaning up in their house. The objects were placed strategically to force participants to bend over or reach over their head during the recording. The color of the object was strategically set to be placed on different dispositions (for example: blue objects were all on the floor), and they were asked to put the objects they picked up in a basket that was the same color as the object. This ensured that participants used different paths during the recordings. Also, they were asked to sit down at least once in each of the three chairs strategically located, and remain seated for 5 s before they moved on. Participants were also instructed to walk at a normal pace and to carry only one item at a time. The environment was built to ensure that participants would have to walk a straight line (6 m), step over obstacle, turn around, left and right turns in the simulated living environment (figure 1 (a)).

Algorithm and data analysis process
In the following subsections, we will describe the global algorithm implementation used to detect different tasks, which comprised four main stages/blocks: sensor/variable selection, preprocessing; pattern recognition and segmentation; and task transition detection (figure 1(b)).
Sensor selection and variables. The goal here was to develop algorithms that can automatically detect the tasks from the collected data signals. There are currently no guidelines as to the selection and optimal placement of sensors for such investigations. In this study, the sensors selected for activity detection were based on their correlation with the biomechanics of movement during the activities. The signals of all sensors were first visually inspected and compared against the actual tasks performed. Once the sensor and variable were selected the mother wavelet was chosen by visual inspection to extract the pattern corresponding to the task of interest (see the next subsection). Then, the algorithm was developed and tested, and the performance was averaged between and within subjects for decision-making upon which sensors, wavelet, and variables provided the best performance.
In addition to using the velocity and acceleration profiles of each sensor for the automatic detection and segmentation of the tasks, we used the orientation data originating from the fusion algorithm of the sensors. To do so, quaternions were used to calculate the angles between limb segments. For instance, the angle between the hip and the thigh (hip ROM) or the angle between the thigh and the tibia (knee ROM). To calculate these angles, we used the quaternion output, which is a 4D scalar and vector representation of complex numbers, (1) where w is a real number and v = [x y z] is a vector.
Let q 1 and q 2 represent the quaternions of the hip and thigh respectively and q rel defines the relative quaternion between these two segments, then To track the relative changes of a quaternion during the tasks performance, a reference quaternion, q ref , was taken at the start of each trial. The change in the quaternion was defined as Post-processing algorithms were applied to q ∆ to ensure small angle representation and continuity in the signal by using a moving average filter. The range of motion of the hip was calculated by taking the real part of the inverse cosine of the quaternions.
Using these variables (velocity, acceleration and orientation data), we were able to get a first impression on which output signals are more useful than others. For instance, walking detection algorithm was developed using one of the sensors placed on the leg (either thigh, shin or foot). Then, we tested the sensors one by one in the three directions (3 D-XYZ) by changing and adapting the algorithm parameters in order to get the optimal parameter set that provided us the best detection performance. The same methodology was adopted for all tasks. The selected sensors to automatically detect the different ADL tasks (Sit-Stand, Walking, Release_down, Reach_ground, Reach_down_chair, Step_over_Obstacle, Reach_up, Release_mid, Turn_left and Turn_Right) are shown in table 2.
Preprocessing. Once the pertinent sensors were selected, DWT was applied as a preprocessing step to minimize the noise that contaminated the signal acquired from the sensor and put in evidence the waveforms corresponding to different tasks. The wavelet transform is an extension of classical Fourier transform. Instead of working on a single scale (time or frequency), it works on a multi-scale basis. A very common discretization of the continuous wavelet transform, which is very redundant representation, consists of setting the scale s and shift value τ as: s 2 j = and k 2 j τ = ⋅ . Therefore, the DWT or a dyadic orthonormal wavelet transform of a signal x(t) is defined by: where t ( ) ψ is called the 'mother wavelet', the asterisk denotes complex conjugate, j k , Ζ ∈ are linked to the scaling parameters of t ( ) ψ ; k is indicating time localization and j is indicating frequency localization.
In the present study, DWT analyses were performed with MATLAB (Wavelet Analysis-Toolbox). We used a multi-resolution decomposition of signal X[n] using filter banks techniques (Mallat 1989). At each level of decomposition, approximation A i and detail D i coefficients are obtained by filtering the signal approximation from the previous level with the two filters (highpass g [.] and low-pass h [.]). This process is continued up to the level we required, and depending on the dominant frequency components of the signal, as shown on figure 2.
Decomposition level and wavelet selection. The wavelet analysis can be thought of as a search over the pattern of interest, throughout the signal, that most clearly approximates the shape of the wavelet. Thus, the obtained wavelet coefficients describe the similarity between the waveform, contained in the signal, and the wavelet at a given combination of wavelet's scale (decomposition-level), and its position throughout the signal. The choice of desired level of decomposition depends on required frequency components available in the wavelet coefficient at that level, and on the dominant frequency components of the signal. In accordance with Nyquist's rule, if the original signal has a highest frequency f max , it requires a sampling frequency f s = 2f max . Hence, at each decomposition level j, the frequency axis is recursively divided into halves at the ideal cut-off frequencies. Since the signals acquired from the IMU device were sampled at 60 Hz, the range of real frequency components of the signal was located between 0 and 30 Hz. In such studies, the major energy band for daily activities ranged between 0.2 and 20 Hz (Bouten et al 1997, Mathie et al 2003, 2004, Nguyen et al 2015. The frequency corresponding to each detail level is summarized in table 3. In this study, the mother wavelet was chosen by visual inspection among a catalog of wavelets by selecting the one that more closely resembles the shape of typical waveform, and which allows us to put in evidence the waveform template corresponding to each specific task, when this latter is executed. For instance we selected: Daubechies-1 to detect Sit_Stand, Coiflets-5 to detect Walking, Step_over_obstacle, Reach_Up and Reach_mid. Discrete Meyer (dmey) to detect Reach_Ground and Turn_left/right.
To illustrate what have been evoked above, it can be seen from figures 3 and 4 that if we choose the fifth level of decomposition, the resulting waveforms will be distorted, and the patterns corresponding to Reach_Ground and Sit_Stand tasks are put in evidence: sharp edges (see figure 3) and square form (see figure 4), respectively. This is because these kinds of ADL tasks have a low frequency oscillation mode, which are mostly represented, based on the multi resolution analysis, by the wavelet coefficients computed at the high order of decomposition level.
Pattern detection and segmentation. In the following, we describe the details and steps of the algorithm used to detect the Release_Down task, from which we derived the algorithm used to detect the remaining other tasks by specifying the parameters that differ from the first one. It is important to point out here, that the remaining algorithms share the same principle/steps except at the decision-making step.
To detect Release_Down, as described in the flowchart figure 2, the signal from the inertial sensors was first preprocessed by wavelet-based denoising to reduce the unstructured noise level and put in evidence the template. Then, the denoised signal was detrended to remove sensor drift and normalized against the absolute maximum amplitude of each signal to ensure uniformity in the analysis across all participants. Thereafter, the signal of interest was transformed through the detection stage, which includes two distinct steps: Step 1: the de-noised signal was passed into a nonlinear transform constructed by a moving window integration system and a squaring operation, expressed as follows:  (6)). The pulses (−1, 1) indicate the task on-set and task offset, respectively. where h n 1 ( ) is referred to as the feature signal and K represents the summation interval. The nonlinear transform can be alternatively viewed as nonlinear envelope detector and it produces pulse train-like feature waveforms. However, the width should be appropriately selected 2) with the kinematics pattern of the task (right). Bottom right: final feature signal obtained after wavelet denoising and nonlinear transform process (equation (6)). The pulses (−1, 1) indicate the task on-set and task offset, respectively.  (6)). The pulses (−1, 1) indicate the task on-set and task offset, respectively. so the summation waveform will not be a result from merging of the two distinct waveform events, if it is too narrow, some waveforms will produce several peaks. These can cause difficulties in subsequent event detection process. In fact, this width should be determined in accordance with the sampling rate of the original signal. The width of the window (summation interval K) is determined empirically. For our sample rate of 60 Hz, the window is 10 samples wide (160 ms).
Accordingly, the peak level of the nonlinear transform output corresponding to an event is expected to be significantly enhanced, while those corresponding to the undesired noise peaks, as well as the baseline wander, should be relatively attenuated, as illustrated in figure 2.
Afterwards, the signal is multiplied by , which represents the inverse of the flag obtained from the detection process, Sit_Stand (described in the next subsection), using the accelerometer placed at the trunk. This put to zero the segment corresponding to the Sit_Stand task occurrence, and allows us to reduce the confusion in the detection between Sit_Stand and the task cited above that have in common a behavior of flexion/extension of the knee joint and hip to perform the tasks.
Step 2: consists of decision-making for an event. An adaptive thresholding scheme is applied to the feature waveform, generated from the NLF stage. It can be formulated as: where Threshold denotes the adaptive threshold incorporated into the decision rule in equation (7) updated by (Chen and Chen 2003): where PEAK is the local maximum newly detected in the feature waveform and b 0.1; 0.8 [ ] ∈ is a weighting factor used for determining the contribution of peak values to threshold adjustment. a 0; 1 [ ] ∈ is referred to as the 'forgetting factor' (Chen and Chen 2003). These para meters were chosen empirically by using data and were adjusted during the development phase according the behavior of the participant and how the task was performed. The initial conditions (at i = 0) i Threshold 1 0 ( ) − = . According to equation (8) it can be seen that each new value of the threshold is determined from the running estimate of the feature signal peak as well as the prior and current values of the threshold itself. The waveform is considered as an event, only if the peak level of the feature signal exceeds the threshold. The value of the threshold is then updated each time when a new pattern is detected. The appearance of the output in each stage of this task detection algorithm is shown in figure 3.
Once the peak segment were selected, the transition points were identified by detecting the stamp of the first minimum or maximum to the left and right of the segment peak, which marked the onset and end of task segment. The data segmentation stage identifies those segments of the preprocessed data streams that are likely to contain information about activities. Each data segment W t t * , is defined by its start time t 0 and end time t 1 within the time series. The segmentation stage yields a set of segments W * containing a potential activity Y: Tasks transition selection. At the final step, the transition of the tasks was determined by generating a rectangular function t ( ) π (which has the same length of original signal), where we put to zero all the values which are outside the intervals defined by the transition points in the previous step (the null values indicate no-tasks). Subsequently, this function was derived and normalized to get a flag with: (+1) corresponds to the onset of the task and (−1) the end of the task.
As evoked previously, the same principle described above was applied to detect the remaining other tasks, except at the decision-making step, we have the following points.
• Reach_Down_Chair: we preselected the peaks that value is lower than 4 PKs σ ⋅ , where PKs σ is the standard deviation calculated upon the detected peaks, see figure 2. • Reach_Ground: we selected the peaks that value is higher than 50% of the signal maximum value, see figure 2. • Sit_Stand: the acceleration signal (a z , Trunk ) is processed by following the same algorithm except for the second term of equation (8), Threshold(i − 1), is replaced by mean value computed over all the detected peaks (mean(Pk(n))). Then we kept the value of the signal upper than Threshold and we put to zero the remaining ones, see figure 3. • Step_Over_an_Obstacle: the second term of equation (8), Threshold(i − 1), is replaced by the standard deviation value computed upon the detected peaks (2 PKs σ ⋅ ), see figure 4. • Walking: to detect walking the angular velocity (ω x, Shin ) signal was transformed, following the same method described above, the second term of equation (8), Threshold(i − 1), is replaced by median value computed over all detected peaks (median(Pk(n))). Afterwards, as described in figure 5, we compute the adjacent peak distance, then we select the peaks which Adj_Pkd > 80 samples, we put to zero the values which are within the interval between the Pk(i) and Pk(i − 1). • Release_Up and Relase_Mid: as shown in figure 6, the signal is fused by computing the maximum envelop of the signal acquired from the DWT stage. Then, we follow the same method described above; the fused signal is transformed, using the equation (6), to enhance the peak amplitude corresponding to the event. Then for decision-making, the task Reach_mid, we selected the peaks that value is less than 4 PKs σ ⋅ , where PKs σ is the standard deviation calculated upon the detected peaks, see figure 6. For tasks Reach Up, we selected the peaks, within the whole time series, that value is higher than 20% of the signal maximum value. • Turning_Left/Right: the denoised signals (left/right-Tigh: w y (t) (deg s −e )), is fused by applying a nonlinear transform constructed by a moving window integration system, given by: • and • have the same sign.
where the feature signal h 2 (n) is the NL envelope detector. It represents the inner product between the signals S • 1 ( ) and S • 2 ( ), within the interval defined by the K parameters, Only if the signals have the same sign, otherwise it equal to zero, see figure 7. Afterwards, to detect Turning_Left we computed the positive extrema of the signal h 2 (n), then the decision-making for waveform event detection was performed by the thresholding process as described above, using the equations (7) and (8). The same principle was used to detect Turning_Right except that in this case, the extrema were computed from the negative part of the signal h 2 (n).

Statistics and performance evaluation
In order to assess the performance of the detection algorithm, recordings were visually segmented to obtain time stamps (the gold standard) corresponding to the initiation and termination of each sub-tasks by one investigator. The video records were used to determine which tasks a participant performed at moment t t t , Then, the avatar provided by the Animazoo software was used as a second step during the visual segmentation with the aim of finding the frame number (samples) of the t interval boundaries exactly, for more accurate segmentation. Typically, we have a set of L sensors/signals, Using the visual segmentation, the signal X n l ( ) was segmented  (6)). The pulses (−1, 1) indicate the task on-set and task offset, respectively. Release_mid and Release_Up detection algorithm. The output in each stage of the detection algorithm with the kinematic pattern of the task Release_Up (right). The final feature signal obtained after wavelet denoising, data fusion of the data acquired from the sensors at the right and left side and nonlinear transform process (equation (6)). The pulses (−1, 1) indicate the task on-set and task offset, respectively.
to obtain the ground-truth on timing of subtasks. Each data segment W i = (t 0 , t 1 ) is defined by its start time t 0 and end-time t 1 within the time series. The time stamps for each sub-tasks, was used as the ground truth to validate the algorithm and verify the detection results of the proposed method. The segmentation stage yields a set of segments W i containing a potential activity Y: W W W W , , . For each segment W i , we are also provided with a label C Event that will describe which class object (sub-task) the W i belongs to. In a binary classification task that involves detecting event (e.g. walking), C 1 Event = corresponds to event occurrence, and C 0 Event = to no event.
To evaluate the performance of the proposed algorithm, we computed the sensitivity (Se TP TP FN . / 100% ( ) = + × , effectiveness of the algorithm to identify positive labels) and the specificity (Sp TN TN FP . / 100% ( ) = + × , effectiveness of the algorithm to identify negative labels) of the detection algorithm, we extracted from the detection results the values of: the true negative (TN)-the number of objects (time-segments) with C * 0 Event = that are classified as C 0 Event = (the participant was not walking or/and he was performing other task). False positives (FP) represent the number of falsely detected events; false negatives (FN) indicate failure of algorithm to detect an event, and true positives (TP) are the number of correctly detected events. Following the same principle of validation proposed in (Nguyen et al 2015), these measures were determined by the decision-making rule that a pattern (peak segment corresponding to an event) is true when it is detected within the interval defined by the time stamps of the sub-tasks, which is provided by the visual segmentation process.
To compute the sensitivity and the specificity of the proposed approach, each trial of each subject was processed independently. Two subjects were used to develop the algorithm and set the parameters of the adaptive thresholding process. Then the algorithm was tested on the remaining subjects. Since subject performed 3 trials and there were 7 subjects in total, the development database consisted of 1 trial in within-subject cross validation and 2 (1 times 2) trials in subject-independent cross-validation. The final feature signal obtained after wavelet denoising, data fusion of the data acquired from the sensors at the right and left side and nonlinear transform (equation (9)) process. The pulses (−1, 1) indicate the task on-set and task offset, respectively.

Results
The proposed algorithm to detect events associated with ADLs was tested on data from the seven participants for a total of 15 trials; four participants performed three trials (3, 4 and 5 min) and three participants performed one trial (3 min). The 15 trials comprised 75 min of recording that generated a total of 1999 distinct events (sub-tasks) to be detected. Table 4 presents the average value of the performance results for different subjects, over different trials. As indicating in table 5, the proposed algorithm exhibited a noteworthy high global sensitivity and specificity; (number of events (N) = 1999, Se. = 97.5%, Sp. = 93.6%), even though the variation in the occurrences of the performed 10 tasks (freely moving). The Se. varied from 94% to 100% for all the detected ADL tasks and Sp. ranged from 90% to 100% with the worst Sp. = 85 and 87% for Release_mid and Turning_Left tasks, respectively.

Discussion
The objective of this study was to develop an algorithm for automatic detection and segmentation of tasks related to ADL using body worn IMUs. We were able to identify the most pertinent sensors (number and location) to detect with high accuracy the tasks at hand. In fact, each task required one or two sensors (at most two sensors/task), but differed in their location depending on the task performed using DWT and adaptive thresholding, we were able to generate different template waveforms that corresponded to different ADL tasks. This allowed us to easily detect and segment more complex tasks. Furthermore, this process reduced the inter-variability between participants by automatically modifying the threshold (auto-adaptive strategy for peaks selection) based on their behavior to increase detection accuracy. Indeed, such variability occurs because the same activities were performed differently depending on the circumstances, and also by different individuals.
In term of the obtained results compared to the literature, some of the activities achieved classification accuracy of 100% in our study. For instance, the ability and the performance of our algorithm to auto-segment and detect the task Sit-Stand was above those previously reported by Moncada-Torres et al (2014) (sit to stand at 86% and 80%, respectively), Godfrey et al (2011) (sensitivity and specificity of 83%) and Najafi et al (2003) (accuracy > 95%). For continuous turning detection algorithm, Novak et al (2014) showed that turn onset can be most accurately detected, accuracy upper than 85%, with sensors on the back and using combination of orientation and angular velocity. El-Gohary et al (2013) validated turning algorithm using IMUs at the pelvis. They compared motion analysis with video and an algorithm. They obtained a sensitivity of 90% and 76% and specificity of 75% and 65%, respectively. These are somewhat lower than our results (average sensitivity 94% and specificity of 93%). In a recent study, our group (Nguyen et al 2015) achieved an accuracy of 100% for turns with 180 degree using two sensors placed at the trunk and hip during a TUG. Yet this represented a simple framework where the tasks were well-defined and accomplished in a controlled environ ment where turns were 180 deg in amplitude. This is unlike the present study where the tasks were performed by participants in a continuous and free fashion, and cwhere the ampl itudes of the turns varied during the trial. It is important to point-out that, if we would have considered only the turns with amplitudes above 45 degrees, the detection performance of our algorithms would have exceeded 98% of specificity and sensitivity.
Compared to other methods such as k-nearest neighbor (Moncada-Torres et al 2014), artificial neural network (Giansanti et al 2008) and support vector machine method (Chernbumroong et al 2013) where training data is required and more computationally intensive classification/ segmentation is required, our proposed method achieved high detection accuracy using few features such as peak detection, and did not require a learning process for detection and segmentation.
Additionally, the algorithm was significantly faster in detecting and segmenting the subtasks than visual segmentation. For example, it took 3-5 h to visually identify and segment a 3-5 min of unscripted tasks. Using this method, we can identify and segment the 10 tasks, presented previously, within less than 60 s per subject. This represents a huge gain in time of segmentation process, which would enable the specialist to handle large volumes of data for monitoring and medical diagnosis of patients. Finally, although the algorithm achieved high performance for the Sit_Stand, Walking, Reach_Ground, Step_the_Obstacle and Reach_Up for most records, we acknowledge some limitations of the proposed approach with times series generated by some participants during Turning_Left and Turning_Right. These lower than expected results could be attributed to how participants performed turning, as they turned with a smooth motion while other turned more abruptly. Furthermore, acute turning angles (45°) during reaching, might affect the reliability of the proposed thresholding method.
For Reach_Down_Chair task, we noticed some confusion with specific similar tasks, namely Released_Down and Reach_Ground. These explain the number of false positives compared to the remaining tasks. This is due to the fact that ROM-angle between the hip and left/right thigh is similar to the feature obtained during the Released_Down task. Moreover, we noted that the number of false positives was more pronounced during the Reach_mid task detection; this is due principally to the similarity in the kinematic behavior of the angle between the left/right collarbone and upper arm of the participant during Reach_mid with the other performed tasks, namely Reach_Up, Turning_Left/Right and Step_over_Obstacle. For example, we observed that the participant raised his/her arm to maintain balance during Step_over_Obstacle task or when he/she performed Turning. Despite these shortcomings, the results presented here represent a major step forward in our ability to automatically detect and segment daily activities.
One limitation of this study is that it relates to ADL performed by healthy aged individuals with no physical limitations that may prevent them from performing the tasks. Future studies will consist to test whether the proposed approaches achieve the same performance, to auto-detect and segmenting the ADL tasks, for individuals with mobility impairments (e.g. Parkinson's disease). Afterwards, such segmentation will be used in the future to assess the performance and the quality of the mobility for the detected tasks.

Conclusion
In this study, we identified body-worn IMU sensors that were strongly associated to different activities and yielded the best results for automatic segmentation of the different tasks. We proposed an approach, using the wavelet-based algorithm in conjunction with a nonlinear transform and thresholding strategy process, which was able to detect the different ADL tasks with a high accuracy. Future studies will challenge those segmentation algorithms by examining mobility of patients with movement disorders. Our final objective is to create a fully automated system for continuous monitoring of ADL tasks using a minimal set of sensors while maintaining very high sensitivity and specificity. Such a system could be used not only for monitoring patients but also for performance evaluation and automatic administration of medication through implanted medical delivery systems.

Competing interests
There were no conflicts of interest to report.

Author contributions
FA developed the algorithm and method to analyze the data as well as the drafting of this manuscript. CLP was responsible for participant recruitment, data collection and revision of the experimental protocol. HN and EG aided in analyzing the data. PB aided in the design of the study and provided significant revisions to the manuscript. CD, the lead scientist, helped in all facets of the project. All authors read and approved the final manuscript.