How mulplue/mgf works
Project Overview and Purpose
• The project implements “MGF: Mixed Gaussian Flow for Diverse Trajectory Prediction,” a deep learning model (based on PyTorch) aimed at predicting diverse trajectories. The goal is to offer a robust inference and training pipeline for trajectory prediction across various scenes like eth, hotel, univ, zara1, zara2, and sdd.
• The README confirms this is a research implementation (accepted to Neurips’24) and notes its similarity or extension to the FlowChain codebase.
Main Components
a. Data Layer
• Raw Data Repository: Represent the various raw data folders under src/data/TP/raw_data corresponding to different scenes (eth, hotel, etc.). This includes test/train/val splits.
• Data Processing/Preprocessing: Include “process_data.py”, “preprocessing.py”, and components in the environment (e.g., data_structures.py, data_utils.py, map.py) that help structure and prepare the data.
• Data Loader: Show components like unified_loader.py and dataset-specific logic (e.g., trajectron_dataset.py) which transform raw files into input formats for models.
b. Configuration and Checkpoints
• Config Files: A “config” directory with separate YAML files for each scene. These files set the parameters for training and evaluation.
• Checkpoints: The “checkpoint” folder holds pre-trained clustering checkpoints (e.g., eth.ckpt, hotel.ckpt, etc.) that are likely used for the clustering portion of the architecture.
c. Model Components
• Core Trajectory Prediction Models: Represent “src/models/TP” with various architectures such as TFCondARFlow, Trajectron, fastpredNF, and mgcvae.
• Sub-components of the models: Under components, illustrate elements like additive_attention, discrete_latent, graph_attention, and map_encoder. Also include the dynamics components (linear, single_integrator, unicycle, etc.) which handle motion modeling.
d. Training and Evaluation
• Training Pipeline: Represent the training script (src/train.py) which connects configurations, model instantiation, and data processing, showing the training flow into the model.
• Inference/Evaluation: Show the evaluation script (src/test.py) for running inference, along with the metric components (in the src/metrics directory) that compute ADE, FDE, etc. Mark the directional flow from trained model outputs to metric calculation.
e. Utility and Supporting Components
• Utility Functions: Group “src/utils/common.py” and any other helper functions or miscellaneous modules that support training and model evaluation.
• External Dependencies: Mention that the project uses PyTorch (as indicated by the paper and overall implementation), and include references to other libraries from the requirements.txt.
Relationships and Interactions
• Inference: Show how trained models (along with applied clustering) generate predictions that are then evaluated by the “Metrics” component.
Architectural Patterns and Design Principles
• Modular Design: Emphasize the separation of concerns with distinct modules for data handling, model definitions, training utilities, and evaluation.
• Pipeline Pattern: The overall flow (from raw data → processing → training/inference → evaluation) is critical and should be highlighted.
• Integration of Clustering: The system cleverly integrates a clustering mechanism (via pre-trained KMeans models) as an intermediate processing step to aid in prediction diversity.