L1-weighted Dice Focal Loss for Lesion Segmentation
- L1DFL is a loss function developed for voxel-wise segmentation that uses dynamic L1-based weighting to focus on hard-to-classify lesion regions.
- It combines a weighted Dice loss with a focal loss reweighted by voxel error density, enhancing sensitivity to rare and challenging voxels.
- Experimental results on PSMA PET/CT imaging demonstrate that L1DFL improves segmentation metrics and aligns closely with expert annotations.
L1-weighted Dice Focal Loss (L1DFL) is a supervised loss function developed for voxel-wise segmentation tasks in deep learning, with demonstrated efficacy in automated lesion segmentation in PSMA PET/CT imaging for prostate cancer. L1DFL explicitly integrates dynamic, data-adaptive weighting of voxels based on L₁ norm errors into a weighted Dice-Focal framework, refining the sensitivity of segmentation models to rare, hard-to-classify regions while controlling for the dominance of easy background voxels. The approach yields substantial improvements in quantitative clinical metrics and agreement with expert annotations on complex medical images (Dzikunu et al., 22 Apr 2025, Dzikunu et al., 4 Feb 2025).
1. Mathematical Definition
The L1-weighted Dice Focal Loss re-weights the sum of a squared-denominator Dice loss and a focal loss term by a voxel-wise, data-driven weight derived from prediction error statistics. The full computation is as follows:
- L₁ norm calculation (per voxel and class ):
where is the predicted probability and is the ground-truth label.
- Density estimation via binning: Bin into non-overlapping bins of width (typically $0.1$ over ), constructing a histogram over all voxels and classes in a batch. The density in bin is:
0
with 1 as the effective bin width.
- Weight assignment: Each bin receives a weight inversely proportional to its density,
2
where 3 is the total number of (voxel, class) pairs; each voxel 4 uses 5 for its assigned bin 6.
- Loss combination:
- Weighted squared-denominator Dice loss:
7
Focal loss (with 8 and 9):
0
Total L1DFL loss:
1
All hyperparameters, including 2, are fixed across architectures and splits (Dzikunu et al., 22 Apr 2025, Dzikunu et al., 4 Feb 2025).
2. Rationale and Theoretical Motivation
Standard Dice Loss and its derivatives operate globally, treating every voxel or class equally and are typically insensitive to the changing batch-wise distribution of errors. Focal Loss introduces class-level modulation, but not local adaptivity. L1DFL leverages the following rationale:
PSMA PET lesion voxels are challenging—small, low-contrast, and irregular—meaning that a small number of difficult voxels can dramatically reduce segmentation fidelity.
By estimating the batch-wise distribution of L₁-norm errors and inverting their density, L1DFL dynamically up-weights rare or hard examples (often lesion boundaries or small lesions) and down-weights abundant, easy examples (background).
This mechanism adaptively focuses the model’s gradient updates on the specific difficult regions in each mini-batch, leading to improved detection sensitivity, boundary accuracy, and reduced false positives in high class-imbalance regimes (Dzikunu et al., 22 Apr 2025, Dzikunu et al., 4 Feb 2025).
3. Comparison with Other Losses
The table below summarizes key properties distinguishing L1DFL from alternatives:
| Loss Function | Weighting Mechanism | Sensitivity to Hard Voxels | Adaptive? |
|---|---|---|---|
| Dice Loss (DL) | Uniform | None | No |
| Dice+Cross-Entropy | Uniform | None | No |
| Dice Focal Loss (DFL) | Global (focal term) | Some (via 3) | No |
| L1DFL | Per-bin L₁, dynamic | High (bin count-inverse) | Yes (per-batch) |
L1DFL outperforms DL and DFL, particularly in scenarios with small, irregular, or low-contrast lesions, by adaptively targeting high-error voxels (Dzikunu et al., 4 Feb 2025, Dzikunu et al., 22 Apr 2025).
4. Experimental Protocol
L1DFL has been validated primarily in binary lesion segmentation of [¹⁸F]DCFPyL PSMA PET/CT scans in prostate cancer. The protocol includes:
Dataset: 380 scans, 684 lesions (mean volume 4 ml), ground truth via expert PET Edge annotation.
Architectures: 3D U-Net, Attention U-Net, SegResNet (with channel and normalization details as specified).
Preprocessing: PET to SUV, CT windowing, isotropic 2 mm resampling; spatial augmentations.
Training: 5-fold cross-validation, AdamW optimizer (initial 5), 1000 epochs with cosine annealing, MONAI + PyTorch, sliding window inference, ensemble via majority voting.
Evaluation: DSC, per-lesion F1 (SUVmax voxel overlap), clinical quantification (SUVmax, SUVmean, TMTV, TLA, count, spread), statistical agreement (Lin’s CCC, TOST at 6, Bland-Altman, CP, TDI7) (Dzikunu et al., 22 Apr 2025, Dzikunu et al., 4 Feb 2025).
5. Quantitative Results and Comparative Performance
Across architectures and metrics, L1DFL demonstrates the following improvements:
Segmentation (median DSC, test set):
- SegResNet+L1DFL: 0.71 8 over Dice or DCE" title="" rel="nofollow" data-turbo="false" class="assistant-link">IQR 0.52–0.81, mean DSC 0.61 ± 0.28, F1=0.72, lowest FP (90.31)
- U-Net+L1DFL: 0.66 [0.48–0.77], mean 0.56 ± 0.29
- Att-U-Net+L1DFL: 0.67 [0.54–0.79], mean 0.60 ± 0.28
- Clinical metrics, Lin’s CCC (Att-U-Net+L1DFL): SUVmax 0.98, SUVmean 0.96, TLA 0.95, TMTV 0.89, Lesion count 0.91, Dmax 0.90
- Equivalence (TOST, 0=0.05, 120%): L1DFL achieves equivalence for SUVmax, SUVmean, TLA, lesion count; alternatives fail for TLA, count, or Dmax.
- Coverage Probability (CP) & TDI2: L1DFL yields higher coverage and consistently lowest TDI3, with Dice/Dice Focal up to 4 higher deviations (Dzikunu et al., 22 Apr 2025).
- Cross-study observations: L1DFL shows +13% median DSC improvement over Dice and DFL on test sets; F1 score increases by 5 over Dice and 6 over DFL (Dzikunu et al., 4 Feb 2025).
- Ablation: When 7 is uniform, weighting reduces to standard Dice behavior, isolating the role of batch-adaptive L₁-based weights.
6. Implementation and Practical Considerations
- Hyperparameters: All experiments fix bin width 8; focal parameter 9; class balance 0; smoothing 1.
- Histograms and weighting: Implemented efficiently in PyTorch, typically using
torch.bucketizeor GPU histogram operations. Weight normalization is implicit via 2. - Batch-wise adaptivity: All weights and densities are recomputed every batch, maximizing adaptivity to current data statistics.
- STL/PyTorch workflow: Open-source at https://github.com/ObedDzik/pca_segment.git; trained on Tesla V100 16GB, batch size set per GPU capacity, and code uses MONAI sliding-window segmentation and majority voting ensemble for robustness (Dzikunu et al., 22 Apr 2025, Dzikunu et al., 4 Feb 2025).
7. Limitations and Extensions
While L1DFL demonstrates robust improvements, certain limitations are evident:
- Lesion spread: Performance declines in the largest anatomical spread quartile (3 cm), signaling challenges in extreme cases.
- Network specificity: Some interaction with architecture and lesion characteristics; for example, in low-spread lesions SegResNet+Dice Loss may approach L1DFL performance.
- Hyperparameter sensitivity: While 4, 5, and 6 are robust for PSMA PET/CT, their transferability to other modalities or tasks is unproven; parameter retuning may be required.
- Potential for generalization: Extensions could include vector L₁ norms for multiclass, dynamic tuning of bin width, incorporation of spatial context, or adaptation to non-PT/PET modalities (Dzikunu et al., 4 Feb 2025).
- A plausible implication is that L1DFL’s value is highest where class imbalance, voxel-wise difficulty heterogeneity, and rare-event detection are pronounced.
L1DFL establishes an interpretable and practical mechanism for adaptive per-voxel weighting in medical image segmentation networks, improving sensitivity and agreement for challenging tasks such as PSMA PET/CT lesion detection (Dzikunu et al., 22 Apr 2025, Dzikunu et al., 4 Feb 2025).