Skip to content

Commit

Permalink
Multitemplate work and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
js117 committed Jun 29, 2015
1 parent 21bb125 commit b00d627
Show file tree
Hide file tree
Showing 32 changed files with 41,630 additions and 36 deletions.
Binary file added MultiTemplate/GymTrack/GymTrack10Motions.mat
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

7,692 changes: 7,692 additions & 0 deletions MultiTemplate/GymTrack/Kiwi-jjbhbhb-model-2015-6-26-17_3_7.csv

Large diffs are not rendered by default.

44 changes: 24 additions & 20 deletions MultiTemplate/GymTrack/OrganizeData.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@
% (and calculate the same features for user test data in TTest as well)
% Don't forget to set "numAxes" = to the number of features!

T1 = HanningFilter(KiwiLEFTmodelJD1);
T2 = HanningFilter(KiwiLEFTmodelJD2);
T3 = HanningFilter(KiwiLEFTmodelJD3);
T4 = HanningFilter(KiwiLEFTmodelJD4);
T5 = HanningFilter(KiwiRIGHTmodelJD1);
T6 = HanningFilter(KiwiRIGHTmodelJD2);
T7 = HanningFilter(KiwiRIGHTmodelJD3);
T8 = HanningFilter(KiwiRIGHTmodelJD4);

T = {T1, T2, T3, T4, T5, T6, T7, T8};

TTest = {HanningFilter(DaveTest)};
T1 = T_uprightrow_1; T2 = T_uprightrow_2; T3 = T_uprightrow_3;
T4 = T_squat_1; T5 = T_squat_2; T6 = T_squat_3;
T7 = T_skullcrusher_1; T8 = T_skullcrusher_2; T9 = T_skullcrusher_3;
T10 = T_shoulderpress_1; T11 = T_shoulderpress_2; T12 = T_shoulderpress_3;
T13 = T_pullover_1; T14 = T_pullover_2; T15 = T_pullover_3;
T16 = T_deadlift_1; T17 = T_deadlift_2; T18 = T_deadlift_3;
T19 = T_bicepcurl_1; T20 = T_bicepcurl_2; T21 = T_bicepcurl_3;
T22 = T_bentoverrow_1; T23 = T_bentoverrow_2; T24 = T_bentoverrow_3;
T25 = T_benchpress_1; T26 = T_benchpress_2; T27 = T_benchpress_3;
T28 = T_halfsquat_1; T29 = T_halfsquat_2; T30 = T_halfsquat_3;

T = {T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, ...
T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, ...
T21, T22, T23, T24, T25, T26, T27, T28, T29, T30};

%TTest = {HanningFilter(DaveTest)};

numAxes = 6;
numTemplates = size(T,2);
Expand All @@ -26,8 +30,8 @@
% val of ~1.83 - across all trial data. Not normalizing heavily biases the
% algorithm to match crappy gyro noise in motions where gyro is less
% prominent (e.g. bench press).
GYRO_MAX = 1000;
ACC_MAX = 8; % use empirical vals from template dataset
GYRO_MAX = 250;
ACC_MAX = 2; % use empirical vals from template dataset
for i=1:numTemplates
T{i}(:,1:3) = T{i}(:,1:3) / ACC_MAX;
T{i}(:,4:6) = T{i}(:,4:6) / GYRO_MAX;
Expand Down Expand Up @@ -62,7 +66,7 @@
for i=1:numTemplates
rowCount = size(T{i},1);
for j=rowCount+1:maxRowCount
T{i}(j,:) = MARKER*ones(numAxes,1);
T{i}(j,:) = T{i}(j-rowCount,:); % try repeating
end
end

Expand All @@ -87,7 +91,7 @@
% templates we don't wish to compare with previous shorter length templates
% but which we still want to match against a longer stream of user data.
MjkMatrices = cell(numAxes, numSubBlocks);
alphaWeights = zeros(numAxes, n); % compute these guys too
alphaweights = zeros(numAxes, n); % compute these guys too
for i=1:numAxes
for j=1:numTemplates

Expand All @@ -101,15 +105,15 @@
end

MjkMatrices{i,j}(ii,1:jj-1) = mean(MjkMatrices{i,j}(ii,jj:end));
mean(MjkMatrices{i,j}(ii,jj:end))
%mean(MjkMatrices{i,j}(ii,jj:end))

end

alphaWeights(i,j) = (1/numAxes) * (MiLengths(j+1) - MiLengths(j))/maxRowCount;
alphaweights(i,j) = (1/numAxes) * (MiLengths(j+1) - MiLengths(j))/maxRowCount;
% as we see, we can do things like weight gyroY stream
% higher/lower, weight the shorter blocks (end of longer templates)
% in a decaying fashion, etc.
% sum(sum(alphaWeights)) should be 1
% sum(sum(alphaweights)) should be 1
end
end

