DOI: 10.1051/bioconf/20110100057 © Owned by the authors, published by EDP Sciences, 2011 Filtering Motion Data Through Piecewise Polynomial Approximation

In this work we propose a system to filter human movement data and store them into a compact representation. We are interested both in noise reduction and in segmentation. The method described in this paper relies on a iterative optimization and guarantee to converge to a local optimum: it proved anyway to produce stable results and to provide an accurate segmentation on the analyzed data . We analyze the Three ball cascade Juggling as case study: This provides us the challenge to represent both low-pass dynamics of human limbs and juggled balls and the discontinuities produced by contact forces.


Introduction
In this work we propose a system to filter human movement data and store them into a compact representation.In particular we thought this system to filter data from three ball juggling as a first step into the modellization of juggling skills with the perspective of evaluating users performance and design a digital system for the transfer of skills [3].The three ball cascade pattern that we are analyzing into the following sections, as the ball juggling patterns in general, is described by a low frequency signals, the trajectories of hands and balls including high frequency signals as results of tosses and catches.
This exercise summarizes several recurrent elements in sport performances, such as the interaction between human limbs and accessories that should both be tracked to analyze the action, the presence of smooth movements as well as discontinuous actions due to hits.Human movements can be tracked in several ways: optical tracking with and without markers (i.e. the VICON system), different kind of tracking systems directly applied to user's body such as accelerometers (i.e shake) or electromagnetic devices (i.e Polhemus).In any case the analysis of human movements requires to extract significant features from a great volume of data often affected by some kind of noise: the general purpose of the proposed approach is to clean data from noise and to get a description that aids the analysis.
The usual filtering for human movement data consists in a two-way filtering through a low-pass Butterworth filter.To implement this filtering method a normal Butterworth filter is first applied to the signal, then the result is filtered again with the same filter but counter wise in time.The resulting filtering process is equivalent to the application of a non-causal filter with twice the order of the original Butterworth with zero phase response.Although the use of this filter has been well known in literature an analysis of the results it produces on juggling signals reveals some problems: • The response of the filter to step signal features several overshoots that creates artifacts in the signal close to discontinuities and under the effect of noise • The discontinuities in signal (or its derivatives) are destroyed by the smoothing effect of the low pass filter.
Should be noted that extending the pass-band of the filter reduces the latter effect but worsen the former [4], and vice versa.Desirable features for a filtering system would be: • reconstruction of smooth signal accurate reconstruction of discontinuities • and besides this representation methodology could also represent a tool to compress data preserving meaningful information.
A method based on the representation of signals as a set of polynomials have been developed.The signal is divided into several chunks that are approximated, through minimization of quadratic error by a polynomial of order N.The order of the approximating polynomial is set by the user as a parameter, the number of chunks and their bounds is adjusted iteratively by an algorithm designed to optimize them according with the loss function: Where is the quadratic error over the whole signal and M is the number of chunks the signal has been divided in, K is a regularization factor.The algorithm works iteratively assuring a decrease of the loss function at each step, this cannot avoid local suboptimal minims.The method is applied to mono-dimensional signals, components of a vector signal such as position are to be processed separately.

Generalization of the Concept of Phase
An important feature that should be preserved during the analysis of movement patterns is the phase between different variables, hence the representation should not alter it.The definition of phase, in the context of human movement analysis can vary: e.g. the three ball cascade juggling, that we are analyzing in section 3, is cyclic pattern, in general not strictly periodic.We can generalize the concept of phase between signals in several ways: e.g.considering the instant phase between two non periodic signals through Hilbert transform [2] or assume signal periodicity and measure the displacement in time between the periods in two samples (the concept of period should be generalized to be computed locally or else to take in account an average over all the cycles into the signal).We will see how the proposed method, preserving and recognizing signal discontinuities, will make data segmentation easier and hence fit with the latter approach to phase generalization.

Overview
The methods described in this report consist into an approximation of the signal through a set of polynomials, each one approximating a chunk of the signal between two knots.This is not a spline: discontinuities are allowed on the knots and the approximation in each chunk is not affected by other chunks.

Parameters, Data and Objective Function
The order of the interpolating polynomials O must be set at the beginning and it is not changed The number of chunks is not defined a priori, it is optimized by the algorithm The position of the knots defining the chunks is optimized by the algorithm The loss function minimized during the optimization is the sum of the square error (square root of the sum of squared residuals) and the number of chunks multiplied by a scaling factor K set by the user that acts as a regularization term.Being f (t) the original signal, f (t) the filtered one, ti the time the i th sample has been sampled and N k the number of knots the loss function can be expressed as:

