# srijanpal07/temporal-lidar-camera-bev-fusion architecture

> Architecture diagram of the GitHub repository srijanpal07/temporal-lidar-camera-bev-fusion, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srijanpal07/temporal-lidar-camera-bev-fusion
- Repository: https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion

## Overview

This repository is a research pipeline for estimating target-vehicle velocity from temporal LiDAR bird’s-eye-view data, vehicle crops, and 3D box kinematics. The main workflow prepares and filters nuScenes data, generates BEV samples, trains a temporal predictor, then evaluates it on validation windows and saves predictions. A separate BEVFormer branch evaluates camera-detected boxes and fine-tunes the predictor on matched windows. The README documents these stages; source excerpts additionally show dataset augmentation, Kalman kinematics, model inputs, and training/inference calls. Some preparation and matching internals were not sampled, so their links rely on README statements.

Main entry points: [`src/dataset.py`](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/dataset.py) (Temporal window dataset), [`scripts/train.py`](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/train.py) (Train predictor), [`scripts/infer.py`](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/infer.py) (Validation inference), [`scripts/finetune_bevformer.py`](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/finetune_bevformer.py) (Fine-tune on matches)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_prepare["Merge dataset blobs<br/>[prepare_dataset.py]"]
  node_filter["Select vehicle instances<br/>[filter_dataset.py]"]
  node_bevgen["Generate BEV samples<br/>[save_bev.py]"]
  node_bevcheck["Validate BEV samples<br/>[check_bev.py]"]
end

subgraph group_learning["Model and training"]
  node_dataset["Temporal window dataset<br/>[dataset.py]"]
  node_noise["Camera box noise<br/>[box_noise.py]"]
  node_kalman["Velocity smoothing<br/>[kalman.py]"]
  node_model["Temporal velocity predictor<br/>[model.py]"]
  node_train["Train predictor<br/>[train.py]"]
end

subgraph group_evaluation["Evaluation and adaptation"]
  node_infer["Validation inference<br/>[infer.py]"]
  node_match["Match BEVFormer windows"]
  node_bevformer_eval["Evaluate detector boxes"]
  node_finetune["Fine-tune on matches"]
  node_curves["Velocity curve analysis"]
end

subgraph group_state["Data and artifacts"]
  node_bevdata[("BEV data and metadata")]
  node_traincfg["Training configuration<br/>[train.yaml]"]
  node_checkpoint[("Model checkpoints<br/>[best_model.pt]")]
  node_predictions["Velocity predictions<br/>[predictions.json]"]
  node_finetuned[("Fine-tuned checkpoint")]
end

node_nuscenes(("nuScenes source"))
node_bevformer["BEVFormer detections"]

node_nuscenes -->|"provides blobs"| node_prepare
node_nuscenes -->|"provides scenes"| node_filter
node_prepare -->|"merges files"| node_bevdata
node_filter -->|"selects instances"| node_bevgen
node_bevgen -->|"writes BEV data"| node_bevdata
node_bevdata -->|"checks samples"| node_bevcheck
node_bevdata -->|"loads windows"| node_dataset
node_dataset -->|"adds box noise"| node_noise
node_dataset -->|"estimates velocity"| node_kalman
node_traincfg -->|"configures training"| node_train
node_train -->|"builds samples"| node_dataset
node_train -->|"optimizes"| node_model
node_train -->|"saves weights"| node_checkpoint
node_checkpoint -->|"loads weights"| node_infer
node_infer -->|"builds validation windows"| node_dataset
node_infer -->|"predicts velocity"| node_model
node_infer -->|"writes results"| node_predictions
node_bevformer -.->|"supplies detections"| node_match
node_match -->|"provides matched windows"| node_finetune
node_match -.->|"provides matched windows"| node_bevformer_eval
node_checkpoint -->|"loads pretrained weights"| node_bevformer_eval
node_bevformer -->|"provides input boxes"| node_bevformer_eval
node_bevformer -->|"provides detector boxes"| node_finetune
node_finetune -->|"updates predictor"| node_model
node_finetune -->|"saves adapted weights"| node_finetuned
node_finetuned -.->|"evaluates adapted model"| node_bevformer_eval
node_predictions -->|"plots velocity trends"| node_curves
node_dataset -->|"provides validation windows"| node_curves

