GithubHelp home page GithubHelp logo

leesunfreshing / explainable-trajectory-prediction Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amazon-science/explainable-trajectory-prediction

0.0 0.0 0.0 59.25 MB

Official code repository for the ICLR 2022 paper "You Mostly Walk Alone: Analyzing Feature Attribution in Trajectory Prediction".

Home Page: https://openreview.net/forum?id=POxF-LEqnF

License: Apache License 2.0

Shell 0.10% Python 99.90%

explainable-trajectory-prediction's Introduction

Explainable Trajectory Prediction

This repository contains the code for explainable trajectory prediction based on Shapley values.

Data Preparation

The processing code/files of the ETH-UCY, nuScenes and SDD can be found at:

To process the SportVU dataset for the two frameworks:

python tools/prepare_data.py
python tools/process_trajectron_data.py
python tools/process_pecnet_data.py

The raw data can be accessed at: https://github.com/linouk23/NBA-Player-Movements/tree/master/data/2016.NBA.Raw.SportVU.Game.Logs

Thirdparty

Download the following frameworks and place them under:

Pre-trained Models

All pre-trained models are provided under models/.

Models Testing

Examples to test models:

# Testing Traj++Edge on ETH
env PYTHONPATH=src python bin/test_trajectron.py models/trajectron/eth-ucy/eth_edge 100 data/eth-ucy/eth_test.pkl cpu 
# Testing PECNet on SDD
env PYTHONPATH=src python bin/test_pecnet.py thirdparty/PECNet/saved_models/PECNET_social_model1.pt thirdparty/PECNet/social_pool_data/test_all_4096_0_100.pickle

To test the models without interaction, append --without_neighbours to the call.

Model Training

An example call to train Trajectron++Edge:

# Training Traj++Edge on SportVU 
env PYTHONPATH=src python bin/train_trajectron.py --config models/trajectron/sport/edge/config.json --data_dir data/sport --train_data_dict trajectron_train.pkl --log_dir logs --log_tag sport_traj++Edge --train_epochs 20 --save_every 5 --deeper_action --late_fusion

Shapley Values Estimation

Example calls to compute Shapley values:

# Shapley values of Traj++Edge on the first scene of SportVU
env PYTHONPATH=src python bin/compute_shapley_values_trajectron.py models/trajectron/sport/edge 20 data/sport/trajectron_test.pkl cuda:0 home nll zero 0 results/sport/Traj++Edge --random_node_types home guest

# Shapley values of PECNet on the first scene of SportVU
env PYTHONPATH=src python bin/compute_shapley_values_pecnet.py models/pecnet/sport.pt data/sport/pecnet_test.pkl 0 results/sport/pecnet

The above calls estimate the Shapley values per scene, to merge the results over all scenes of a dataset:

python tools/merge_results.py results/sport Traj++Edge nll results

Plotting

An example call to plot the aggregated Shapley values by comparing two models:

python tools/plot_shapley_values.py --names Traj++ Traj++Edge --paths results/Traj++_nll.pkl results/Traj++Edge_nll.pkl --output_path results/SportVU_nll.png

To plot the local analysis (per scenario) of the SportVU:

python tools/plot_scenarios.py results/sport/Traj++Edge_home_0_nll.pkl results/court.png

where the second argument point to the image of the scene and can be accessed at: https://github.com/linouk23/NBA-Player-Movements/

Unit Tests

The following script checks a set of unit tests.

./local_run_tests.sh 

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

explainable-trajectory-prediction's People

Contributors

amazon-auto avatar dependabot[bot] avatar os1a avatar petergehler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.