# qing0v0/lvpnet architecture

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

- Interactive diagram: https://gitdiagram.com/qing0v0/lvpnet
- Repository: https://github.com/qing0v0/lvpnet

## Overview

This repository implements local-vanishing-point lane detection for TuSimple: prepare vanishing-point labels, train a dual-head network, then infer vanishing points and lane starting points, reconstruct lanes, and evaluate or visualize results. The map also preserves documented speed testing and augmentation. Training-loop internals are represented by their existing utility directory because their implementation was not sampled; uncertain calls from that layer are omitted.

Main entry points: [`train.py`](https://github.com/qing0v0/lvpnet/blob/main/train.py) (Training entry), [`eval.py`](https://github.com/qing0v0/lvpnet/blob/main/eval.py) (Evaluation entry), [`tools/save_vplabel_tusimple.py`](https://github.com/qing0v0/lvpnet/blob/main/tools/save_vplabel_tusimple.py) (VP label generation), [`model/LVPNet.py`](https://github.com/qing0v0/lvpnet/blob/main/model/LVPNet.py) (LVPNet)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_label_prep["VP label generation"]
  node_dataset["TuSimple loader"]
  node_augment["Image augmentation<br/>[transform.py]"]
end

subgraph group_learning["Model and training"]
  node_train["Training entry<br/>[train.py]"]
  node_network["LVPNet<br/>[LVPNet.py]"]
  node_fit["Epoch training<br/>[fit_utils.py]"]
  node_loss["Training losses<br/>[loss_function.py]"]
  node_loss_log["Loss logging<br/>[loss_log.py]"]
  node_checkpoint[("Model checkpoint")]
end

subgraph group_inference["Inference and evaluation"]
  node_eval["Evaluation entry<br/>[eval.py]"]
  node_metric["Lane benchmark<br/>[lane.py]"]
  node_speed["Speed test<br/>[speed_test.py]"]
end

subgraph group_support["Shared geometry"]
  node_geometry["VP geometry<br/>[vanishing_point.py]"]
  node_config["Runtime configuration<br/>[config_utils.py]"]
end

node_engineer(("Researcher"))
node_tusimple[("TuSimple data")]

node_engineer -->|"generates labels"| node_label_prep
node_tusimple -->|"provides annotations"| node_label_prep
node_label_prep -->|"derives VP labels"| node_geometry
node_label_prep -->|"writes VP labels"| node_tusimple
node_engineer -->|"starts training"| node_train
node_tusimple -->|"provides labeled images"| node_dataset
node_train -->|"loads samples"| node_dataset
node_train -->|"constructs model"| node_network
node_train -->|"runs epochs"| node_fit
node_fit -->|"records losses"| node_loss_log
node_train -->|"saves weights"| node_checkpoint
node_engineer -->|"runs evaluation"| node_eval
node_eval -->|"runs inference"| node_network
node_eval -->|"reconstructs lanes"| node_geometry
node_eval -->|"scores predictions"| node_metric
node_engineer -->|"measures speed"| node_speed
node_speed -->|"benchmarks model"| node_network
node_train -->|"loads settings"| node_config
node_eval -->|"loads settings"| node_config

click node_label_prep "https://github.com/qing0v0/lvpnet/blob/main/tools/save_vplabel_tusimple.py"
click node_dataset "https://github.com/qing0v0/lvpnet/blob/main/dataset/tusimple_dataloader.py"
click node_augment "https://github.com/qing0v0/lvpnet/blob/main/dataset/transform.py"
click node_train "https://github.com/qing0v0/lvpnet/blob/main/train.py"
click node_network "https://github.com/qing0v0/lvpnet/blob/main/model/LVPNet.py"
click node_fit "https://github.com/qing0v0/lvpnet/blob/main/utils/fit_utils.py"
click node_loss "https://github.com/qing0v0/lvpnet/blob/main/utils/loss_function.py"
click node_loss_log "https://github.com/qing0v0/lvpnet/blob/main/utils/loss_log.py"
click node_eval "https://github.com/qing0v0/lvpnet/blob/main/eval.py"
click node_geometry "https://github.com/qing0v0/lvpnet/blob/main/tools/vanishing_point.py"
click node_metric "https://github.com/qing0v0/lvpnet/blob/main/tools/lane.py"
click node_speed "https://github.com/qing0v0/lvpnet/blob/main/tools/speed_test.py"
click node_config "https://github.com/qing0v0/lvpnet/blob/main/utils/config_utils.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_label_prep,node_dataset,node_augment toneBlue
class node_train,node_network,node_fit,node_loss,node_loss_log,node_checkpoint,node_tusimple toneAmber
class node_eval,node_metric,node_speed toneMint
class node_geometry,node_config toneRose
class node_engineer toneIndigo
```

## Components

### Data preparation

- [VP label generation](https://github.com/qing0v0/lvpnet/blob/main/tools/save_vplabel_tusimple.py): `tools/save_vplabel_tusimple.py`
- [TuSimple loader](https://github.com/qing0v0/lvpnet/blob/main/dataset/tusimple_dataloader.py): `dataset/tusimple_dataloader.py`
- [Image augmentation](https://github.com/qing0v0/lvpnet/blob/main/dataset/transform.py): `dataset/transform.py`

### Model and training

- [Training entry](https://github.com/qing0v0/lvpnet/blob/main/train.py): `train.py`
- [LVPNet](https://github.com/qing0v0/lvpnet/blob/main/model/LVPNet.py): `model/LVPNet.py`
- [Epoch training](https://github.com/qing0v0/lvpnet/blob/main/utils/fit_utils.py): `utils/fit_utils.py`
- [Training losses](https://github.com/qing0v0/lvpnet/blob/main/utils/loss_function.py): `utils/loss_function.py`
- [Loss logging](https://github.com/qing0v0/lvpnet/blob/main/utils/loss_log.py): `utils/loss_log.py`
- **Model checkpoint**

### Inference and evaluation

- [Evaluation entry](https://github.com/qing0v0/lvpnet/blob/main/eval.py): `eval.py`
- [Lane benchmark](https://github.com/qing0v0/lvpnet/blob/main/tools/lane.py): `tools/lane.py`
- [Speed test](https://github.com/qing0v0/lvpnet/blob/main/tools/speed_test.py): `tools/speed_test.py`

### Shared geometry

- [VP geometry](https://github.com/qing0v0/lvpnet/blob/main/tools/vanishing_point.py): `tools/vanishing_point.py`
- [Runtime configuration](https://github.com/qing0v0/lvpnet/blob/main/utils/config_utils.py): `utils/config_utils.py`

### Other components

- **Researcher**
- **TuSimple data**

## Connections

- Researcher → VP label generation: generates labels
- TuSimple data → VP label generation: provides annotations
- VP label generation → VP geometry: derives VP labels
- VP label generation → TuSimple data: writes VP labels
- Researcher → Training entry: starts training
- TuSimple data → TuSimple loader: provides labeled images
- Training entry → TuSimple loader: loads samples
- Training entry → LVPNet: constructs model
- Training entry → Epoch training: runs epochs
- Epoch training → Loss logging: records losses
- Training entry → Model checkpoint: saves weights
- Researcher → Evaluation entry: runs evaluation
- Evaluation entry → LVPNet: runs inference
- Evaluation entry → VP geometry: reconstructs lanes
- Evaluation entry → Lane benchmark: scores predictions
- Researcher → Speed test: measures speed
- Speed test → LVPNet: benchmarks model
- Training entry → Runtime configuration: loads settings
- Evaluation entry → Runtime configuration: loads settings
