Views
No views yet
feature_size = 24) chosen to match the SegResNet baseline's parameter
budget for an apples-to-apples architecture comparison.(1, 256, 256) axial CT slice, intensity-normalised to [0, 1](1, 256, 256) sigmoid map; foreground = lung tissueunified split (patient-grouped, dataset-stratified)
of a unified corpus assembled from three public sources:| Metric | Value | Δ vs SegResNet |
|---|---|---|
| mIoU | 0.9848 | +0.0045 |
| Accuracy | 0.9964 | +0.0011 |
| Precision | 0.9858 | +0.0061 |
| Recall | 0.9876 | +0.0019 |
| Dice (F1) | 0.9867 | +0.0040 |
Dice_p05 rises from 0.00 to 0.88) —
top-/bottom-of-volume slices where the lung is nearly absent are handled
more conservatively.1import yaml, torch
2from monai.networks.nets import SwinUNETR
3
4cfg = yaml.safe_load(open("config.yaml"))["model"]
5model = SwinUNETR(
6 in_channels = cfg["in_channels"],
7 out_channels = cfg["out_channels"],
8 feature_size = cfg["feature_size"],
9 depths = tuple(cfg["depths"]),
10 num_heads = tuple(cfg["num_heads"]),
11 spatial_dims = cfg["spatial_dims"],
12 use_checkpoint = cfg.get("use_checkpoint", False),
13)
14state = torch.load("model.pth", map_location="cpu", weights_only=True)
15model.load_state_dict(state)
16model.eval()
17
18with torch.no_grad():
19 x = torch.randn(1, 1, 256, 256) # (B, C, H, W) — replace with your CT slice
20 prob = torch.sigmoid(model(x))
21 lung_mask = (prob > 0.5).to(torch.uint8)DiceLoss(sigmoid=True, squared_pred=True)config.yaml.1export DATA_ROOT=/path/to/unified # dir containing ct_2d/ and roi_sem_seg_2d/
2python train.py --config config.yaml