Optimization Algorithm
The algorithm can be summarized into the following steps:

Notes on the Algorithm
The filtering function can be expressed by the knots set and the polynomials coefficients.In this sense the algorithm gives a compact representation of the filtered signal.The expression 'for each knot' in the previous explanation means that an operation is applied to each node separately in a given order (from left to right).In general the order nodes are optimized can lead to different solutions (local minims).In practice, on three ball cascade juggling the algorithm showed a convergence to the same solution even when the signal was reversed.At each iteration of the algorithm the loss function is improved or keeps the same value this gives sense to the stop condition based on the modulus of the improvement (step xi.)In the general case the order can affect the solution found by the algorithm.On juggling data the knots happened to converge likely to catches and tosses points The choice of the regularization parameter K affects sensibly the result.So far it should be tuned making some trials and comparing the number of expected discontinuities in the signal or/and its derivatives with the number of thresholds obtained.
There are other known techniques to approximate a function with piecewise polynomial presented in literature as general methods such as e.g.moving knot splines.The described method rose in the context of gesture analysis to address the practical issues explained through the introduction: while we can expect that this nonparametric method can be unsuitable in the general case the aim of this paper is to evaluate it in this specific context.

Case Study
We sampled the movement of a juggler performing the 3 ball cascade together with the positions of the juggled balls.we used the VICON optical tracking system at 100Hz sampling rate.We chose K = 100 and O = 2.As example we considered the results obtained on the vertical component of balls trajectory: excluding the first and the last nodes that are The International Conference SKILLS 2011 fixed, the nodes happened to lie on the discontinuity produced by the tosses and hits with the juggler hand (the trajectory of the flying ball was fit, correctly, with a parabola) and in the middle of the trajectory forced by the user that was hence represented by two parabolas.since each parabola is described by 3 parameters, the trajectory was represented by 9 parameters for each toss/catch/return cycle.

Conclusions
We presented a filtering and compression algorithm for human movements, thought for the analysis of task such as sports featuring the low pass dynamics of human limbs together with some high pass components produced by hits.The algorithm guarantees a convergence to a locally optimal solution assuring the improvement of the cost function at each step.Besides this, the algorithm proved to produce stable results on real data suitable to be exploited also for segmentation.

Future Improvements
As we described the algorithm finds the solution operating 'locally'.In practice the knots are adapted one by one, given the positions of the others, to minimize the loss function.The addiction or the removal of a knot is particularly critical: it is performed just in case it produces directly an improvement into the loss function.It is worth to consider more accurate policies to search the optimal number of knots.The code works just on mono-dimensional data.A vectorial signal should be processed component by component.Considering that the discontinuities, due for example in catches in ball juggling, should happen simultaneously to all the components.The results using the same knots for all the signal components should be investigated.The current implementation assumes that the data comes as an array of samples sampled with constant sample rate.The polynomials are fitted to use the index of the array as variable.Adding an an array of sample times would improve the versatility of the software.The code can be organized as a library to be easily adapted to different kind of analysis.An interface to apply it directly to data from database [1] should be developed.

Figure 1 :
Figure 1: Step signal filtered forward and reverse with a fourth order Butterworth filter.Notice the overshoot.
i. Define the order of the approximating polynomials O ii.Define the regularization parameter K iii.Define a set of knots.The number of knots Nk will change during the execution iv.Compute the approximating polynomial over the chunks of signal defined by the knots v. Compute the cost function L (2) vi.For each knot: remove it if it produces an improvement into the cost function vii.Compute the cost function L BIO Web of Conferences viii.For each chunk: split it if it produces an improvement into the cost function ix.Compute the cost function L x.For each knot: move it into the position that minimizes the square error and hence loss function xi.If the modulus of the improvement of the cost function is under a given threshold then STOP xii.Repeat from step iv.

Figure 2 :
Figure 2: Adaptation of knot number and position through five steps.The original signal, plotted in green, consists in a step function followed by a linear and a parabolic ramp, perturbed with an uniform distributed white noise.The approximated signal is displayed in red, knots are displayed as blue hexagrams.

Figure 3 :
Figure 3: position of a juggled ball and its first two derivatives