# blassx/accident architecture

> Architecture diagram of the GitHub repository blassx/accident, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/blassx/accident
- Repository: https://github.com/blassx/accident

## Overview

ACCIDENT is a research repository for accident-video datasets, heuristic and LLM/VLM baselines, and CARLA-based synthetic-data generation. Researchers obtain or prepare the dataset, run baseline methods for temporal, spatial, and accident reasoning tasks, and can generate annotated synthetic scenarios through the CARLA client. The graph preserves those major capabilities and the generator’s scenario-to-simulation-to-annotation stages. Some baseline and generation branches are documented but not sampled in detail, so their internal links are omitted; cited relationships rely on the README or SOURCE INDEX references.

Main entry points: [`generation/carla-simulation/src/client/core/synthesizer.py`](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/synthesizer.py) (Simulation synthesizer), [`baselines/llm/baselines/temporal/main.py`](https://github.com/blassx/accident/blob/main/baselines/llm/baselines/temporal/main.py) (Temporal reasoning), [`dataset/accident_dataset.py`](https://github.com/blassx/accident/blob/main/dataset/accident_dataset.py) (Dataset files), [`generation/carla-simulation/src/client/runner.py`](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/runner.py) (Scenario runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Dataset"]
  node_dataset[("Dataset files")]
  node_download["Dataset download"]
end

subgraph group_heur["Heuristic baselines"]
  node_heuristic["Heuristic methods<br/>[naive.py]"]
  node_optical["Optical flow<br/>[optical_flow.py]"]
  node_bbox["Box dynamics<br/>[bbox_dynamics.py]"]
  node_metrics["Task metrics<br/>[metrics.py]"]
end

subgraph group_llm["LLM/VLM baselines"]
  node_temporal["Temporal reasoning<br/>[main.py]"]
  node_qwen["Qwen reasoner<br/>[qwen.py]"]
  node_molmo["Molmo reasoner<br/>[molmo.py]"]
  node_frames["Frame utilities<br/>[utils.py]"]
  node_llm_tasks["Spatial and classification"]
end

subgraph group_gen["Synthetic generation"]
  node_scenario["Scenario templates<br/>[scenario.py]"]
  node_runner["Scenario runner<br/>[runner.py]"]
  node_synth["Simulation synthesizer<br/>[synthesizer.py]"]
  node_actors["Actor setup<br/>[actors.py]"]
  node_sensors["Sensor capture<br/>[sensors.py]"]
  node_sync["Synchronized ticking"]
  node_segmentation["Box segmentation"]
  node_collision["Collision evaluation<br/>[collisions.py]"]
  node_annotation["Annotation output<br/>[carla_annotator.py]"]
  node_io["Simulation I/O<br/>[ioutils.py]"]
  node_gui["Visualization<br/>[gui_window.py]"]
end

node_researcher(("Researcher"))
node_carla["CARLA simulator"]

node_researcher -->|"downloads data"| node_download
node_download -->|"prepares layout"| node_dataset
node_researcher -->|"runs baseline"| node_heuristic
node_researcher -->|"runs baseline"| node_optical
node_researcher -->|"runs baseline"| node_bbox
node_heuristic -->|"loads dataset"| node_dataset
node_optical -->|"loads dataset"| node_dataset
node_bbox -->|"loads dataset"| node_dataset
node_heuristic -->|"evaluates predictions"| node_metrics
node_optical -->|"evaluates predictions"| node_metrics
node_bbox -->|"evaluates predictions"| node_metrics
node_researcher -->|"runs reasoning"| node_temporal
node_temporal -->|"loads metadata"| node_dataset
node_temporal -->|"selects model"| node_qwen
node_temporal -->|"selects model"| node_molmo
node_temporal -->|"samples frames"| node_frames
node_qwen -->|"uses utilities"| node_frames
node_researcher -->|"runs task notebooks"| node_llm_tasks
node_researcher -->|"configures scenarios"| node_scenario
node_scenario -->|"provides variants"| node_runner
node_runner -->|"runs simulation"| node_synth
node_runner -->|"loads templates"| node_scenario
node_runner -->|"configures annotator"| node_annotation
node_synth -->|"sets up actors"| node_actors
node_synth -->|"captures sensor data"| node_sensors
node_synth -->|"synchronizes ticks"| node_sync
node_synth -->|"processes boxes"| node_segmentation
node_synth -->|"evaluates collisions"| node_collision
node_synth -->|"writes annotations"| node_annotation
node_synth -->|"draws frames"| node_gui
node_scenario -->|"loads configuration"| node_io
node_segmentation -->|"uses conversions"| node_io
node_synth -.->|"controls world"| node_carla
node_researcher -->|"starts synthesis"| node_carla

click node_dataset "https://github.com/blassx/accident/blob/main/dataset/accident_dataset.py"
click node_download "https://github.com/blassx/accident/blob/main/dataset/download_dataset.sh"
click node_heuristic "https://github.com/blassx/accident/blob/main/baselines/heuristic/naive.py"
click node_optical "https://github.com/blassx/accident/blob/main/baselines/heuristic/optical_flow.py"
click node_bbox "https://github.com/blassx/accident/blob/main/baselines/heuristic/bbox_dynamics.py"
click node_metrics "https://github.com/blassx/accident/blob/main/baselines/heuristic/metrics.py"
click node_temporal "https://github.com/blassx/accident/blob/main/baselines/llm/baselines/temporal/main.py"
click node_qwen "https://github.com/blassx/accident/blob/main/baselines/llm/reasoning/qwen.py"
click node_molmo "https://github.com/blassx/accident/blob/main/baselines/llm/reasoning/molmo.py"
click node_frames "https://github.com/blassx/accident/blob/main/baselines/llm/reasoning/utils.py"
click node_llm_tasks "https://github.com/blassx/accident/tree/main/baselines/llm/baselines"
click node_scenario "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/scenario.py"
click node_runner "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/runner.py"
click node_synth "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/synthesizer.py"
click node_actors "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/actors.py"
click node_sensors "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/sensors.py"
click node_sync "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/synchronous_mode.py"
click node_segmentation "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/bbox_segmentation.py"
click node_collision "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/collisions.py"
click node_annotation "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/carla_annotator.py"
click node_io "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/ioutils.py"
click node_gui "https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/gui_window.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_dataset,node_download toneBlue
class node_heuristic,node_optical,node_bbox,node_metrics toneAmber
class node_temporal,node_qwen,node_molmo,node_frames,node_llm_tasks toneMint
class node_scenario,node_runner,node_synth,node_actors,node_sensors,node_sync,node_segmentation,node_collision,node_annotation,node_io,node_gui toneRose
class node_researcher,node_carla toneIndigo
```

## Components

### Dataset

- [Dataset files](https://github.com/blassx/accident/blob/main/dataset/accident_dataset.py): `dataset/accident_dataset.py`
- [Dataset download](https://github.com/blassx/accident/blob/main/dataset/download_dataset.sh): `dataset/download_dataset.sh`

### Heuristic baselines

- [Heuristic methods](https://github.com/blassx/accident/blob/main/baselines/heuristic/naive.py): `baselines/heuristic/naive.py`
- [Optical flow](https://github.com/blassx/accident/blob/main/baselines/heuristic/optical_flow.py): `baselines/heuristic/optical_flow.py`
- [Box dynamics](https://github.com/blassx/accident/blob/main/baselines/heuristic/bbox_dynamics.py): `baselines/heuristic/bbox_dynamics.py`
- [Task metrics](https://github.com/blassx/accident/blob/main/baselines/heuristic/metrics.py): `baselines/heuristic/metrics.py`

### LLM/VLM baselines

- [Temporal reasoning](https://github.com/blassx/accident/blob/main/baselines/llm/baselines/temporal/main.py): `baselines/llm/baselines/temporal/main.py`
- [Qwen reasoner](https://github.com/blassx/accident/blob/main/baselines/llm/reasoning/qwen.py): `baselines/llm/reasoning/qwen.py`
- [Molmo reasoner](https://github.com/blassx/accident/blob/main/baselines/llm/reasoning/molmo.py): `baselines/llm/reasoning/molmo.py`
- [Frame utilities](https://github.com/blassx/accident/blob/main/baselines/llm/reasoning/utils.py): `baselines/llm/reasoning/utils.py`
- [Spatial and classification](https://github.com/blassx/accident/tree/main/baselines/llm/baselines): `baselines/llm/baselines`

### Synthetic generation

- [Scenario templates](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/scenario.py): `generation/carla-simulation/src/client/scenario.py`
- [Scenario runner](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/runner.py): `generation/carla-simulation/src/client/runner.py`
- [Simulation synthesizer](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/synthesizer.py): `generation/carla-simulation/src/client/core/synthesizer.py`
- [Actor setup](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/actors.py): `generation/carla-simulation/src/client/core/actors.py`
- [Sensor capture](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/sensors.py): `generation/carla-simulation/src/client/core/sensors.py`
- [Synchronized ticking](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/synchronous_mode.py): `generation/carla-simulation/src/client/core/synchronous_mode.py`
- [Box segmentation](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/bbox_segmentation.py): `generation/carla-simulation/src/client/core/bbox_segmentation.py`
- [Collision evaluation](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/collisions.py): `generation/carla-simulation/src/client/core/collisions.py`
- [Annotation output](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/carla_annotator.py): `generation/carla-simulation/src/client/core/carla_annotator.py`
- [Simulation I/O](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/ioutils.py): `generation/carla-simulation/src/client/core/ioutils.py`
- [Visualization](https://github.com/blassx/accident/blob/main/generation/carla-simulation/src/client/core/gui_window.py): `generation/carla-simulation/src/client/core/gui_window.py`

### Other components

- **Researcher**
- **CARLA simulator**

## Connections

- Researcher → Dataset download: downloads data (evidence: `README.md`)
- Dataset download → Dataset files: prepares layout (evidence: `README.md`)
- Researcher → Heuristic methods: runs baseline (evidence: `README.md`)
- Researcher → Optical flow: runs baseline (evidence: `README.md`)
- Researcher → Box dynamics: runs baseline (evidence: `README.md`)
- Heuristic methods → Dataset files: loads dataset (evidence: `baselines/heuristic/naive.py`)
- Optical flow → Dataset files: loads dataset (evidence: `baselines/heuristic/optical_flow.py`)
- Box dynamics → Dataset files: loads dataset (evidence: `baselines/heuristic/bbox_dynamics.py`)
- Heuristic methods → Task metrics: evaluates predictions (evidence: `baselines/heuristic/naive.py`)
- Optical flow → Task metrics: evaluates predictions (evidence: `baselines/heuristic/optical_flow.py`)
- Box dynamics → Task metrics: evaluates predictions (evidence: `baselines/heuristic/bbox_dynamics.py`)
- Researcher → Temporal reasoning: runs reasoning (evidence: `README.md`)
- Temporal reasoning → Dataset files: loads metadata (evidence: `baselines/llm/baselines/temporal/main.py`)
- Temporal reasoning → Qwen reasoner: selects model (evidence: `baselines/llm/baselines/temporal/main.py`)
- Temporal reasoning → Molmo reasoner: selects model (evidence: `baselines/llm/baselines/temporal/main.py`)
- Temporal reasoning → Frame utilities: samples frames (evidence: `baselines/llm/baselines/temporal/main.py`)
- Qwen reasoner → Frame utilities: uses utilities (evidence: `baselines/llm/reasoning/qwen.py`)
- Researcher → Spatial and classification: runs task notebooks (evidence: `README.md`)
- Researcher → Scenario templates: configures scenarios (evidence: `generation/carla-simulation/src/client/scenario.py`)
- Scenario templates → Scenario runner: provides variants (evidence: `generation/carla-simulation/src/client/runner.py`)
- Scenario runner → Simulation synthesizer: runs simulation (evidence: `generation/carla-simulation/src/client/runner.py`)
- Scenario runner → Scenario templates: loads templates (evidence: `generation/carla-simulation/src/client/runner.py`)
- Scenario runner → Annotation output: configures annotator (evidence: `generation/carla-simulation/src/client/runner.py`)
- Simulation synthesizer → Actor setup: sets up actors (evidence: `generation/carla-simulation/src/client/core/synthesizer.py`)
- Simulation synthesizer → Sensor capture: captures sensor data (evidence: `generation/carla-simulation/src/client/core/synthesizer.py`)
- Simulation synthesizer → Synchronized ticking: synchronizes ticks (evidence: `generation/carla-simulation/src/client/core/synthesizer.py`)
- Simulation synthesizer → Box segmentation: processes boxes (evidence: `generation/carla-simulation/src/client/core/synthesizer.py`)
- Simulation synthesizer → Collision evaluation: evaluates collisions (evidence: `generation/carla-simulation/src/client/core/synthesizer.py`)
- Simulation synthesizer → Annotation output: writes annotations (evidence: `generation/carla-simulation/src/client/core/synthesizer.py`)
- Simulation synthesizer → Visualization: draws frames (evidence: `generation/carla-simulation/src/client/core/synthesizer.py`)
- Scenario templates → Simulation I/O: loads configuration (evidence: `generation/carla-simulation/src/client/scenario.py`)
- Box segmentation → Simulation I/O: uses conversions
- Simulation synthesizer → CARLA simulator: controls world
- Researcher → CARLA simulator: starts synthesis (evidence: `README.md`)
