Skip to content

tmralmeida/traj-modeling-dash

Repository files navigation

traj-modeling-dash

Dashboard for visualization and analysis of trajectory modeling artefacts: trajectory classes and embedding spaces:



Trajectory classes analysis and contrastive learning for trajectory prediction.

Project Organization

├── LICENSE            <- Open-source license if one is chosen
├── Makefile           <- Makefile with convenience commands like `make data` or `make train`
├── README.md          <- The top-level README for developers using this project.
├── data
│   ├── external       <- Data from third party sources.
│   ├── interim        <- Intermediate data that has been transformed.
│   ├── processed      <- The final, canonical data sets for modeling.
│   └── raw            <- The original, immutable data dump.
│
├── docs               <- A default mkdocs project; see www.mkdocs.org for details
│
├── models             <- Trained and serialized models, model predictions, or model summaries
│
├── notebooks          <- Jupyter notebooks. Naming convention is a number (for ordering),
│                         the creator's initials, and a short `-` delimited description, e.g.
│                         `1.0-jqp-initial-data-exploration`.
│
├── pyproject.toml     <- Project configuration file with package metadata for 
│                         traj_modeling_dash and configuration for tools like black
│
├── references         <- Data dictionaries, manuals, and all other explanatory materials.
│
├── reports            <- Generated analysis as HTML, PDF, LaTeX, etc.
│   └── figures        <- Generated graphics and figures to be used in reporting
│
├── requirements.txt   <- The requirements file for reproducing the analysis environment, e.g.
│                         generated with `pip freeze > requirements.txt`
│
├── setup.cfg          <- Configuration file for flake8
│
└── traj_modeling_dash   <- Source code for use in this project.
    │
    ├── __init__.py             <- Makes traj_modeling_dash a Python module
    │
    ├── config.py               <- Store useful variables and configuration
    │
    ├── dataset.py              <- Scripts to download or generate data
    │
    ├── features.py             <- Code to create features for modeling
    │
    ├── modeling                
    │   ├── __init__.py 
    │   ├── predict.py          <- Code to run model inference with trained models          
    │   └── train.py            <- Code to train models
    │
    └── plots.py                <- Code to create visualizations

Install packages for traj-modeling-dash

Install miniconda. Then, you can install all packages required by running:

conda env create -f environment.yml && conda activate traj-modeling-dash && pip install -e .

Prepare datasets

THÖR-MAGNI dataset (via thor-magni-tools)

  1. Prepare thor-magni-tools.
  2. Change config file to:

in_path: PATH_TO_CSVs/Scenario_{ID}
out_path: PATH_TO/traj-modeling-dash/data/external/thor_magni_3d
preprocessing_type: 3D-best_marker 
max_nans_interpolate: 100 

options: 
    resampling_rule: 400ms 
    average_window: 800ms 

Change the config in_path and out_path settings accordingly. In this way, we obtain smoother and consistent trajectories.

  1. From thor-magni-tools, run for each scenario directory:
    python -m thor_magni_tools.run_preprocessing
    
  2. Check your data/external directory.

Other datasets

  • download THOR
    • organize per Scenario at PATH_TO_EXTERNAL_DATA
  • thor-magni-act
    1. From thor-magni-tools, run for each scenario directory:
      python -m thor_magni_tools.run_actions_merging --actions_path PATH_TO_ACTIONS_FILE/QTM_frames_actions.csv --files_dir ../traj-modeling-dash/data/external/thor_magni_3d/Scenario_{ID} --out_path ../traj-modeling-dash/data/raw/thor_magni_actions/
    
    1. Jump to point 2. in preprocess the dataset

For adding actions to THÖR-MAGNI dataset:

python -m thor_magni_tools.run_actions_merging --actions_path ../thor-magni-actions/data/processed/thor_magni/QTM_frames_actions.csv --files_dir ../traj-modeling-dash/data/external/thor_magni_3d/Scenario_1 --out_path ../traj-modeling-dash/data/interim/thor_magni_actions/

Preprocess the dataset

To create a dataset, run: python -m traj_modeling_dash.data_processing.build_data_analysis DATASET_NAME PATH_TO_EXTERNAL_DATA data/raw/DATASET_PATH To compute features, run:

 python -m traj_modeling_dash.data_processing.build_features data/raw/DATASET_PATH data/interim/DATASET_PATH

Launch dashboard

streamlit run traj_modeling_dash/dashboard/Home.py --server.fileWatcherType none

Use contrastive learning page:

In the same directory, create a folder named "artefacts/predictors" and place the respective predictors checkpoints under the corresponding dataset.

Add a model class in the corresponding module and change the page script accordingly. Alternatively, use the trajectory-representation-learning module to train new modules with contrastive learning.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors