Downloads · 30 days
1
13% of all-time downloads
szabopeter/nodule-segresnet-3d-wide
nodule-segresnet-3d-wide is a image segmentation model from szabopeter. Use it for the image segmentation task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as apache-2.0.
Voxel-level segmentation of pulmonary nodules in 3D chest CT volumes, cropped to the lung region. Wide-capacity SegResNet (initfilters = 32, ~83 M params) retrained on the unified split.
Downloads · 30 days
1
13% of all-time downloads
All-time downloads
8
Public
Repo size
331 MB
Likes
0
Public
Click a slice to open those files.
.pth331 MB · 100%
From the Hugging Face model README
Voxel-level segmentation of pulmonary nodules in 3D chest CT volumes,
cropped to the lung region. Wide-capacity SegResNet
(init_filters = 32, ~83 M params) retrained on the unified
split.
This is the "wide SegResNet" architecture from the paper, directly
comparable to the other two-stage nodule models (segresnet_small,
dynunet) — all of which share the same train / val / test split.
Peaked at val Dice 0.5711 (per-case mean) at epoch 489 / 1000.
(1, 256, 256, 256) CT crop, intensity-normalised to [0, 1], resampled from a per-series lung bbox (padding = 20 vox)(2, 256, 256, 256) softmax logits — class 0 = background, class 1 = noduleTrained on the unified split (patient-grouped, dataset-stratified):
| Source | Role |
|---|---|
| NLST | train + val + test |
| NSCLC-Radiomics | train + val + test |
| LIDC-IDRI | train + val + test |
Split sizes: 1 683 train / 297 val / 325 test (held out).
Note on bboxes. This model was originally trained with a regenerated
bbox JSON (tighter lung crops) that differs from the
bboxes_unified.json bundled with the small and DynUNet variants.
Reproducing from the bundled bboxes gives small variance from the
released checkpoint but does not materially affect training.
Test split (325 series, ~5.5 × 10⁹ voxels, micro-averaged):
| Metric | Value |
|---|---|
| mIoU | 0.7482 |
| Accuracy | 0.9996 |
| Precision | 0.5766 |
| Recall | 0.7818 |
| Dice / F1 (micro) | 0.6637 |
Per-case Dice distribution: mean 0.5706, median 0.6304, p25 0.4069, p75 0.7834.
| Model | mIoU | Precision | Recall | Dice (micro) | Per-case Dice mean |
|---|---|---|---|---|---|
nodule-segresnet-3d-small | 0.7391 | 0.539 | 0.812 | 0.6478 | 0.5240 |
nodule-dynunet-3d | 0.7594 | 0.624 | 0.757 | 0.6838 | 0.5560 |
| this model (wide) | 0.7482 | 0.577 | 0.782 | 0.6637 | 0.5706 |
On voxel-level metrics (mIoU / Dice_micro), DynUNet wins; on per-case Dice mean (equal weight per patient regardless of nodule size), this wide-SegResNet variant wins. Which is "best" depends on the metric: large-nodule cases dominate the micro-averaged numbers, while per-case-averaged metrics weigh each patient equally.
import yaml, torch
from monai.networks.nets import SegResNet
cfg = yaml.safe_load(open("config.yaml"))["model"]
model = SegResNet(
spatial_dims = cfg["spatial_dims"],
in_channels = cfg["in_channels"],
out_channels = cfg["out_channels"], # 2
init_filters = cfg["init_filters"], # 32 (wide)
blocks_down = tuple(cfg["blocks_down"]),
blocks_up = tuple(cfg["blocks_up"]),
dropout_prob = cfg["dropout_prob"],
)
state = torch.load("model.pth", map_location="cpu", weights_only=True)
model.load_state_dict(state)
model.eval()
with torch.no_grad():
# Input: (B, 1, 256, 256, 256), lung-bbox-cropped CT resampled to 256³
x = torch.randn(1, 1, 256, 256, 256)
logits = model(x) # (B, 2, D, H, W)
pred_class = logits.argmax(dim=1) # (B, D, H, W) in {0, 1}
nodule_mask = (pred_class == 1).to(torch.uint8)
This model expects lung-bbox-cropped input. A separate 2D ROI model
is needed to produce that bbox — see the accompanying ROI checkpoints
(szabopeter/roi-segresnet-2d
or szabopeter/roi-swinunetr-2d),
or use the demo's inference.py which chains them for you.
ce_nodule_weight = 100)Full config is included in this repo as config.yaml.
szabopeter/nodule-segresnet-3d-small — small SegResNet (init_filters=16, ~20 M params)szabopeter/nodule-dynunet-3d — DynUNet / 3D U-Net (~31 M params, best voxel-level metrics)Apache 2.0. Training data was public but subject to dataset-specific terms (NLST, NSCLC-Radiomics, LIDC-IDRI).
Not a medical device. Research use only.
Paper in preparation.