How caominhh/swin-deeplabv3 works
Swin-DeepLabV3 is a TensorFlow/Keras breast-ultrasound lesion segmentation project. Its main workflow loads prepared image/mask arrays, trains the hybrid Swin–DeepLabV3 model, evaluates predictions, and uses saved checkpoints for image or array inference. The model combines hierarchical shifted-window features, ASPP context, and a skip-connected decoder; training adds configurable losses and streaming Dice/IoU metrics. Dataset preprocessing is documented, but its scripts are absent from the supplied tree, so that subsystem is not mapped. Unsampled config and package wiring are represented only where documented.
Main entry points: training.py Training runner · evaluation.py Evaluation runner · inference.py Inference runner · model.py SwinDeepLabV3
Components 19
Segmentation model
- SwinDeepLabV3
swin_dl/model.py - Swin encoder
swin_dl/model.py - Window attention
swin_dl/layers/attention.py - Patch merging
swin_dl/layers/merging.py - ASPP context
swin_dl/layers/aspp.py - Skip decoder
swin_dl/model.py
Training
- Training runner
training.py - Data and callbacks
training_utils.py
Evaluation and inference
- Evaluation runner
evaluation.py - Inference runner
inference.py - Evaluation utilities
training_utils.py
Model objectives
- Loss functions
swin_dl/losses.py - Dice and IoU
swin_dl/metrics.py - Model registration
swin_dl/__init__.py
Other components
- Engineer
- Prepared arrays
- Saved checkpoint
- Image inputs
- Masks or arrays
Connections 25
- Engineer → Training runner: starts training
- Prepared arrays → Data and callbacks: provides splits
- Training runner → Data and callbacks: loads and batches
- Training runner → SwinDeepLabV3: builds and fits
- Training runner → Loss functions: selects objective
- Training runner → Dice and IoU: compiles metrics
- Training runner → Saved checkpoint: saves best model
- SwinDeepLabV3 → Swin encoder: extracts features
- Swin encoder → Window attention: applies blocks
- Swin encoder → Patch merging: downsamples stages
- SwinDeepLabV3 → ASPP context: aggregates context
- SwinDeepLabV3 → Skip decoder: fuses skip features
- Engineer → Evaluation runner: starts evaluation
- Evaluation runner → Evaluation utilities: loads split
- Prepared arrays → Evaluation utilities: provides splits
- Evaluation runner → Saved checkpoint: loads model
- Evaluation runner → SwinDeepLabV3: predicts with
- Evaluation runner → Dice and IoU: computes scores
- Evaluation runner → Masks or arrays: saves predictions
- Engineer → Inference runner: starts inference
- Image inputs → Inference runner: supplies images
- Inference runner → Saved checkpoint: loads model
- Inference runner → Model registration: registers custom objects
- Inference runner → SwinDeepLabV3: predicts with
- Inference runner → Masks or arrays: writes masks