click node_prepare "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/prepare_dataset.py"
click node_filter "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/filter_dataset.py"
click node_bevgen "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/save_bev.py"
click node_bevcheck "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/check_bev.py"
click node_bevdata "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/tree/main/datasets"
click node_traincfg "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/configs/train.yaml"
click node_dataset "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/dataset.py"
click node_noise "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/box_noise.py"
click node_kalman "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/kalman.py"
click node_model "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/model.py"
click node_train "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/train.py"
click node_checkpoint "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/outputs/runs/residual_model/models/best_model.pt"
click node_infer "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/infer.py"
click node_predictions "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/outputs/results/predictions.json"
click node_match "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/match_bevformer_instances.py"
click node_bevformer_eval "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/infer_with_bevformer_boxes.py"
click node_finetune "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/finetune_bevformer.py"
click node_finetuned "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/outputs/runs/residual_model/models/best_model_finetuned.pt"
click node_curves "https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/plot_velocity_curves.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_prepare,node_filter,node_bevgen,node_bevcheck toneBlue
class node_dataset,node_noise,node_kalman,node_model,node_train toneAmber
class node_infer,node_match,node_bevformer_eval,node_finetune,node_curves toneMint
class node_bevdata,node_traincfg,node_checkpoint,node_predictions,node_finetuned toneRose
class node_nuscenes,node_bevformer toneIndigo
```

## Components

### Data preparation

- [Merge dataset blobs](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/prepare_dataset.py): `scripts/prepare_dataset.py`
- [Select vehicle instances](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/filter_dataset.py): `scripts/filter_dataset.py`
- [Generate BEV samples](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/save_bev.py): `scripts/save_bev.py`
- [Validate BEV samples](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/check_bev.py): `scripts/check_bev.py`

### Model and training

- [Temporal window dataset](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/dataset.py): `src/dataset.py`
- [Camera box noise](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/box_noise.py): `src/box_noise.py`
- [Velocity smoothing](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/kalman.py): `src/kalman.py`
- [Temporal velocity predictor](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/src/model.py): `src/model.py`
- [Train predictor](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/train.py): `scripts/train.py`

### Evaluation and adaptation

- [Validation inference](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/infer.py): `scripts/infer.py`
- [Match BEVFormer windows](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/match_bevformer_instances.py): `scripts/match_bevformer_instances.py`
- [Evaluate detector boxes](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/infer_with_bevformer_boxes.py): `scripts/infer_with_bevformer_boxes.py`
- [Fine-tune on matches](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/finetune_bevformer.py): `scripts/finetune_bevformer.py`
- [Velocity curve analysis](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/scripts/plot_velocity_curves.py): `scripts/plot_velocity_curves.py`

### Data and artifacts

- [BEV data and metadata](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/tree/main/datasets): `datasets`
- [Training configuration](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/configs/train.yaml): `configs/train.yaml`
- [Model checkpoints](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/outputs/runs/residual_model/models/best_model.pt): `outputs/runs/residual_model/models/best_model.pt`
- [Velocity predictions](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/outputs/results/predictions.json): `outputs/results/predictions.json`
- [Fine-tuned checkpoint](https://github.com/srijanpal07/temporal-lidar-camera-bev-fusion/blob/main/outputs/runs/residual_model/models/best_model_finetuned.pt): `outputs/runs/residual_model/models/best_model_finetuned.pt`

### Other components

- **nuScenes source**
- **BEVFormer detections**

## Connections

- nuScenes source → Merge dataset blobs: provides blobs (evidence: `README.md`)
- nuScenes source → Select vehicle instances: provides scenes (evidence: `README.md`)
- Merge dataset blobs → BEV data and metadata: merges files (evidence: `README.md`)
- Select vehicle instances → Generate BEV samples: selects instances (evidence: `README.md`)
- Generate BEV samples → BEV data and metadata: writes BEV data (evidence: `README.md`)
- BEV data and metadata → Validate BEV samples: checks samples (evidence: `README.md`)
- BEV data and metadata → Temporal window dataset: loads windows (evidence: `src/dataset.py`)
- Temporal window dataset → Camera box noise: adds box noise (evidence: `src/dataset.py`)
- Temporal window dataset → Velocity smoothing: estimates velocity (evidence: `src/dataset.py`)
- Training configuration → Train predictor: configures training (evidence: `scripts/train.py`)
- Train predictor → Temporal window dataset: builds samples (evidence: `scripts/train.py`)
- Train predictor → Temporal velocity predictor: optimizes (evidence: `README.md`)
- Train predictor → Model checkpoints: saves weights (evidence: `README.md`)
- Model checkpoints → Validation inference: loads weights (evidence: `scripts/infer.py`)
- Validation inference → Temporal window dataset: builds validation windows (evidence: `scripts/infer.py`)
- Validation inference → Temporal velocity predictor: predicts velocity (evidence: `scripts/infer.py`)
- Validation inference → Velocity predictions: writes results (evidence: `README.md`)
- BEVFormer detections → Match BEVFormer windows: supplies detections
- Match BEVFormer windows → Fine-tune on matches: provides matched windows (evidence: `README.md`)
- Match BEVFormer windows → Evaluate detector boxes: provides matched windows
- Model checkpoints → Evaluate detector boxes: loads pretrained weights (evidence: `scripts/infer_with_bevformer_boxes.py`)
- BEVFormer detections → Evaluate detector boxes: provides input boxes (evidence: `scripts/infer_with_bevformer_boxes.py`)
- BEVFormer detections → Fine-tune on matches: provides detector boxes (evidence: `scripts/finetune_bevformer.py`)
- Fine-tune on matches → Temporal velocity predictor: updates predictor (evidence: `README.md`)
- Fine-tune on matches → Fine-tuned checkpoint: saves adapted weights (evidence: `README.md`)
- Fine-tuned checkpoint → Evaluate detector boxes: evaluates adapted model
- Velocity predictions → Velocity curve analysis: plots velocity trends (evidence: `scripts/plot_velocity_curves.py`)
- Temporal window dataset → Velocity curve analysis: provides validation windows (evidence: `scripts/plot_velocity_curves.py`)
