How luyvlei/bismaps works
Project type and purpose
• This is a research/ML pipeline for “Bidirectional Self‑Training with Multiple Anisotropic Prototypes (BiSMAP)” in domain‑adaptive semantic segmentation, implemented in PyTorch.
• It orchestrates multiple stages: data ingestion, source transferability map generation, pseudolabel generation, self‑training, and self‑distillation.
File structure
• Top‑level scripts:
• train.py – main training loop
• inference.py – run forward pass for pseudolabels
• test.py – final evaluation
• source_transferability_map.py – compute transferability maps
• generate_maps_pseudolabel.py – threshold and save pseudolabels
• Core packages:
• configs/ – YAML config files for each stage
• data/ & dataset/ – DataProvider, base_dataset, and dataset classes for GTA5, SYNTHIA, Cityscapes
• augmentations/ – image transforms and data augmentation
• models/ – ResNet backbones, DeepLabV3+ heads, utility wrappers
• loss/ – segmentation and prototype losses
• gmm_torch/ – Gaussian Mixture Model routines for prototype estimation
• schedulers/ – learning‐rate scheduler wrappers
• utils/ – shared helper functions and metrics
• Output folder: runs/ for logs and checkpoints
Extract key architecture points from the README
• Four main pipeline stages driven by config YAMLs:
a. Compute Source Transferability Map
b. Generate Pseudolabels
c. Self‑Training
d. Two‑stage Self‑Distillation
• Config Loader (reads YAML)
• Data Storage (datasets: GTA5, SYNTHIA, Cityscapes; pretrained models)
• DataProvider & Dataset Classes
• Augmentation Module
• DataLoader (PyTorch)
• Model (Backbone + DeepLabV3+ head)
• GMM Module (prototype estimation)
• Loss Module (segmentation + prototype losses)
• Optimizer + Scheduler
• Training Engine (train.py)
• Inference Engine (inference.py)
• Pseudolabel Generator (generate_maps_pseudolabel.py)
• Transferability Map Generator (source_transferability_map.py)
• Logger & Checkpointing (runs/)
• Metrics & Evaluation (test.py)
1. Config Loader → All modules (drives parameters)
2. Data Storage → DataProvider → Augmentations → DataLoader → Model
3. Model → Loss Module → Optimizer/Scheduler → Model (training loop)
4. Model Checkpoint → Inference Engine → Pseudolabel Generator → Data Storage
5. Loop back pseudolabel data to DataProvider for next training stage
6. Transferability Map Generator → Map files → used by pseudolabel stage
7. Final checkpoint + test.py → Metrics → outputs
c. Architectural patterns & principles:
• Modular separation (data, model, loss, utils)
• Pipeline scripting for each stage (single‐responsibility scripts)
• Config‑driven orchestration (YAML files under configs/)
• Reuse of PyTorch abstractions (DataLoader, nn.Module, schedulers)
d. Technologies/frameworks:
• Python 3.7, PyTorch 1.10
• YAML for configs
• GMM (SciPy/Torch) for prototype estimation
• Logging via tensorboard/console in runs/