This tutorial aims to help students and researchers working on gestures and sign languages learn how to use DTW to quantify the degree of gesture (sign) form (dis)similarity. The following topics are covered:
- Understanding the characteristics of DTW (
dtw_example.ipynb) - Preprocessing the MediaPipe motion tracking time series data
- Trimming the time series data for the duration of gestures
- Learning how to improve the predictive accuracy of DTW
Before running the script, you need to have the following installed:
- Anaconda
- Visual Studio Code (or an IDE of your preference).
To run the Python notebooks, please complete the steps below. Note that the preparation needs to be done only once. Afterwards, you can run the scripts immediately.
-
Download the repository. You can do so in two different ways:
- Option 1: clone the repository
- Option 2: click the green "<> Code" button on this page and select "Download ZIP". Make sure to unzip the folder before moving on to the next step.
-
Set up the conda environment by following the instructions under the "Install packages" section.
-
Open terminal/anaconda prompt at the "scripts" folder
- Mac:
- go to the "dtw_tutorial" folder
- right-click the "scripts" folder
- select "open terminal at this folder" (under "Services")
- Windows:
- go to the "scripts" folder
- copy the path to the folder
- open Anaconda Prompt
- type cd and paste the path after a space (e.g., cd D:/users/shoakamine/dtw_tutorial/scripts)
- if the folder is not in the C drive (e.g., D:/users/...), type the drive initial followed by a colon (e.g., D:):
- Mac:
-
Create Python 3.10 environment on Anaconda prompt/terminal
conda create --name dtw python=3.10 -
Activate your conda environment
conda activate dtw -
Install git if not already installed:
conda install -c anaconda git -
Run this command to install required packages:
pip install -r requirements.txt -
Reinstall the ffmpeg package:
conda install -c conda-forge ffmpeg
-
-
Open the
dtw.ipynbordtw_example.ipynbfile (I strongly encourage everyone to go throughdtw_example.ipynbfirst to understand the properties of DTW) -
On VS Code, click "select kernel" on the top right and select "Python Environments..." --> "dtw"
-
Download MediaPipe time series data from this OSF repository.
-
Place the time series data under
data\mediapipe\in the corresponding folders