# myatthukyaw/ego-vision architecture

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

- Interactive diagram: https://gitdiagram.com/myatthukyaw/ego-vision
- Repository: https://github.com/myatthukyaw/ego-vision

## Overview

Ego Vision predicts driving actions from dashcam video: it reads frames, detects and tracks road objects, estimates their distances and motion, evaluates the scene against ordered driving rules, and renders the result. The graph preserves documented capabilities including traffic-light color classification, bird’s-eye visualization, and the status HUD. The README documents the high-level workflow; several links below reflect that documentation because the pipeline and some modules were not excerpted.

Main entry points: [`ego_vision/pipeline.py`](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/pipeline.py) (Frame pipeline), [`ego_vision/reasoning/scene_state.py`](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/scene_state.py) (Scene assembly), [`ego_vision/reasoning/distance.py`](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/distance.py) (Distance sampling), [`ego_vision/reasoning/ego_zone.py`](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/ego_zone.py) (Ego-zone geometry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Video and perception"]
  node_pipeline["Frame pipeline<br/>[pipeline.py]"]
  node_reader["Video reader<br/>[video_reader.py]"]
  node_detector["YOLO tracker<br/>[detector.py]"]
  node_light["Light classifier"]
  node_depth["Depth estimator<br/>[depth_estimator.py]"]
  node_resize["Inference resizer"]
  node_lane["Lane detector<br/>[lane_detector.py]"]
  node_settings["Runtime settings<br/>[settings.py]"]
end

subgraph group_reasoning["Scene reasoning"]
  node_distance["Distance sampling<br/>[distance.py]"]
  node_zone["Ego-zone geometry<br/>[ego_zone.py]"]
  node_ttc["Time to collision<br/>[ttc.py]"]
  node_speed["Speed estimator<br/>[speed.py]"]
  node_scene["Scene assembly<br/>[scene_state.py]"]
end

subgraph group_decision["Action decision"]
  node_rules["Driving rules<br/>[rule_engine.py]"]
end

subgraph group_display["Visualization"]
  node_overlay["Detection overlay<br/>[overlay.py]"]
  node_hud["Action and status HUD<br/>[hud.py]"]
  node_bev["Bird’s-eye map<br/>[bev_map.py]"]
  node_common["Visualization helpers<br/>[common.py]"]
end

node_driver(("Video user"))
node_result(("Live or saved video"))

node_driver -->|"provides video"| node_pipeline
node_pipeline -->|"reads frames"| node_reader
node_pipeline -->|"detects and tracks"| node_detector
node_detector -->|"classifies lights"| node_light
node_pipeline -->|"estimates depth"| node_depth
node_pipeline -->|"samples distances"| node_distance
node_depth -->|"provides depth map"| node_distance
node_distance -.->|"supplies distances"| node_scene
node_pipeline -->|"builds path zone"| node_zone
node_scene -->|"tests object zones"| node_zone
node_pipeline -->|"estimates impact time"| node_ttc
node_pipeline -->|"assembles scene"| node_scene
node_ttc -.->|"supplies TTC"| node_scene
node_scene -->|"provides scene state"| node_rules
node_rules -.->|"returns action"| node_pipeline
node_pipeline -.->|"may estimate speed"| node_speed
node_pipeline -->|"draws detections"| node_overlay
node_pipeline -->|"renders action"| node_hud
node_pipeline -->|"plots detections"| node_bev
node_overlay -->|"uses scaling"| node_common
node_hud -->|"uses panels"| node_common
node_bev -->|"uses panels"| node_common
node_pipeline -->|"shows or saves"| node_result
node_lane -.->|"could refine zone"| node_zone

click node_pipeline "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/pipeline.py"
click node_reader "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/ingest/video_reader.py"
click node_detector "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/detector.py"
click node_light "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/light_classifier.py"
click node_depth "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/depth_estimator.py"
click node_resize "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/inference_resizer.py"
click node_lane "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/lane_detector.py"
click node_settings "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/config/settings.py"
click node_distance "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/distance.py"
click node_zone "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/ego_zone.py"
click node_ttc "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/ttc.py"
click node_speed "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/speed.py"
click node_scene "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/scene_state.py"
click node_rules "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/decision/rule_engine.py"
click node_overlay "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/viz/overlay.py"
click node_hud "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/viz/hud.py"
click node_bev "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/viz/bev_map.py"
click node_common "https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/viz/common.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_pipeline,node_reader,node_detector,node_light,node_depth,node_resize,node_lane,node_settings,node_driver toneBlue
class node_distance,node_zone,node_ttc,node_speed,node_scene toneAmber
class node_rules toneMint
class node_overlay,node_hud,node_bev,node_common toneRose
class node_result toneIndigo
```

## Components

### Video and perception

- [Frame pipeline](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/pipeline.py): `ego_vision/pipeline.py`
- [Video reader](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/ingest/video_reader.py): `ego_vision/ingest/video_reader.py`
- [YOLO tracker](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/detector.py): `ego_vision/perception/detector.py`
- [Light classifier](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/light_classifier.py): `ego_vision/perception/light_classifier.py`
- [Depth estimator](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/depth_estimator.py): `ego_vision/perception/depth_estimator.py`
- [Inference resizer](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/inference_resizer.py): `ego_vision/perception/inference_resizer.py`
- [Lane detector](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/perception/lane_detector.py): `ego_vision/perception/lane_detector.py`
- [Runtime settings](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/config/settings.py): `ego_vision/config/settings.py`

### Scene reasoning

- [Distance sampling](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/distance.py): `ego_vision/reasoning/distance.py`
- [Ego-zone geometry](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/ego_zone.py): `ego_vision/reasoning/ego_zone.py`
- [Time to collision](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/ttc.py): `ego_vision/reasoning/ttc.py`
- [Speed estimator](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/speed.py): `ego_vision/reasoning/speed.py`
- [Scene assembly](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/reasoning/scene_state.py): `ego_vision/reasoning/scene_state.py`

### Action decision

- [Driving rules](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/decision/rule_engine.py): `ego_vision/decision/rule_engine.py`

### Visualization

- [Detection overlay](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/viz/overlay.py): `ego_vision/viz/overlay.py`
- [Action and status HUD](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/viz/hud.py): `ego_vision/viz/hud.py`
- [Bird’s-eye map](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/viz/bev_map.py): `ego_vision/viz/bev_map.py`
- [Visualization helpers](https://github.com/myatthukyaw/ego-vision/blob/main/ego_vision/viz/common.py): `ego_vision/viz/common.py`

### Other components

- **Video user**
- **Live or saved video**

## Connections

- Video user → Frame pipeline: provides video (evidence: `README.md`)
- Frame pipeline → Video reader: reads frames (evidence: `README.md`)
- Frame pipeline → YOLO tracker: detects and tracks (evidence: `README.md`)
- YOLO tracker → Light classifier: classifies lights (evidence: `README.md`)
- Frame pipeline → Depth estimator: estimates depth (evidence: `README.md`)
- Frame pipeline → Distance sampling: samples distances (evidence: `README.md`)
- Depth estimator → Distance sampling: provides depth map (evidence: `README.md`)
- Distance sampling → Scene assembly: supplies distances
- Frame pipeline → Ego-zone geometry: builds path zone (evidence: `README.md`)
- Scene assembly → Ego-zone geometry: tests object zones (evidence: `ego_vision/reasoning/scene_state.py`)
- Frame pipeline → Time to collision: estimates impact time (evidence: `README.md`)
- Frame pipeline → Scene assembly: assembles scene (evidence: `README.md`)
- Time to collision → Scene assembly: supplies TTC
- Scene assembly → Driving rules: provides scene state (evidence: `README.md`)
- Driving rules → Frame pipeline: returns action
- Frame pipeline → Speed estimator: may estimate speed (evidence: `README.md`)
- Frame pipeline → Detection overlay: draws detections (evidence: `README.md`)
- Frame pipeline → Action and status HUD: renders action (evidence: `README.md`)
- Frame pipeline → Bird’s-eye map: plots detections (evidence: `README.md`)
- Detection overlay → Visualization helpers: uses scaling (evidence: `ego_vision/viz/overlay.py`)
- Action and status HUD → Visualization helpers: uses panels (evidence: `ego_vision/viz/hud.py`)
- Bird’s-eye map → Visualization helpers: uses panels (evidence: `ego_vision/viz/bev_map.py`)
- Frame pipeline → Live or saved video: shows or saves (evidence: `README.md`)
- Lane detector → Ego-zone geometry: could refine zone
