The scripts are written in Python 3 and the motion capture data can be found under `data/captures` in CSV format.

Dependencies:
- TensorFlow 1.x
- NumPy
- Pandas
- numpy-quaternion
- Matplotlib
- Seaborn

Before starting, uncompress the archive `animation_data.zip` in this directory.

To create the training dataset run from this directory:

    > python scripts/preprocess_swordfight.py data/captures/train data/records/train
    > python scripts/preprocess_swordfight.py data/captures/test data/records/test

To train the model run:

    > python scripts/rice_train.py experiment.yaml

When the program ends, the results from the training will be found in `output/experiment_<timestamp>`.
Within that directory, `result` contains multiple evaluation figures for the train, test and validation data.
Under `tflogs` there are log files that can be visualised with TensorBoard.

    > python scripts/train_swordgfnn.py --num-joints 25 --trajectory-window 3 --num-styles 2 --train-data-dir data/records/train --test-data-dir data/records/train --log-dir output/training --spline-points 2,4,4 --hidden-layers 55,55 --use-bias y --regularization 100 --max-steps 300000 --evaluation-steps 1000 --patience -1

To simulate the trained model on some of the data run:

    > python scripts/simulate_model.py --out output/simulation --anim-dir output/simulation --models model:output/training/gfnn_cubic.tf --data capture1:data/captures/test/mf_crz_swd_static_00.0.CSV capture2:data/captures/test/mf_crz_swd_static_00.0.CSV --per-data y

This will generate some results files and veideos in `output/simulation`. More data files can be tested by passing them in the `--data` argument. The `results.xslx` Excel file contains statistics about the evaluation, as well as the individual error values measured per frame on each file. The histograms show the distribution of the error for each file invidually and collectively. The videos show a comparison between the motion capture data and the animation synthesised by the neural network, highlighting the areas where the differences are larger. Videos may take long to generate, they can be omitted by removing the `--anim-dir` option from the command.
