Skip to content

Commit 8763039

Browse files
committed
first submission
1 parent d6c001e commit 8763039

10 files changed

+26
-22
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,25 @@ external forces from kinematics, ii) predicting the influence of gait modificati
99
experiments, and iii) predicting comprehensive kinematics and kinetic changes that occur with increasing running
1010
speeds.
1111

12-
## Corresponding Publication
13-
This repository includes the code and models for an [abstract](./figures/readme_fig/Tan_ASB2024.pdf).
14-
Full-length preprint is coming soon.
15-
1612
## Environment
1713
Our code is developed under the following environment. Versions different from ours may still work.
1814

1915
Python 3.9.16; Pytorch 1.13.1; Cuda 11.6; Cudnn 8.3.2; numpy 1.23.5;
2016

21-
## Dataset
22-
[AddBiomechanics Dataset](https://addbiomechanics.org/download_data.html)
17+
## Trained model
18+
GaitDynamics has [a diffusion model](/example_usage/GaitDynamicsDiffusion.pt) and
19+
[a force refinement model](/example_usage/GaitDynamicsRefinement.pt).
20+
Downstream task 1 uses both models, while downstream task 2 and 3 use only the diffusion model.
2321

24-
## Example code
22+
## Force estimation with GaitDynamics
2523
[A Google Colab notebook](https://colab.research.google.com/drive/1n6kH3gnwLdQ2DH5krigbkiO06NjDtyxI?usp=sharing)
2624
is provided for the downstream tasks 1 – force estimation using flexible combinations of kinematic inputs.
27-
By executing the code, and example .mot file with joint angles of an OpenSim skeletal model will be imported from GitHub.
25+
By executing the code, the GaitDynamics models, and example .mot file with joint angles of an OpenSim skeletal model will be imported from GitHub.
2826
Users can upload their own .mot files to the Colab notebook to obtain force predictions.
2927
To use a reduced kinematic input combinations, simply delete the corresponding columns in the .mot file.
28+
29+
## Dataset
30+
[AddBiomechanics Dataset](https://addbiomechanics.org/download_data.html)
31+
32+
## Publication
33+
This repository includes the code and models for a [preprint]() and an [abstract](./figures/readme_fig/Tan_ASB2024.pdf).
22.2 MB
Binary file not shown.
8.01 MB
Binary file not shown.

figures/da_grf_test_set_1.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ def format_ticks(ax):
279279
metric_sugainet = get_all_the_metrics(model_key=f'/{folder}/sugainet_none_diffusion_filling')
280280

281281
params_name_formal_name_pairs = {
282-
'calcn_l_force_vy': 'Vertical\nForce - Profile',
283-
'calcn_l_force_vx': 'Anterior-Posterior\nForce - Profile',
284-
'calcn_l_force_vz': 'Medial-Lateral\nForce - Profile',
285-
'calcn_l_force_vy_max': 'Vertical\nForce - Peak'}
282+
'calcn_l_force_vy': 'Vertical\nForceProfile',
283+
'calcn_l_force_vx': 'Anterior-Posterior\nForceProfile',
284+
'calcn_l_force_vz': 'Medial-Lateral\nForce\u2014Profile',
285+
'calcn_l_force_vy_max': 'Vertical\nForce\u2014Peak'}
286286
params_of_interest = list(params_name_formal_name_pairs.keys())
287287

288288
rc('text', usetex=True)
@@ -310,23 +310,23 @@ def format_ticks(ax):
310310

311311
# From "Comparison of different machine learning models to enhance sacral acceleration-based estimations of running stride temporal variables and peak vertical ground reaction force"
312312
line0, = plt.plot([2.8, 3.7], [13, 13], '--', linewidth=2, color=[0.0, 0.0, 0.0], alpha=0.5)
313-
plt.text(4.1, 14, 'Running MDC - Healthy [25]', fontdict=FONT_DICT_SMALL, color=[0.0, 0.0, 0.0], va='center')
313+
plt.text(4.1, 14, 'Running MDC - Healthy$^{\ 31}$', fontdict=FONT_DICT_SMALL, color=[0.0, 0.0, 0.0], va='center')
314314
plt.annotate('', xytext=(4.05, 14), xycoords='data', xy=(3.75, 13), arrowprops=dict(arrowstyle="->"))
315315

316316
# From "Intra-rater repeatability of gait parameters in healthy adults during self-paced treadmill-based virtual reality walking"
317317
line1, = plt.plot([2.8, 3.7], [10.18, 10.18], '--', linewidth=2, color=[0.0, 0.0, 0.0], alpha=0.5)
318-
plt.text(4.1, 11.18, 'Walking MDC - Healthy [26]', fontdict=FONT_DICT_SMALL, color=[0.0, 0.0, 0.0], va='center')
318+
plt.text(4.1, 11.18, 'Walking MDC - Healthy$^{\ 32}$', fontdict=FONT_DICT_SMALL, color=[0.0, 0.0, 0.0], va='center')
319319
plt.annotate('', xytext=(4.05, 11.18), xycoords='data', xy=(3.75, 10.18), arrowprops=dict(arrowstyle="->"))
320320

321321
# and "Minimal detectable change for gait variables collected during treadmill walking in individuals post-stroke"
322322
line2, = plt.plot([2.8, 3.7], [4.65, 4.65], '--', linewidth=2, color=[0.0, 0.0, 0.0], alpha=0.5)
323-
plt.text(4.1, 5.65, 'Walking MDC - Stroke [27]', fontdict=FONT_DICT_SMALL, color=[0.0, 0.0, 0.0], va='center')
323+
plt.text(4.1, 5.65, 'Walking MDC - Stroke$^{\ 33}$', fontdict=FONT_DICT_SMALL, color=[0.0, 0.0, 0.0], va='center')
324324
plt.annotate('', xytext=(4.05, 5.65), xycoords='data', xy=(3.75, 4.65), arrowprops=dict(arrowstyle="->"))
325325

326326
format_axis(plt.gca())
327327
format_ticks(plt.gca())
328328
plt.tight_layout(rect=[-0.03, 0., 1.03, 0.88])
329-
plt.legend(list(bars), ['GaitDynamics', 'Convolutional Neural Network [19]', 'Recurrent Neural Network [20]'],
329+
plt.legend(list(bars), ['GaitDynamics', 'Convolutional Neural Network$^{\ 21}$', 'Recurrent Neural Network$^{\ 22}$'],
330330
frameon=False, fontsize=FONT_SIZE_SMALL, bbox_to_anchor=(0.7, 1.2), ncols=1)
331331
plt.savefig(f'exports/da_grf.png', dpi=300, bbox_inches='tight')
332332
plt.show()
@@ -384,7 +384,7 @@ def format_ticks(ax_plt):
384384
format_axis(plt.gca())
385385
format_ticks(ax_plt)
386386
ax_plt.legend(list(bars) + [line_1], [
387-
'Partial-Body Kinematics with Inpainting Filling (GaitDynamics)', 'Partial-Body Kinematics with Median Filling', 'Full-Body Kinematics (GaitDynamics)'],
387+
'Partial-Body Kinematics with Inpainting (GaitDynamics)', 'Partial-Body Kinematics with Median Filling', 'Full-Body Kinematics (GaitDynamics)'],
388388
frameon=False, fontsize=FONT_SIZE_SMALL, bbox_to_anchor=(0., 0.88), loc='lower left')
389389
plt.savefig(f'exports/da_segment_filling.png', dpi=300, bbox_inches='tight')
390390
plt.show()

figures/da_guided_ts_uhlrich_1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def draw_fig():
5959
ax_angles = fig.add_subplot(gs[1, 0])
6060
for i, (ax, scale) in enumerate(zip([ax_kam, ax_angles], [1, - 180/np.pi])):
6161
for i_condition, condition in enumerate(condition_list):
62-
condition_val = condition.split('_')[-1]
62+
condition_val = float(condition.split('_')[-1])
6363
true_averaged, pred_averaged, ts_averaged, true_std, pred_std, ts_std = [scale * ele for ele in get_average_and_std(
6464
bl_true, bl_pred, ts_true, condition, params_of_interest_col_loc)]
6565

@@ -68,12 +68,12 @@ def draw_fig():
6868
print('Pred 2st peak diff {:.1f}'.format(true_averaged[51:, i].max() - pred_averaged[51:, i].max()))
6969
elif i == 1:
7070
print('Pred 1st peak value {:.1f}'.format(pred_averaged[:, i].max()))
71-
ax.plot(pred_averaged[:, i], '--', color=colors[i_condition], linewidth=LINE_WIDTH_THICK, label=f'{condition_val} x Normal Trunk Sway - Synthetic ')
71+
ax.plot(pred_averaged[:, i], '--', color=colors[i_condition], linewidth=LINE_WIDTH_THICK, label='{:.1f} x Normal Trunk Sway - Synthetic '.format(condition_val))
7272
# ax.grid(True, linewidth=1, alpha=0.5)
7373
if i_condition == len(condition_list) - 1:
74-
ax.plot(true_averaged[:, i], '-', color=[0.4, 0.4, 0.4], label='Normal Walking - Experimental [38]')
74+
ax.plot(true_averaged[:, i], '-', color=[0.4, 0.4, 0.4], label='Normal Walking - Experimental')
7575
ax.fill_between(range(len(true_averaged)), true_averaged[:, i] - true_std[:, i], true_averaged[:, i] + true_std[:, i], color='gray', alpha=0.3)
76-
ax.plot(ts_averaged[:, i], '-', color=colors[3], label='Large Trunk Sway - Experimental [38]')
76+
ax.plot(ts_averaged[:, i], '-', color=colors[3], label='Large Trunk Sway - Experimental')
7777
ax.fill_between(range(len(ts_averaged)), ts_averaged[:, i] - ts_std[:, i], ts_averaged[:, i] + ts_std[:, i], color=colors[-1], alpha=0.3)
7878
if i == 0:
7979
print('Exp 1st peak diff {:.1f}'.format(true_averaged[:, i].max() - ts_averaged[:, i].max()))

figures/da_run_faster_1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def draw_speed_only_fig():
157157

158158
if i_param == 1:
159159
ax.legend([ebar1, ebar0, ebar2],
160-
['Experimental Measurement[xxxx]', 'GaitDynamics Generation', 'OmniControl Generation [36]'],
160+
['Experimental Measurement', 'GaitDynamics Generation', 'OmniControl Generation'],
161161
frameon=False, bbox_to_anchor=(0.8, 1.25), ncol=3, handlelength=4)
162162
plt.subplots_adjust(.08, .08, .98, .92)
163163
plt.savefig(f'exports/da_run_faster_1.png', dpi=300)

figures/exports/da_grf.png

-1.68 KB
Loading

figures/exports/da_guided_ts.png

-4.97 KB
Loading

figures/exports/da_run_faster_1.png

-2.26 KB
Loading
-164 Bytes
Loading

0 commit comments

Comments
 (0)