Expand All @@ -119,7 +123,7 @@
P = zeros(n,n);
for j=1:numAxes
for k=1:numTemplates
P = P + alphaWeights(j,k)*MjkMatrices{j,k}'*MjkMatrices{j,k};
P = P + alphaweights(j,k)*MjkMatrices{j,k}'*MjkMatrices{j,k};
end
end
P = 2*P;
Expand Down
9,137 changes: 9,137 additions & 0 deletions MultiTemplate/GymTrack/TestScores.csv

Large diffs are not rendered by default.

2,437 changes: 2,437 additions & 0 deletions MultiTemplate/GymTrack/TestScores2.csv

Large diffs are not rendered by default.

Binary file added MultiTemplate/GymTrack/alphaweights.mat
Binary file not shown.
Binary file added MultiTemplate/GymTrack/benchvsshoulder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added MultiTemplate/GymTrack/mjkmatrices.mat
Binary file not shown.
9 changes: 9 additions & 0 deletions MultiTemplate/GymTrack/scoreRepDetector.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function y = scoreRepDetector(scores, testThresh)

len = size(scores,1);
y = zeros(len,1);
nn = 3;

for i=2:len

end
8,664 changes: 8,664 additions & 0 deletions MultiTemplate/GymTrack10Test.csv

Large diffs are not rendered by default.

Binary file modified MultiTemplate/Kiwi-ShoulderPress.xlsx
Binary file not shown.
Binary file modified MultiTemplate/MultiTemplate.mat
Binary file not shown.
2,807 changes: 2,807 additions & 0 deletions MultiTemplate/MultitemplateJava10.csv

Large diffs are not rendered by default.

35 changes: 21 additions & 14 deletions MultiTemplate/OrganizeData.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@
% (and calculate the same features for user test data in TTest as well)
% Don't forget to set "numAxes" = to the number of features!

T1 = Matt_TEMPLATE_Bicepcurl;
T2 = Jarred_TEMPLATE_Bicepcurl;
T3 = Ethan_TEMPLATE_Bicepcurl;
T4 = Aaron_TEMPLATE_Bicepcurl;
T5 = Aaron_TEMPLATE_Benchpress;
T6 = Ethan_TEMPLATE_Benchpress;
T7 = TEMPLATE_Shoulderpress1;
T8 = TEMPLATE_Shoulderpress2;
T9 = TEMPLATE_Shoulderpress3;
T10 = TEMPLATE_Shoulderpress4;
T11 = Aaron_TEMPLATE_Squats;
T12 = Ethan_TEMPLATE_Squats;
T13 = Jarred_TEMPLATE_Squats;
T1 = HanningFilter(Matt_TEMPLATE_Bicepcurl);
T2 = HanningFilter(Jarred_TEMPLATE_Bicepcurl);
% T3 = HanningFilter(Ethan_TEMPLATE_Bicepcurl);
% T4 = HanningFilter(Aaron_TEMPLATE_Bicepcurl);
% T5 = HanningFilter(Aaron_TEMPLATE_Benchpress);
% T6 = HanningFilter(Ethan_TEMPLATE_Benchpress);
% T7 = HanningFilter(TEMPLATE_Shoulderpress1);
% T8 = HanningFilter(TEMPLATE_Shoulderpress2);
% T9 = HanningFilter(TEMPLATE_Shoulderpress3);
% T10 = HanningFilter(TEMPLATE_Shoulderpress4);
% T11 = HanningFilter(Aaron_TEMPLATE_Squats);
% T12 = HanningFilter(Ethan_TEMPLATE_Squats);
% T13 = HanningFilter(Jarred_TEMPLATE_Squats);
% T_NEW_TEMPLATES: already filtered
T3 = T_NEW_TEMPLATE_BENCH;
T4 = T_NEW_TEMPLATE_BENCH_2;
T5 = T_NEW_TEMPLATE_SHOULDER_PRESS;
T6 = T_NEW_TEMPLATE_SHOULDER_PRESS_2;
T7 = T_NEW_TEMPLATE_SQUAT;
T8 = T_NEW_TEMPLATE_SQUAT_2;

T = {T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13};
T = {T1, T2, T3, T4, T5, T6, T7, T8};

TTest = {Matt_ALL_Bicepcurl, Jarred_ALL_Bicepcurl, Ethan_ALL_Bicepcurl, Aaron_ALL_Bicepcurl, ...
Aaron_ALL_Benchpress, Ethan_ALL_Benchpress, ALL_Shoulderpress1, ALL_Shoulderpress2, ...
Expand Down
Loading

0 comments on commit b00d627

Please sign in to comment.