Wednesday, March 31, 2010

Hello Histogram!


I used the 3D DTW algorithm on the double-integrated path data. Above is the histogram result. Hello separation! Task 1 and task 2 separate their scores by about 40,000. Task 1 and 3 over lap some, but overall the tight grouping for task 1 to task 1 comparisons and the good separation mean that this method should give very good similarity scores.

Edit: the MATLAB code to play around with this is here

Eaiser way to calculate 3D paths

If you have a as your time series acceleration data, then just do:

>>v = cumtrapz(a);
>>p = cumtrapz(p);
This works because velocity is the integral of acceleration and position is the integral of velocity. Now you have v = velocity series and p = position series.

Encouraging DTW results

This is an encouraging first result from some playing around I've done with DTW. I modified Jin's DTW MATLAB code to calculate the difference matrix as the Euclidean distance at each point in 3D between the two input data sets. The graph above shows a histogram of the results when 10 recorded actions from task 1 are compared to 10 actions from task 1 (blue), task 2(red) and task 3(green).

What does this means? The histogram is of the 'dist' return value, which is a measure of similarity. So when comparing task 1 actions to task 1 actions all of the scores are below 65. When comparing task 1 to task 2 all of the scores are above 72. Similarly, task 1 and task 3 separate fairly well too. In short, it appears DTW can be used as a good similarity measure between like tasks, with lower scores being better.

Split data and other thoughts

I've split the data up into different files for the three tasks in Jin's data set. You can get it here. In MATLAB you can then do:

>>load t1-00

Now you'll have a variable called 't1_00' with three columns.

As far as the key/lock exercise goes, I think we can just stand at a door and turn the lock. I can do this at my house in any number of doors...

Wednesday, March 24, 2010

Friday meeting/algorithm

I think we should collect as much data as possible on Friday. We should each run through the five exercises several times to collect a baseline. I may have an extra lock at home, otherwise we should get one. We should bring a few playing cards as well.

It turns out dynamic time warping can be used to align and score the similarity between two sequences.

See wikipedia, or http://labrosa.ee.columbia.edu/matlab/dtw/ for some MATLAB code.

Then this data should be aligned and averaged using dynamic time warping to create a reference. The reference sequences become part of the Android application.

Looking at the data files, it seems like it will be easy to detect the start/stop of the exercise in the signal.

Next, I envision the Android application flow to be (only the testing/scoring part):

Describe the exercise.
"Are you ready to start?"
Count down and then start beep.
Start recording.
Record until two minutes have elapsed, or 2 (or 5?) seconds of stillness are observed.
Ask: "Did you complete the exercise?"
If yes:
Search the signal for the start and end of motion. Compare using DTW and give the score as a time,similarity tuple. Store the tuple in a database for later recall.
If no:
Ask: "Do you want to try again?"

The above is open to feedback/suggestions of course.

This paper has some good information: http://www.ri.cmu.edu/pub_files/...h.../wilson_daniel_h_2004_1.pdf

Monday, March 8, 2010

Two modes

Perhaps we should have two modes to our application:

#1: Simple mode. This mode is used to perform all (or most activities). In the standardized testing mode the score is only related to time. An observer uses a Bluethooth remote to trigger explanation and start/stop events. This would enable un-trained observers to administer the test (perhaps at home). Scores could be stored, uploaded, etc.

#2: Automatic mode: may still require an observer to trigger the start/stop events (or maybe voice recognition?) but the score is based on some TBD combination of time, smoothness, "quality?"

Monday, March 1, 2010

Test blog post

This is the blog for our CSCI546 project: Dr. Droid. We're looking into using a mobile phone as a sensor to improve stroke rehab.