# scnu-rislab/mf-mos architecture

> Architecture diagram of the GitHub repository scnu-rislab/mf-mos, 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/scnu-rislab/mf-mos
- Repository: https://github.com/scnu-rislab/mf-mos

## Overview

MF-MOS is a SemanticKITTI moving-object segmentation system. Its documented workflow derives temporal residual maps from LiDAR sequences, loads scans and labels for training or inference, predicts moving-object classes, and evaluates or visualizes those predictions. Training has a base-model stage and an optional SIEM point-refinement stage. The excerpts confirm dataset parsing, training orchestration, refinement construction, residual generation, and evaluation; inference and some model wiring are represented only at the subsystem level where the tree or README supports them.

Main entry points: [`modules/trainer.py`](https://github.com/scnu-rislab/mf-mos/blob/main/modules/trainer.py) (Training loop), [`common/dataset/kitti/parser.py`](https://github.com/scnu-rislab/mf-mos/blob/main/common/dataset/kitti/parser.py) (KITTI parser), [`utils/auto_gen_residual_images_mp.py`](https://github.com/scnu-rislab/mf-mos/blob/main/utils/auto_gen_residual_images_mp.py) (Residual generation), [`train.py`](https://github.com/scnu-rislab/mf-mos/blob/main/train.py) (Base training entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_residual["Residual generation"]
  node_parser["KITTI parser<br/>[parser.py]"]
end

subgraph group_learning["Model and training"]
  node_train_entry["Base training entry<br/>[train.py]"]
  node_trainer["Training loop<br/>[trainer.py]"]
  node_model["MF-MOS model<br/>[MFMOS.py]"]
  node_refine_entry["Refinement training<br/>[train_2stage.py]"]
  node_refine_trainer["Refinement trainer<br/>[trainer_refine.py]"]
  node_siem["SIEM point network<br/>[spvcnn.py]"]
end

subgraph group_results["Prediction and analysis"]
  node_infer["Inference<br/>[infer.py]"]
  node_evaluate["MOS evaluation<br/>[evaluate_mos.py]"]
  node_visualize["Result visualization<br/>[visualize_mos.py]"]
  node_sequence_video["Sequence video<br/>[viz_seqVideo.py]"]
end

subgraph group_support["Scan and metrics"]
  node_scan["Scan projection<br/>[laserscan.py]"]
  node_loss["Segmentation losses"]
end

node_user(("Researcher"))
node_kitti[("SemanticKITTI data")]

node_user -->|"generates maps"| node_residual
node_kitti -->|"reads sequences"| node_residual
node_residual -->|"provides residual maps"| node_parser
node_kitti -->|"provides scans and labels"| node_parser
node_parser -->|"projects scans"| node_scan
node_user -->|"starts training"| node_train_entry
node_train_entry -->|"creates trainer"| node_trainer
node_trainer -->|"loads dataset"| node_parser
node_trainer -->|"trains model"| node_model
node_trainer -->|"computes loss"| node_loss
node_user -->|"starts refinement"| node_refine_entry
node_refine_entry -->|"runs refinement"| node_refine_trainer
node_refine_trainer -->|"constructs network"| node_siem
node_user -->|"requests predictions"| node_infer
node_user -->|"evaluates predictions"| node_evaluate
node_kitti -->|"provides ground truth"| node_evaluate
node_user -->|"visualizes results"| node_visualize
node_user -->|"views sequences"| node_sequence_video

click node_residual "https://github.com/scnu-rislab/mf-mos/blob/main/utils/auto_gen_residual_images_mp.py"
click node_parser "https://github.com/scnu-rislab/mf-mos/blob/main/common/dataset/kitti/parser.py"
click node_scan "https://github.com/scnu-rislab/mf-mos/blob/main/common/laserscan.py"
click node_train_entry "https://github.com/scnu-rislab/mf-mos/blob/main/train.py"
click node_trainer "https://github.com/scnu-rislab/mf-mos/blob/main/modules/trainer.py"
click node_model "https://github.com/scnu-rislab/mf-mos/blob/main/modules/MFMOS.py"
click node_refine_entry "https://github.com/scnu-rislab/mf-mos/blob/main/train_2stage.py"
click node_refine_trainer "https://github.com/scnu-rislab/mf-mos/blob/main/modules/trainer_refine.py"
click node_siem "https://github.com/scnu-rislab/mf-mos/blob/main/modules/PointRefine/spvcnn.py"
click node_infer "https://github.com/scnu-rislab/mf-mos/blob/main/infer.py"
click node_evaluate "https://github.com/scnu-rislab/mf-mos/blob/main/utils/evaluate_mos.py"
click node_visualize "https://github.com/scnu-rislab/mf-mos/blob/main/utils/visualize_mos.py"
click node_sequence_video "https://github.com/scnu-rislab/mf-mos/blob/main/utils/viz_seqVideo.py"
click node_loss "https://github.com/scnu-rislab/mf-mos/tree/main/modules/loss"

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_residual,node_parser toneBlue
class node_train_entry,node_trainer,node_model,node_refine_entry,node_refine_trainer,node_siem,node_kitti toneAmber
class node_infer,node_evaluate,node_visualize,node_sequence_video toneMint
class node_scan,node_loss toneRose
class node_user toneIndigo
```

## Components

### Data preparation

- [Residual generation](https://github.com/scnu-rislab/mf-mos/blob/main/utils/auto_gen_residual_images_mp.py): `utils/auto_gen_residual_images_mp.py`
- [KITTI parser](https://github.com/scnu-rislab/mf-mos/blob/main/common/dataset/kitti/parser.py): `common/dataset/kitti/parser.py`

### Model and training

- [Base training entry](https://github.com/scnu-rislab/mf-mos/blob/main/train.py): `train.py`
- [Training loop](https://github.com/scnu-rislab/mf-mos/blob/main/modules/trainer.py): `modules/trainer.py`
- [MF-MOS model](https://github.com/scnu-rislab/mf-mos/blob/main/modules/MFMOS.py): `modules/MFMOS.py`
- [Refinement training](https://github.com/scnu-rislab/mf-mos/blob/main/train_2stage.py): `train_2stage.py`
- [Refinement trainer](https://github.com/scnu-rislab/mf-mos/blob/main/modules/trainer_refine.py): `modules/trainer_refine.py`
- [SIEM point network](https://github.com/scnu-rislab/mf-mos/blob/main/modules/PointRefine/spvcnn.py): `modules/PointRefine/spvcnn.py`

### Prediction and analysis

- [Inference](https://github.com/scnu-rislab/mf-mos/blob/main/infer.py): `infer.py`
- [MOS evaluation](https://github.com/scnu-rislab/mf-mos/blob/main/utils/evaluate_mos.py): `utils/evaluate_mos.py`
- [Result visualization](https://github.com/scnu-rislab/mf-mos/blob/main/utils/visualize_mos.py): `utils/visualize_mos.py`
- [Sequence video](https://github.com/scnu-rislab/mf-mos/blob/main/utils/viz_seqVideo.py): `utils/viz_seqVideo.py`

### Scan and metrics

- [Scan projection](https://github.com/scnu-rislab/mf-mos/blob/main/common/laserscan.py): `common/laserscan.py`
- [Segmentation losses](https://github.com/scnu-rislab/mf-mos/tree/main/modules/loss): `modules/loss`

### Other components

- **Researcher**
- **SemanticKITTI data**

## Connections

- Researcher → Residual generation: generates maps
- SemanticKITTI data → Residual generation: reads sequences
- Residual generation → KITTI parser: provides residual maps
- SemanticKITTI data → KITTI parser: provides scans and labels
- KITTI parser → Scan projection: projects scans
- Researcher → Base training entry: starts training
- Base training entry → Training loop: creates trainer
- Training loop → KITTI parser: loads dataset
- Training loop → MF-MOS model: trains model
- Training loop → Segmentation losses: computes loss
- Researcher → Refinement training: starts refinement
- Refinement training → Refinement trainer: runs refinement
- Refinement trainer → SIEM point network: constructs network
- Researcher → Inference: requests predictions
- Researcher → MOS evaluation: evaluates predictions
- SemanticKITTI data → MOS evaluation: provides ground truth
- Researcher → Result visualization: visualizes results
- Researcher → Sequence video: views sequences
