Source code and data for the paper "Differentiable Particle Filters: End-to-End Learning with Algorithmic Priors"
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Differentiable Particle Filters


Rico Jonschkowski (


This repository contains our source code for differentiable particle filters (DPFs) described in the paper "Differentiable Particle Filters: End-to-End Learning with Algorithmic Priors" (Jonschkowski et al. 2018). This implementation is meant to complement the paper. Our goal is to enable others to reproduce our results and to build on our research by reusing our code. We do not include extensive explanations here -- these can be found in our paper

If you are using this implementation in your research, please consider giving credit by citing our paper:

    title = {{Differentiable Particle Filters: End-to-End Learning with Algorithmic Priors}},
    booktitle = {{Proceedings of Robotics: Science and Systems (RSS)}},
    author = {Jonschkowski, Rico and Rastogi, Divyam and Brock, Oliver},
    year = {2018},


Our code builds on python3 and the following libraries. It is important that the libraries are installed for python3 not python2.


sudo apt-get install python3-numpy


sudo apt-get install python3-matplotlib

TensorFlow -->, e.g.

pip3 install tensorflow

Sonnet -->, e.g.

pip3 install dm-sonnet


The setup script downloads the data for training and testing (~2.5GB) and creates additional folders (for logging etc.). To perform these steps, simply run the following commands in the main folder of the repository:

chmod +x


After all dependencies are installed and setup is done, there is one more thing which needs to be done every time a new shell is opened before the code can be run. In the main repository folder, you need run the following command to append the parent directory to the PYTHONPATH. Alternatively, you can import the project into the PyCharm IDE and and run experiments/ from there. The need for running this command comes from how PyCharm handles relative imports and relative paths.


After this is done, you can train and test a differentiable particle filter for global localization in maze 1 by running the following commands in the main folder:

cd experiments; python3; cd ..

This command will first train the different models (motion model, observation likelihood estimator, and particle proposer) individually and then train them jointly end-to-end. The command line output will show the current losses on training and validation data (mean +- standard error), where ">>" indicates a new lowest validation loss. Training will stop if the best validation loss has not decreased for a while (e.g. 200 epochs). You should see something like this (the different plots are generated one after another):


As next steps, you can play around with the hyperparameters in utils/, go through the differentiable particle filter code in methods/, and run other experiments, e.g. applying the filter to the KITTI visual odometry task by running the following command (if your computer has enough memory :D).

cd experiments; python3; cd ..