# yuyang-cloud/drive-occworld architecture

> Architecture diagram of the GitHub repository yuyang-cloud/drive-occworld, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yuyang-cloud/drive-occworld
- Repository: https://github.com/yuyang-cloud/drive-occworld

## Overview

Drive-OccWorld is a vision-centric autonomous-driving system for action-conditioned 4D occupancy and flow forecasting, with trajectory planning over predicted futures. Its principal workflow converts NuScenes data into model inputs, trains or runs a BEV-based model, forecasts future occupancy, and evaluates candidate plans using occupancy-based costs. The graph preserves documented capabilities; several subsystem links are supported only by the README because their implementing sources were not sampled.

Main entry points: [`projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py`](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py) (Occupancy world model), [`projects/mmdet3d_plugin/bevformer/detectors/bevformer.py`](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/detectors/bevformer.py) (BEV detector), [`tools/train.py`](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/tools/train.py) (Training entry), [`projects/mmdet3d_plugin/bevformer/dense_heads/plan_head.py`](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/dense_heads/plan_head.py) (Trajectory planner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and training"]
  node_converter["NuScenes conversion"]
  node_prep["Data preparation<br/>[create_data.py]"]
  node_dataset["NuScenes datasets"]
  node_train["Training entry<br/>[train.py]"]
  node_trainapi["Training API<br/>[train.py]"]
end

subgraph group_perception["BEV perception"]
  node_backbone["Image backbone<br/>[internimage.py]"]
  node_bevformer["BEV detector<br/>[bevformer.py]"]
  node_dethead["Detection head<br/>[bevformer_head.py]"]
end

subgraph group_world["World modeling"]
  node_occworld["Occupancy world model<br/>[drive_occworld.py]"]
  node_worlddecoder["Future decoder<br/>[world_decoder.py]"]
  node_transformlayer["Transformer layer"]
end

subgraph group_planning["Planning and evaluation"]
  node_planhead["Trajectory planner<br/>[plan_head.py]"]
  node_cost["Occupancy cost<br/>[cost.py]"]
  node_planmetrics["Planning metrics"]
  node_occmetrics["Occupancy metrics<br/>[metric_stp3.py]"]
end

node_user(("Driving user"))
node_nuscenes[("NuScenes data")]
node_result["Forecast and plan"]

node_user -->|"provides scenes"| node_nuscenes
node_nuscenes -->|"converts data"| node_converter
node_converter -->|"invoked by"| node_prep
node_prep -.->|"prepares inputs"| node_dataset
node_train -->|"selects API"| node_trainapi
node_train -.->|"builds dataset"| node_dataset
node_train -.->|"builds model"| node_bevformer
node_dataset -.->|"supplies observations"| node_bevformer
node_backbone -.->|"extracts features"| node_bevformer
node_bevformer -.->|"predicts detections"| node_dethead
node_occworld -->|"extends detector"| node_bevformer
node_occworld -.->|"decodes futures"| node_worlddecoder
node_worlddecoder -->|"uses layers"| node_transformlayer
node_occworld -.->|"plans trajectories"| node_planhead
node_planhead -.->|"scores candidates"| node_cost
node_occworld -->|"computes metrics"| node_planmetrics
node_occworld -->|"computes metrics"| node_occmetrics
node_occworld -->|"returns forecasts"| node_result
node_planhead -.->|"returns plans"| node_result

click node_converter "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/tools/data_converter/nuscenes_converter.py"
click node_prep "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/tools/create_data.py"
click node_dataset "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/datasets/nuscenes_world_dataset_template.py"
click node_train "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/tools/train.py"
click node_trainapi "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/apis/train.py"
click node_backbone "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/backbones/internimage.py"
click node_bevformer "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/detectors/bevformer.py"
click node_dethead "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/dense_heads/bevformer_head.py"
click node_occworld "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py"
click node_worlddecoder "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/modules/world_decoder.py"
click node_transformlayer "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/modules/custom_base_transformer_layer.py"
click node_planhead "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/dense_heads/plan_head.py"
click node_cost "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/utils/cost.py"
click node_planmetrics "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/utils/planning_metrics.py"
click node_occmetrics "https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/utils/metric_stp3.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_converter,node_prep,node_dataset,node_train,node_trainapi,node_user toneBlue
class node_backbone,node_bevformer,node_dethead,node_nuscenes toneAmber
class node_occworld,node_worlddecoder,node_transformlayer toneMint
class node_planhead,node_cost,node_planmetrics,node_occmetrics toneRose
class node_result toneIndigo
```

## Components

### Data and training

- [NuScenes conversion](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/tools/data_converter/nuscenes_converter.py): `tools/data_converter/nuscenes_converter.py`
- [Data preparation](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/tools/create_data.py): `tools/create_data.py`
- [NuScenes datasets](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/datasets/nuscenes_world_dataset_template.py): `projects/mmdet3d_plugin/datasets/nuscenes_world_dataset_template.py`
- [Training entry](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/tools/train.py): `tools/train.py`
- [Training API](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/apis/train.py): `projects/mmdet3d_plugin/bevformer/apis/train.py`

### BEV perception

- [Image backbone](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/backbones/internimage.py): `projects/mmdet3d_plugin/bevformer/backbones/internimage.py`
- [BEV detector](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/detectors/bevformer.py): `projects/mmdet3d_plugin/bevformer/detectors/bevformer.py`
- [Detection head](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/dense_heads/bevformer_head.py): `projects/mmdet3d_plugin/bevformer/dense_heads/bevformer_head.py`

### World modeling

- [Occupancy world model](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py): `projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py`
- [Future decoder](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/modules/world_decoder.py): `projects/mmdet3d_plugin/bevformer/modules/world_decoder.py`
- [Transformer layer](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/modules/custom_base_transformer_layer.py): `projects/mmdet3d_plugin/bevformer/modules/custom_base_transformer_layer.py`

### Planning and evaluation

- [Trajectory planner](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/dense_heads/plan_head.py): `projects/mmdet3d_plugin/bevformer/dense_heads/plan_head.py`
- [Occupancy cost](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/utils/cost.py): `projects/mmdet3d_plugin/bevformer/utils/cost.py`
- [Planning metrics](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/utils/planning_metrics.py): `projects/mmdet3d_plugin/bevformer/utils/planning_metrics.py`
- [Occupancy metrics](https://github.com/yuyang-cloud/Drive-OccWorld/blob/main/projects/mmdet3d_plugin/bevformer/utils/metric_stp3.py): `projects/mmdet3d_plugin/bevformer/utils/metric_stp3.py`

### Other components

- **Driving user**
- **NuScenes data**
- **Forecast and plan**

## Connections

- Driving user → NuScenes data: provides scenes
- NuScenes data → NuScenes conversion: converts data (evidence: `tools/data_converter/nuscenes_converter.py`)
- NuScenes conversion → Data preparation: invoked by (evidence: `tools/create_data.py`)
- Data preparation → NuScenes datasets: prepares inputs
- Training entry → Training API: selects API (evidence: `tools/train.py`)
- Training entry → NuScenes datasets: builds dataset
- Training entry → BEV detector: builds model
- NuScenes datasets → BEV detector: supplies observations
- Image backbone → BEV detector: extracts features
- BEV detector → Detection head: predicts detections
- Occupancy world model → BEV detector: extends detector (evidence: `projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py`)
- Occupancy world model → Future decoder: decodes futures
- Future decoder → Transformer layer: uses layers (evidence: `projects/mmdet3d_plugin/bevformer/modules/world_decoder.py`)
- Occupancy world model → Trajectory planner: plans trajectories
- Trajectory planner → Occupancy cost: scores candidates
- Occupancy world model → Planning metrics: computes metrics (evidence: `projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py`)
- Occupancy world model → Occupancy metrics: computes metrics (evidence: `projects/mmdet3d_plugin/bevformer/detectors/drive_occworld.py`)
- Occupancy world model → Forecast and plan: returns forecasts
- Trajectory planner → Forecast and plan: returns plans
