Ensembling and kalman smoothing for pose estimation
Project description
EKS
This repo contains code to run an Ensemble Kalman Smoother (EKS) for improving pose estimation outputs.
The EKS uses a Kalman smoother to ensemble and smooth pose estimation outputs as a post-processing step after multiple model predictions have been generated, resulting in a more robust output:
For more details see Biderman, Whiteway et al. 2024, Nature Methods.
Installation
We offer two methods for installing the eks package:
- Method 1,
github+conda: this is the preferred installation method and will give you access to example data - Method 2,
pip: this option is intended for non-interactive environments, such as remote servers.
For both installation methods we recommend using conda to create a new environment in which this package and its dependencies will be installed:
conda create --name eks python=3.10
Activate the new environment:
conda activate eks
Make sure you are in the activated environment during the Lightning Pose installation.
Method 1: github+conda
First you'll have to install the git package in order to access the code on github.
Follow the directions here
for your specific OS.
Then, in the command line, navigate to where you'd like to install the eks package and move
into that directory:
git clone https://github.com/paninski-lab/eks
cd eks
To make the package modules visible to the python interpreter, locally run pip
install from inside the main eks directory:
pip install -e .
If you wish to install the developer version of the package, run installation like this:
pip install -e ".[dev]"
For more information on individual modules and their usage, see Requirements.
Method 2: pip
You can also install the eks package using the Python Package Index (PyPI):
python3 -m pip install ensemble-kalman-smoother
Note that you will not have access to the example data with the pip install option.
Usage
After installation, the eks command is available in your environment. Run eks --help to see
available subcommands, or eks <subcommand> --help for full argument details for any subcommand.
Single-camera datasets
The singlecam subcommand runs EKS for standard single-camera setups. Any of the provided
datasets are compatible; below we use data/ibl-pupil as an example.
eks singlecam --input-dir ./data/ibl-pupil --make-plot
Multi-camera datasets
The multicam subcommand supports two modes depending on whether camera calibration is available.
Pose predictions should be stored in a separate CSV file per camera.
Without calibration (linear EKS)
Example data in data/mirror-mouse-separate contains two-view mouse video with cameras named
top and bot:
eks multicam --input-dir ./data/mirror-mouse-separate --bodypart-list paw1LH paw2LF paw3RF paw4RH --camera-names top bot --make-plot
With calibration (nonlinear EKS)
Calibration data must be stored in .toml files using the
Anipose format.
Example data in data/fly contains multi-view fly video with cameras Cam-A, Cam-B, and
Cam-C, along with a calibration.toml file:
eks multicam --input-dir ./data/fly --bodypart-list L1A L1B --camera-names Cam-A Cam-B Cam-C --calibration ./data/fly/calibration.toml --make-plot
Mirrored multi-camera datasets
The mirrored-multicam subcommand handles setups where pose predictions for all cameras are
stored in a single CSV file. For example, a body part nose_tip with cameras top, bottom,
and side should have columns named nose_tip_top, nose_tip_bottom, and nose_tip_side.
Example data in data/mirror-mouse contains a two-view mouse video with cameras top and bot:
eks mirrored-multicam --input-dir ./data/mirror-mouse --bodypart-list paw1LH paw2LF paw3RF paw4RH --camera-names top bot --make-plot
IBL pupil dataset
The ibl-pupil subcommand expects an --input-dir containing Lightning Pose or DLC model
predictions:
eks ibl-pupil --input-dir ./data/ibl-pupil --make-plot
IBL paw dataset (multiple asynchronous views)
The ibl-paw subcommand expects an --input-dir containing Lightning Pose or DLC model
predictions for the left and right camera views, as well as timestamp files to align the two
cameras:
eks ibl-paw --input-dir ./data/ibl-paw --make-plot
Authors
- Cole Hurwitz
- Keemin Lee
- Amol Pasarkar
- Matt Whiteway
- [Spirit of claude]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ensemble_kalman_smoother-4.6.0.tar.gz.
File metadata
- Download URL: ensemble_kalman_smoother-4.6.0.tar.gz
- Upload date:
- Size: 43.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.11.15 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e55cbd19a986832304712c211546c2ea0b0fc94c363b67ccab923617b49b2db
|
|
| MD5 |
7d081a66bbbf559a442a660ed82d3168
|
|
| BLAKE2b-256 |
b56e5cdd365ce3f350a0f47414535e5408717aee16de9438b5a675c0693b9f51
|
File details
Details for the file ensemble_kalman_smoother-4.6.0-py3-none-any.whl.
File metadata
- Download URL: ensemble_kalman_smoother-4.6.0-py3-none-any.whl
- Upload date:
- Size: 52.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.11.15 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
973e6e1fef7adb7fc0232f3e9ec04bd612bd065110a9f72597f3b4069a07d48b
|
|
| MD5 |
b55565e7948cd12dccdf35962397ac28
|
|
| BLAKE2b-256 |
cc5b39256624ddbe3525eff325ec6ed45dfa72210fe4df3b878b26a5b372f2f2
|