# wangsuibao/dsfa architecture

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

- Interactive diagram: https://gitdiagram.com/wangsuibao/dsfa
- Repository: https://github.com/wangsuibao/dsfa

## Overview

DSFA turns labeled seismic volumes into per-section seismic-facies segmentations. The principal workflow is configured training (optionally adversarial), held-out section inference, and accuracy/confusion-matrix review. The graph also retains the documented alternative U-Net architectures and loss choices. Some testing, metrics, and model-saving details are documented but their implementation excerpts were not provided, so those links rely on the README rather than claims of source inspection.

Main entry points: [`train_U.py`](https://github.com/wangsuibao/dsfa/blob/main/train_U.py) (U-Net training), [`train_U_D.py`](https://github.com/wangsuibao/dsfa/blob/main/train_U_D.py) (Adversarial training), [`test_test.py`](https://github.com/wangsuibao/dsfa/blob/main/test_test.py) (Section inference), [`dataset.py`](https://github.com/wangsuibao/dsfa/blob/main/dataset.py) (Section loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_volumes[("Seismic volumes")]
  node_splits["Section splits<br/>[section_train.txt]"]
  node_section_loader["Section loader<br/>[dataset.py]"]
  node_split_utils["Split utilities<br/>[utils.py]"]
end

subgraph group_learning["Model training"]
  node_settings["Hyperparameters<br/>[setting.py]"]
  node_baseline_train["U-Net training<br/>[train_U.py]"]
  node_gan_train["Adversarial training<br/>[train_U_D.py]"]
  node_losses["Segmentation losses<br/>[loss.py]"]
end

subgraph group_architectures["Segmentation models"]
  node_unet_gan["Pix2pix U-Net<br/>[modelG.py]"]
  node_deep_unet["Deep U-Net variant<br/>[modelG8.py]"]
  node_classic_unet["Classic U-Net<br/>[base_model.py]"]
  node_u_model["U-Net experiments<br/>[U_model.py]"]
  node_model_blocks["Model blocks<br/>[ModelBlock.py]"]
end

subgraph group_review["Inference and review"]
  node_metrics["Evaluation metrics<br/>[metrics.py]"]
  node_test_sections["Section inference<br/>[test_test.py]"]
  node_saved_models["Trained checkpoints"]
  node_result_scores["Test scores"]
  node_result_view["Result visualization<br/>[show_result.py]"]
end

node_engineer(("Researcher"))

node_engineer -->|"sets parameters"| node_settings
node_volumes -->|"provides labeled data"| node_section_loader
node_split_utils -->|"writes section splits"| node_splits
node_baseline_train -->|"creates splits"| node_split_utils
node_gan_train -->|"creates splits"| node_split_utils
node_baseline_train -->|"reads configuration"| node_settings
node_gan_train -->|"reads configuration"| node_settings
node_baseline_train -->|"loads sections"| node_section_loader
node_gan_train -->|"loads sections"| node_section_loader
node_baseline_train -->|"selects loss"| node_losses
node_baseline_train -->|"selects generator"| node_unet_gan
node_gan_train -->|"uses generator"| node_unet_gan
node_gan_train -->|"computes pixel loss"| node_losses
node_gan_train -.->|"saves checkpoints"| node_saved_models
node_baseline_train -.->|"saves checkpoints"| node_saved_models
node_engineer -->|"trains baseline"| node_baseline_train
node_engineer -->|"trains DSFA"| node_gan_train
node_saved_models -.->|"provides model"| node_test_sections
node_splits -.->|"selects test sections"| node_test_sections
node_test_sections -.->|"loads test data"| node_section_loader
node_test_sections -.->|"calculates accuracy"| node_metrics
node_test_sections -.->|"writes scores"| node_result_scores
node_result_scores -->|"reads scores"| node_result_view
node_engineer -->|"runs inference"| node_test_sections
node_engineer -->|"reviews results"| node_result_view

click node_splits "https://github.com/wangsuibao/dsfa/blob/main/data/F3/splits/section_train.txt"
click node_section_loader "https://github.com/wangsuibao/dsfa/blob/main/dataset.py"
click node_split_utils "https://github.com/wangsuibao/dsfa/blob/main/model/utils.py"
click node_settings "https://github.com/wangsuibao/dsfa/blob/main/setting.py"
click node_baseline_train "https://github.com/wangsuibao/dsfa/blob/main/train_U.py"
click node_gan_train "https://github.com/wangsuibao/dsfa/blob/main/train_U_D.py"
click node_losses "https://github.com/wangsuibao/dsfa/blob/main/model/loss.py"
click node_metrics "https://github.com/wangsuibao/dsfa/blob/main/model/metrics.py"
click node_unet_gan "https://github.com/wangsuibao/dsfa/blob/main/model/modelG.py"
click node_deep_unet "https://github.com/wangsuibao/dsfa/blob/main/model/modelG8.py"
click node_classic_unet "https://github.com/wangsuibao/dsfa/blob/main/model/base_model.py"
click node_u_model "https://github.com/wangsuibao/dsfa/blob/main/model/U_model.py"
click node_model_blocks "https://github.com/wangsuibao/dsfa/blob/main/model/ModelBlock.py"
click node_test_sections "https://github.com/wangsuibao/dsfa/blob/main/test_test.py"
click node_saved_models "https://github.com/wangsuibao/dsfa/tree/main/save_train_models"
click node_result_scores "https://github.com/wangsuibao/dsfa/tree/main/result"
click node_result_view "https://github.com/wangsuibao/dsfa/blob/main/show_result.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_volumes,node_splits,node_section_loader,node_split_utils toneBlue
class node_settings,node_baseline_train,node_gan_train,node_losses toneAmber
class node_unet_gan,node_deep_unet,node_classic_unet,node_u_model,node_model_blocks toneMint
class node_metrics,node_test_sections,node_saved_models,node_result_scores,node_result_view toneRose
class node_engineer toneIndigo
```

## Components

### Data preparation

- **Seismic volumes**
- [Section splits](https://github.com/wangsuibao/dsfa/blob/main/data/F3/splits/section_train.txt): `data/F3/splits/section_train.txt`
- [Section loader](https://github.com/wangsuibao/dsfa/blob/main/dataset.py): `dataset.py`
- [Split utilities](https://github.com/wangsuibao/dsfa/blob/main/model/utils.py): `model/utils.py`

### Model training

- [Hyperparameters](https://github.com/wangsuibao/dsfa/blob/main/setting.py): `setting.py`
- [U-Net training](https://github.com/wangsuibao/dsfa/blob/main/train_U.py): `train_U.py`
- [Adversarial training](https://github.com/wangsuibao/dsfa/blob/main/train_U_D.py): `train_U_D.py`
- [Segmentation losses](https://github.com/wangsuibao/dsfa/blob/main/model/loss.py): `model/loss.py`

### Segmentation models

- [Pix2pix U-Net](https://github.com/wangsuibao/dsfa/blob/main/model/modelG.py): `model/modelG.py`
- [Deep U-Net variant](https://github.com/wangsuibao/dsfa/blob/main/model/modelG8.py): `model/modelG8.py`
- [Classic U-Net](https://github.com/wangsuibao/dsfa/blob/main/model/base_model.py): `model/base_model.py`
- [U-Net experiments](https://github.com/wangsuibao/dsfa/blob/main/model/U_model.py): `model/U_model.py`
- [Model blocks](https://github.com/wangsuibao/dsfa/blob/main/model/ModelBlock.py): `model/ModelBlock.py`

### Inference and review

- [Evaluation metrics](https://github.com/wangsuibao/dsfa/blob/main/model/metrics.py): `model/metrics.py`
- [Section inference](https://github.com/wangsuibao/dsfa/blob/main/test_test.py): `test_test.py`
- [Trained checkpoints](https://github.com/wangsuibao/dsfa/tree/main/save_train_models): `save_train_models`
- [Test scores](https://github.com/wangsuibao/dsfa/tree/main/result): `result`
- [Result visualization](https://github.com/wangsuibao/dsfa/blob/main/show_result.py): `show_result.py`

### Other components

- **Researcher**

## Connections

- Researcher → Hyperparameters: sets parameters (evidence: `README.md`)
- Seismic volumes → Section loader: provides labeled data (evidence: `README.md`)
- Split utilities → Section splits: writes section splits (evidence: `model/utils.py`)
- U-Net training → Split utilities: creates splits (evidence: `train_U.py`)
- Adversarial training → Split utilities: creates splits (evidence: `train_U_D.py`)
- U-Net training → Hyperparameters: reads configuration (evidence: `train_U.py`)
- Adversarial training → Hyperparameters: reads configuration (evidence: `train_U_D.py`)
- U-Net training → Section loader: loads sections (evidence: `train_U.py`)
- Adversarial training → Section loader: loads sections (evidence: `train_U_D.py`)
- U-Net training → Segmentation losses: selects loss (evidence: `train_U.py`)
- U-Net training → Pix2pix U-Net: selects generator (evidence: `train_U.py`)
- Adversarial training → Pix2pix U-Net: uses generator (evidence: `train_U_D.py`)
- Adversarial training → Segmentation losses: computes pixel loss (evidence: `train_U_D.py`)
- Adversarial training → Trained checkpoints: saves checkpoints (evidence: `README.md`)
- U-Net training → Trained checkpoints: saves checkpoints (evidence: `README.md`)
- Researcher → U-Net training: trains baseline (evidence: `README.md`)
- Researcher → Adversarial training: trains DSFA (evidence: `README.md`)
- Trained checkpoints → Section inference: provides model (evidence: `README.md`)
- Section splits → Section inference: selects test sections (evidence: `README.md`)
- Section inference → Section loader: loads test data (evidence: `README.md`)
- Section inference → Evaluation metrics: calculates accuracy (evidence: `README.md`)
- Section inference → Test scores: writes scores (evidence: `README.md`)
- Test scores → Result visualization: reads scores (evidence: `show_result.py`)
- Researcher → Section inference: runs inference (evidence: `README.md`)
- Researcher → Result visualization: reviews results (evidence: `README.md`)
