Skip to content

Code for the paper Continual Learning from Demonstration of Robotic Skills

License

Notifications You must be signed in to change notification settings

kaixindelele/clfd

 
 

Repository files navigation

Continual Learning from Demonstration of Robotic Skills

Robot executing HelloWorld tasks

Methods for teaching motion skills to robots focus on training for a single skill at a time. Robots capable of learning from demonstration can considerably benefit from the added ability to learn new movements without forgetting past knowledge. To this end, we propose an approach for continual learning from demonstration using hypernetworks and neural ordinary differential equation solvers. We empirically demonstrate the effectiveness of our approach in remembering long sequences of trajectory learning tasks without the need to store any data from past demonstrations. Our results show that hypernetworks outperform other state-of-the-art regularization-based continual learning approaches for learning from demonstration. In our experiments, we use the popular LASA trajectory benchmark, and a new dataset of kinesthetic demonstrations that we introduce in our paper called the HelloWorld dataset. We evaluate our approach using both trajectory error metrics and continual learning metrics, and we propose two new continual learning metrics. Our code, along with the newly collected dataset, is available in this repository.

Here is a very short overview of our approach (also available on YouTube):

clfd_short_1min.mp4

HelloWorld Dataset

HelloWorld is a dataset of demonstrations we collected using the Franka Emika Panda robot. The x and y coordinates of the robot's end-effector were recorded while a human user guided it kinesthetically to write the 7 lower-case letters h,e,l,o,w,r,d one at a time on a horizontal surface. The HelloWorld dataset consists of 7 tasks, each containing 8 slightly varying demonstrations of a letter. Each demonstration is a sequence of 1000 2-D points. After training on all the tasks, the objective is to make the robot write the words hello world. Our motivation for using this dataset is to test our approach on trajectories with loops and to show that it also works on kinesthetically recorded demonstrations using a real robot.

The data for each of the 7 tasks can be found as .npy files in the folder datasets/robot_hello_world/processed_demos.

HelloWorld_dataset

Please check the file helloworld_dataset.ipynb to see how to load this dataset. Code for using this dataset in the training loop can be found in the training scripts tr_*_node.py (e.g. tr_hn_node.py).

Code Instructions

Clone this repository

git clone https://github.com/sayantanauddy/clfd.git

Create a virtual enviornment and install the dependencies

# Create a virtual environment, then activate it
cd <path/to/this/repository>
python -m pip install -r requirements.txt

Install the GPU version of torch if needed.

Execute a training run

Here we show the command for training a Hypernetwork that generates a NODE:

# DATASET: LASA
# NODE TYPE: NODE^T (with time input)

python3 tr_hn_node.py --data_dir datasets/LASA/DataSet --num_iter 15000 --tsub 20 --replicate_num 0 --lr 0.0001 --tnet_dim 2 --tnet_arch 100,100,100 --tnet_act elu --hnet_arch 200,200,200 --task_emb_dim 256 --explicit_time 1 --beta 0.005 --data_class LASA --eval_during_train 0 --seq_file datasets/LASA/lasa_sequence_all.txt --log_dir logs_clfd/lasa_explicit_time --plot_fs 10 --figw 16.0 --figh 3.3 --task_names_path datasets/LASA/lasa_names.json --seed 200 --description tr_hn_node_LASA_t1

The complete set of commands for reproducing all our experiments can be found in commands_LASA.txt and commands_HelloWorld.txt.

Reproducing results

To reproduce the results from our experiments, use the commands from commands_LASA.txt and commands_HelloWorld.txt.

Once all the training scripts have completed executing and all log files have been generated in the folder logs_clfd, generate plots using the notebook generate_plots.ipynb.

View Trajectories Predicted by Trained Models

First download the pretrained models and extract them to the directory trained_models

cd <path/to/this/repository>
cd trained_models
wget https://iis.uibk.ac.at/public/auddy/clfd/trained_models/trained_models.tar.xz
tar xvf trained_models.tar.xz

Then run the notebook predict_traj_saved_models.ipynb for generating trajectory predictions using the pretrained models provided by us.

Acknowledgements

About

Code for the paper Continual Learning from Demonstration of Robotic Skills

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 80.8%
  • Python 19.0%
  • MATLAB 0.2%