Hello All,
I hope, every one is okey .
I am trying to predict a gait simulation of a patient. In order to start doing so,I checked examples of prediction studies such as "Example2DWalking.cpp", "exampleSquatToStand.m" and Ross Miller's 3D walking study. All off these example codes include tracking and prediction together. Specifically each code starts with tracking then continues with prediction. At the beginning, I thought that tracking is necessary for only comparing the results but lately I realized that there is a "initial guess" part for each code and this initial guess part requires output of tracking.
So.. my questions are that, Is tracking essential requirement for predicting a gait?, How does this initial guess affect my prediction result ? When I feed different tracking solution or initial guess to the the system, should I expect to obtain same results ?
Best regards,
Burak KULA.
Is There Any Relationship between Tracking & Prediction ???
- Burak Kula
- Posts: 31
- Joined: Wed Dec 04, 2019 3:34 pm
- Simon Jeng
- Posts: 87
- Joined: Fri Sep 07, 2018 8:26 pm
Re: Is There Any Relationship between Tracking & Prediction ???
Hi Burak,
These days I also have the same question and I am thinking why we need to track. I compared the results of tracking solution with the reference and found they are not completely equal. In my opinion, this may because the model is not the same as human. The parameters we initially set in the model cannot let the model reproduce people's motion, and the predicting results may also be wrong. So in order to improve the accuracy of predicting results, we may need to make the model parameters good enough. The tracking result may tell us whether the parameters are good enough.
That is only my guess, waiting for moderators' reply.
Simon
These days I also have the same question and I am thinking why we need to track. I compared the results of tracking solution with the reference and found they are not completely equal. In my opinion, this may because the model is not the same as human. The parameters we initially set in the model cannot let the model reproduce people's motion, and the predicting results may also be wrong. So in order to improve the accuracy of predicting results, we may need to make the model parameters good enough. The tracking result may tell us whether the parameters are good enough.
That is only my guess, waiting for moderators' reply.
Simon
- Carlos Gonçalves
- Posts: 135
- Joined: Wed Jun 08, 2016 4:56 am
Re: Is There Any Relationship between Tracking & Prediction ???
Jumping in the conversation while Moco is running ...
In the last month, I came across this article that was very useful to understand the use of direct collocation to predictive simulation. "Direct Methods for Predicting Movement Biomechanics Based Upon Optimal Control Theory with Implementation in OpenSim" https://doi.org/10.1007/s10439-015-1538-6.
The initial guess is one of the multiple parameters the direct collocation (or shooting method) uses for convergence. The guesses could be very precise, like the result of a tracking simulation, or very poor, like setting the 3 points of the trajectory. I saw it very clearly studying the examplePredictAndTrack.py example available in the OpenSim Moco folder.
For some problems, the guess could be very simple, or even inaccurate, but for gait, it is very important to give the tool a feasible starting point. In all the articles about gait prediction with direct collocation that I read, there is an initial guess from a patient or reference base. In this example (https://www.linkedin.com/posts/carlos-g ... 64768-lb4r) I didn't even use a guess.
I totally recommend looking at the examplePredictAndTrack.py example and trying to generate other paths for the double pendulum. By the way, the guess should follow the bounds and goals that are set in the Moco problem.
Hope it could help.
Best regards.
Carlos
In the last month, I came across this article that was very useful to understand the use of direct collocation to predictive simulation. "Direct Methods for Predicting Movement Biomechanics Based Upon Optimal Control Theory with Implementation in OpenSim" https://doi.org/10.1007/s10439-015-1538-6.
The initial guess is one of the multiple parameters the direct collocation (or shooting method) uses for convergence. The guesses could be very precise, like the result of a tracking simulation, or very poor, like setting the 3 points of the trajectory. I saw it very clearly studying the examplePredictAndTrack.py example available in the OpenSim Moco folder.
For some problems, the guess could be very simple, or even inaccurate, but for gait, it is very important to give the tool a feasible starting point. In all the articles about gait prediction with direct collocation that I read, there is an initial guess from a patient or reference base. In this example (https://www.linkedin.com/posts/carlos-g ... 64768-lb4r) I didn't even use a guess.
I totally recommend looking at the examplePredictAndTrack.py example and trying to generate other paths for the double pendulum. By the way, the guess should follow the bounds and goals that are set in the Moco problem.
Hope it could help.
Best regards.
Carlos
- Ross Miller
- Posts: 375
- Joined: Tue Sep 22, 2009 2:02 pm
Re: Is There Any Relationship between Tracking & Prediction ???
Hi Burak,
There is no technical reason that the initial guess for a predictive simulation needs to be a tracking solution. I think tracking solutions are used often as initial guesses because (i) for optimization routines with constraints, it often helps to start with guesses that don't have large constraint violations, and tracking solutions are a convenient source for that, and (ii) often for motor control research questions we are interested in seeing if predictive simulations at least roughly resemble a tracking solution, e.g. is the minimum-cost gait very far downhill from the cost of the tracking solution, or is it pretty close?
I've always found predictive simulations take longer (more iterations) than tracking simulations. Not sure why this is, technically.
Ross
There is no technical reason that the initial guess for a predictive simulation needs to be a tracking solution. I think tracking solutions are used often as initial guesses because (i) for optimization routines with constraints, it often helps to start with guesses that don't have large constraint violations, and tracking solutions are a convenient source for that, and (ii) often for motor control research questions we are interested in seeing if predictive simulations at least roughly resemble a tracking solution, e.g. is the minimum-cost gait very far downhill from the cost of the tracking solution, or is it pretty close?
I've always found predictive simulations take longer (more iterations) than tracking simulations. Not sure why this is, technically.
Ross
Re: Is There Any Relationship between Tracking & Prediction ???
Hi All,
Thought I'd chip in here too with some recent experience trying to run predictive simulations of gait using Moco. I've found, as others have alluded to in this thread, that an accurate initial guess (typically from a tracking sim) provides that appropriate starting point for your predictive simulations. As a contrasting example - I tried providing quite stringent goals on a predictive gait simulation (e.g. bounds, periodic trajectories etc.) without an initial guess, and found that the model just didn't know what to do/where to start, resulting in non-convergence or a strange movement pattern. My loose way of describing this is that the good initial guess seems to provide bit of a framework or a general idea for the model to work from in the predictive simulations (i.e. like a demonstration). I think there are some implications for this though in looking at the results of your predictive simulation - in that the initial guess can have a large influence on what your predictive simulation looks like. If there are 'flaws' in the way your initial guess moves or control strategies - then these might impact on the 'optimal' solution of your predictive simulation, right? Recently I've wondered how the reinforcement learning approach might differ to predictive simulations - so if anyone has any comment on that it would be great.
Aaron
Thought I'd chip in here too with some recent experience trying to run predictive simulations of gait using Moco. I've found, as others have alluded to in this thread, that an accurate initial guess (typically from a tracking sim) provides that appropriate starting point for your predictive simulations. As a contrasting example - I tried providing quite stringent goals on a predictive gait simulation (e.g. bounds, periodic trajectories etc.) without an initial guess, and found that the model just didn't know what to do/where to start, resulting in non-convergence or a strange movement pattern. My loose way of describing this is that the good initial guess seems to provide bit of a framework or a general idea for the model to work from in the predictive simulations (i.e. like a demonstration). I think there are some implications for this though in looking at the results of your predictive simulation - in that the initial guess can have a large influence on what your predictive simulation looks like. If there are 'flaws' in the way your initial guess moves or control strategies - then these might impact on the 'optimal' solution of your predictive simulation, right? Recently I've wondered how the reinforcement learning approach might differ to predictive simulations - so if anyone has any comment on that it would be great.
Aaron
- Tyler Morrison
- Posts: 9
- Joined: Wed Nov 06, 2019 7:00 am
Re: Is There Any Relationship between Tracking & Prediction ???
I think we could have a very long and productive thread discussing this question. I thought I would just add a few of my own thoughts -- as much so I can organize them as to contribute to the discussion.
The central question in optimization (and that is what gait prediction is based on -- optimization) is, when your problem has converged to a solution, is this solution the global optimum or simply a local optimum that the algorithm got stuck at? Some optimization problems make it hard to get to the global optimum, some are easy, and some even have closed form solutions (really easy). In fact, it is really only the hard problems that are interesting research problems. The easy problems get solved quickly. However, there is a relatively trivial way to ensure that -- even for hard problems -- we find the global optimum and that is to start with an initial guess that is 'near' to it. This sounds silly because it is. If we knew where the global optimum was, we wouldn't have to solve the optimization problem to find it.
So basically, if we want to generate a predictive gait as a result of minimizing effort/energy/etc., a sufficiently good initial guess can ensure that we actually get to a global optimum and help us get there in fewer iterations.
The benefits of a good initial guesses can be broken in two parts: feasibility and optimality. A feasible initial guess satisfies the initial constraints (periodicity, range of motion limits, etc.). Given that tracking data comes from observed successful walking gaits, we can usually be pretty confident that it satisfies, or very nearly satisfies, the constraints that we used to define successful walking in our optimization problem.
Next, is optimality. One of the core hypotheses of gait prediction is that humans walk optimally -- minimizing some sort of effort or cost to produce an optimal behavior. By using an initial guess from tracking data, we are assuming that the human generated that gait by optimizing a problem similar to ours -- with similar cost and constraints and therefore the optimum to their problem is probably close to ours. And yet, it is never exactly the same is it?
This seems to expose a contradiction. We believe we can predict gait because we believe humans solve an optimization problem in determining their gait and that we can replicate that optimization problem in our model. However, if that were completely true and our model was totally accurate, when starting our predictive gait algorithm from an initial guess from tracking data, our problem would converge immediately and spit our initial guess right back at us. The fact that this doesn't normally happen seems to expose a contradiction as it implies our model or our problem formulation does not match reality which contradicts the premise.
But this doesn't invalidate the whole approach. First of all, there is measurement error and random variation in tracking data that perturbs the observed gait data from optimality. Second, there is substantial behavioral variation in humans. Next, improving the correspondence between predicted gaits and observed gaits is a fruitful method for us to improve the fidelity of our models of biomechanics and behavior. Finally, sometimes the problem we aim to generate predicted behavior for is one which is difficult or impossible to replicate experimentally. In that case, we may use tracking data where humans walk or move under slightly different conditions than those in our problem and assume that the optima are similar enough that the tracking data is still a good initial guess. For example, we could predict gaits for running on a soft (low stiffness) surface without collecting data on such a surface by using tracking data from normal treadmill running as an initial guess.
Anyway, those are some of my thoughts on the topic. Some of these assumptions are debatable in and of themselves. For example: do humans really walk at a global optimum? Perhaps sometimes our behavioral optimization process gets stuck at local optima too.
I think the goal would be to eventually, consistently produce accurate gaits without tracking data. This is actually possible. You can converge the 2D tracking example from a random initial guess with enough iterations and for some random guesses. But it doesn't work every time and for every problem -- especially as they get harder and more complex.
The central question in optimization (and that is what gait prediction is based on -- optimization) is, when your problem has converged to a solution, is this solution the global optimum or simply a local optimum that the algorithm got stuck at? Some optimization problems make it hard to get to the global optimum, some are easy, and some even have closed form solutions (really easy). In fact, it is really only the hard problems that are interesting research problems. The easy problems get solved quickly. However, there is a relatively trivial way to ensure that -- even for hard problems -- we find the global optimum and that is to start with an initial guess that is 'near' to it. This sounds silly because it is. If we knew where the global optimum was, we wouldn't have to solve the optimization problem to find it.
So basically, if we want to generate a predictive gait as a result of minimizing effort/energy/etc., a sufficiently good initial guess can ensure that we actually get to a global optimum and help us get there in fewer iterations.
The benefits of a good initial guesses can be broken in two parts: feasibility and optimality. A feasible initial guess satisfies the initial constraints (periodicity, range of motion limits, etc.). Given that tracking data comes from observed successful walking gaits, we can usually be pretty confident that it satisfies, or very nearly satisfies, the constraints that we used to define successful walking in our optimization problem.
Next, is optimality. One of the core hypotheses of gait prediction is that humans walk optimally -- minimizing some sort of effort or cost to produce an optimal behavior. By using an initial guess from tracking data, we are assuming that the human generated that gait by optimizing a problem similar to ours -- with similar cost and constraints and therefore the optimum to their problem is probably close to ours. And yet, it is never exactly the same is it?
This seems to expose a contradiction. We believe we can predict gait because we believe humans solve an optimization problem in determining their gait and that we can replicate that optimization problem in our model. However, if that were completely true and our model was totally accurate, when starting our predictive gait algorithm from an initial guess from tracking data, our problem would converge immediately and spit our initial guess right back at us. The fact that this doesn't normally happen seems to expose a contradiction as it implies our model or our problem formulation does not match reality which contradicts the premise.
But this doesn't invalidate the whole approach. First of all, there is measurement error and random variation in tracking data that perturbs the observed gait data from optimality. Second, there is substantial behavioral variation in humans. Next, improving the correspondence between predicted gaits and observed gaits is a fruitful method for us to improve the fidelity of our models of biomechanics and behavior. Finally, sometimes the problem we aim to generate predicted behavior for is one which is difficult or impossible to replicate experimentally. In that case, we may use tracking data where humans walk or move under slightly different conditions than those in our problem and assume that the optima are similar enough that the tracking data is still a good initial guess. For example, we could predict gaits for running on a soft (low stiffness) surface without collecting data on such a surface by using tracking data from normal treadmill running as an initial guess.
Anyway, those are some of my thoughts on the topic. Some of these assumptions are debatable in and of themselves. For example: do humans really walk at a global optimum? Perhaps sometimes our behavioral optimization process gets stuck at local optima too.
I think the goal would be to eventually, consistently produce accurate gaits without tracking data. This is actually possible. You can converge the 2D tracking example from a random initial guess with enough iterations and for some random guesses. But it doesn't work every time and for every problem -- especially as they get harder and more complex.