This repository contains our study on Differentiable Bayesian Filters.
The package provides implementations of both standard and differentiable Particle Filters, as well as already trained models and a simple simulation environment with moving discs, which should be followed by the filters based on the beacon measurements.
We recommend creating a virtual/conda environment for the installation.
This code was tested on both python=3.8
and python=3.9
.
Run the following commands in the repository`s main directory:
pip install -r requirements.txt
pip install .
The training script train.py is used to train the different models. In the script, hyperparameters, path to datasets and other settings can be easily changed. The training itself can be executed by running the script:
python pf/train.py
The try.py script can be used to easily test and visualize different filters, as well as create datasets that can be used for training or validation, by running:
python pf/try.py
Note: Please check all the parameters before running the filter!
-
For creating a dataset, the following snippet should be included with a specified path:
if __name__ == "__main__": create_dataset("path")
Other settings can be also changed, for more information please take a look at dataset.py. Please also study the contents of the datasets folder to find suitable created dataset.
-
For testing the standard particle filter, the following snippet must be included:
if __name__ == "__main__": run_filter()
Parameters regarding the simulation as well as other hyperparameters can be easily changed in the function.
-
For testing the differentiable particle filter, the following snippet must be included:
if __name__ == "__main__": run_diff_filter()
Parameters regarding the simulation, other hyperparameters as well as the model path must be appropriately specified in the function.
Before running the script, we advise checking the saved_models folder, which contains already trained models in different environments.
For the saved models, we provide the state dicts with trained weights, the TF-records,
setup.txt
file with model parameters, as well as some visualization videos:
The implemented filters and their components can be found under:
Our simulation environment can be found under:
Currently, there are un-merged branches in the repository:
dev-fixed-cov
contains the older model, which can only be learned with fixed covariance matrices.experiment-1st-milestone
contains code to generate the RMSE graphics (from the paper), which are then used to compare different models between each other.
We are not planning to either merge or delete these branches.