atommic image-segmentation DynUNet ATOMMIC pytorch en dataset:BraTS2023AdultGlioma license:apache-2.0 region:us
---
language:
- en
license: apache-2.0
library_name: atommic
datasets:
- BraTS2023AdultGlioma
thumbnail: null
tags:
- image-segmentation
- DynUNet
- ATOMMIC
- pytorch
model-index:
- name: SEG_DynUNet_BraTS2023AdultGlioma
  results: []

---


## Model Overview

AttentionUNet for MRI Segmentation on the BraTS2023AdultGlioma dataset.


## ATOMMIC: Training

To train, fine-tune, or test the model you will need to install [ATOMMIC](https://github.com/wdika/atommic). We recommend you install it after you've installed latest Pytorch version.
```
pip install atommic['all']
```

## How to Use this Model

The model is available for use in ATOMMIC, and can be used as a pre-trained checkpoint for inference or for fine-tuning on another dataset.

Corresponding configuration YAML files can be found [here](https://github.com/wdika/atommic/tree/main/projects/SEG/BraTS2023AdultGlioma/conf).

### Automatically instantiate the model

```base
pretrained: true
checkpoint: https://huggingface.co/wdika/SEG_DynUNet_BraTS2023AdultGlioma/blob/main/SEG_DynUNet_BraTS2023AdultGlioma.atommic
mode: test
```

### Usage

You need to download the BraTS 2023 Adult Glioma dataset to effectively use this model. Check the [BraTS2023AdultGlioma](https://github.com/wdika/atommic/blob/main/projects/SEG/BraTS2023AdultGlioma/README.md) page for more information.


## Model Architecture
```base
model:
  model_name: SEGMENTATIONDYNUNET
  segmentation_module: DYNUNet
  segmentation_module_input_channels: 4
  segmentation_module_output_channels: 4
  segmentation_module_channels:
    - 32
    - 64
    - 128
    - 256
    - 512
  segmentation_module_kernel_size:
    - 3
    - 3
    - 3
    - 3
    - 1
  segmentation_module_strides:
    - 1
    - 1
    - 1
    - 1
    - 1
  segmentation_module_dropout: 0.0
  segmentation_module_norm: instance
  segmentation_module_activation: leakyrelu
  segmentation_module_deep_supervision: true
  segmentation_module_deep_supervision_levels: 2
  segmentation_module_normalize: false
  segmentation_module_norm_groups: 2
  segmentation_loss:
    dice: 1.0
  dice_loss_include_background: true  # always set to true if the background is removed
  dice_loss_to_onehot_y: false
  dice_loss_sigmoid: false
  dice_loss_softmax: false
  dice_loss_other_act: none
  dice_loss_squared_pred: false
  dice_loss_jaccard: false
  dice_loss_flatten: false
  dice_loss_reduction: mean_batch
  dice_loss_smooth_nr: 1e-5
  dice_loss_smooth_dr: 1e-5
  dice_loss_batch: true
  dice_metric_include_background: true  # always set to true if the background is removed
  dice_metric_to_onehot_y: false
  dice_metric_sigmoid: false
  dice_metric_softmax: false
  dice_metric_other_act: none
  dice_metric_squared_pred: false
  dice_metric_jaccard: false
  dice_metric_flatten: false
  dice_metric_reduction: mean_batch
  dice_metric_smooth_nr: 1e-5
  dice_metric_smooth_dr: 1e-5
  dice_metric_batch: true
  segmentation_classes_thresholds: [ 0.5, 0.5, 0.5, 0.5 ]
  segmentation_activation: sigmoid
  magnitude_input: true
  log_multiple_modalities: true  # log all modalities in the same image, e.g. T1, T2, T1ce, FLAIR will be concatenated
  normalization_type: minmax
  normalize_segmentation_output: true
  complex_data: false
```

## Training
```base
  optim:
    name: adam
    lr: 1e-4
    betas:
      - 0.9
      - 0.98
    weight_decay: 0.0
    sched:
      name: InverseSquareRootAnnealing
      min_lr: 0.0
      last_epoch: -1
      warmup_ratio: 0.1

trainer:
  strategy: ddp
  accelerator: gpu
  devices: 1
  num_nodes: 1
  max_epochs: 10
  precision: 16-mixed
  enable_checkpointing: false
  logger: false
  log_every_n_steps: 50
  check_val_every_n_epoch: -1
  max_steps: -1
```

## Performance

Evaluation can be performed using the segmentation [evaluation](https://github.com/wdika/atommic/blob/main/tools/evaluation/segmentation.py) script for the segmentation task, with --evaluation_type per_slice.

Results
-------

Evaluation
----------
DICE = 0.8061 +/- 0.276 F1 = 0.1045 +/- 0.5801 HD95 = 5.119 +/- 5.411 IOU = 0.06959 +/- 0.4187


## Limitations

This model was trained on the BraTS2023AdultGlioma dataset with stacked T1c, T1n, T2f, T2w images and might differ in performance compared to the leaderboard results.


## References

[1] [ATOMMIC](https://github.com/wdika/atommic)

[2] Kazerooni AF, Khalili N, Liu X, et al. The Brain Tumor Segmentation (BraTS) Challenge 2023: Focus on Pediatrics (CBTN-CONNECT-DIPGR-ASNR-MICCAI BraTS-PEDs). 2023