|
| 1 | +# Downstream Task Adaptation |
| 2 | + |
| 3 | +Our pre-trained CT-FM model has been adapted to three fine-tuned downstream tasks as well as several additional zero‐shot tasks. While most downstream experiments leverage the Lighter framework, tumor segmentation is handled using Auto3DSeg. |
| 4 | + |
| 5 | +## Whole Body Segmentation |
| 6 | + |
| 7 | +In line with the configuration-based approach detailed in [Pretraining](./pretraining.md), we provide YAML config files for downstream adaptation. To facilitate thorough comparisons, a suite of shell scripts with the relevant configuration components is available. These can be found in the [evaluation](https://github.com/project-lighter/CT-FM/tree/main/evaluation) directory under “scripts.” |
| 8 | + |
| 9 | +[View All Scripts](https://github.com/project-lighter/CT-FM/tree/main/evaluation/scripts){.md-button} |
| 10 | + |
| 11 | +<br/> |
| 12 | +For TotalSeg experiments, refer to the scripts in the totalseg folder: |
| 13 | +<div class="grid cards" markdown> |
| 14 | + |
| 15 | +- **Full Finetuning on TotalSegmentatorV2:** |
| 16 | + [:octicons-arrow-right-24: fulltune.sh](https://github.com/project-lighter/CT-FM/tree/main/evaluation/scripts/totalseg/fulltune.sh) |
| 17 | + |
| 18 | +- **Finetuning on the Merlin Split:** |
| 19 | + [:octicons-arrow-right-24: merlin.sh](https://github.com/project-lighter/CT-FM/tree/main/evaluation/scripts/totalseg/merlin.sh) |
| 20 | + |
| 21 | +- **Few-Shot Fine-Tuning:** |
| 22 | + [:octicons-arrow-right-24: fewshot.sh](https://github.com/project-lighter/CT-FM/tree/main/evaluation/scripts/totalseg/fewshot.sh) |
| 23 | + |
| 24 | +- **Pre-Training Checkpoint Selection:** |
| 25 | + [:octicons-arrow-right-24: checkpoint_selection.sh](https://github.com/project-lighter/CT-FM/tree/main/evaluation/scripts/totalseg/checkpoint_selection.sh) |
| 26 | + |
| 27 | +- **Pre-Training Ablations:** |
| 28 | + [:octicons-arrow-right-24: pretraining_evaluation.sh](https://github.com/project-lighter/CT-FM/tree/main/evaluation/scripts/totalseg/pretraining_evaluation.sh) |
| 29 | +</div> |
| 30 | + |
| 31 | +!!! tip "Enabling Prediction Mode" |
| 32 | + |
| 33 | + To switch from training to prediction mode: |
| 34 | + - Replace the `fit` command with the `predict` command. |
| 35 | + - Append the prediction override configuration file `./evaluation/overrides/totalseg_predict_overrides.yaml` to your config list. |
| 36 | + - Remove the `--trainer#callbacks#0#until_epoch=0` flag since the new callback now handles prediction mode. |
| 37 | + |
| 38 | + **Example Transformation:** |
| 39 | + |
| 40 | + Original command: |
| 41 | + ``` |
| 42 | + lighter fit --config=./evaluation/totalseg.yaml,./evaluation/overrides/totalseg_vista.yaml,./evaluation/baselines/segresnetds_ctfm.yaml --trainer#callbacks#0#until_epoch=0 --vars#name="ct_fm" --vars#project="totalseg" --system#model#trunk#ckpt_path=$ct_fm_path --vars#wandb_group='vista_v2' |
| 43 | + ``` |
| 44 | + |
| 45 | + Modified prediction command: |
| 46 | + ``` |
| 47 | + lighter predict --config=./evaluation/totalseg.yaml,./evaluation/overrides/totalseg_vista.yaml,./evaluation/baselines/segresnetds_ctfm.yaml,./evaluation/overrides/totalseg_predict_overrides.yaml --vars#name="ct_fm" --vars#project="totalseg" --vars#wandb_group='vista_v2' |
| 48 | + ``` |
| 49 | + |
| 50 | + By default the predict command uses the checkpoint location mentioned while running the fit pipeline. |
| 51 | + If you have a different checkpoint location, to override the model checkpoint directory during prediction, add: |
| 52 | + ``` |
| 53 | + --args#predict#ckpt_path=<path> |
| 54 | + ``` |
| 55 | + |
| 56 | +## Tumor Segmentation with Auto3DSeg |
| 57 | + |
| 58 | +Tumor segmentation is performed using Auto3DSeg—a robust segmentation workflow provided by MONAI. This pipeline is designed to simplify segmentation tasks and can be explored further in the official link below |
| 59 | + |
| 60 | +[MONAI Auto3DSeg Tutorial](https://github.com/Project-MONAI/tutorials/blob/main/auto3dseg/README.md){.md-button} |
| 61 | + |
| 62 | +### Workflow Overview |
| 63 | + |
| 64 | +Auto3DSeg operates by running an AutoRunner that takes a configuration file (typically named task.yaml) as input. This file contains all the necessary parameters to handle preprocessing, training, and validation stages of your segmentation task. |
| 65 | + |
| 66 | +### Model Details |
| 67 | + |
| 68 | +Our experiments focus on the segresnet_0 model variant, which is set up for single-fold training and validation. We run the baseline model using the default Auto3DSeg configuration. However, when integrating our CT-FM model into the pipeline, we make the following two key modifications: |
| 69 | + |
| 70 | +- **Orientation Adjustment:** |
| 71 | + We change the default image orientation by setting the axcodes to `SPL`. |
| 72 | + |
| 73 | +- **Checkpoint Specification:** |
| 74 | + The path to the pre-trained model checkpoint is provided via the `ckpt_path` field in the hyper_parameters.yaml file. |
| 75 | + |
| 76 | +These adjustments allow us to directly benchmark the effectiveness of the pre-trained CT-FM model within the Auto3DSeg pipeline without necessitating major changes to the existing workflow. |
| 77 | + |
| 78 | +!!! tip "Customizing Your Pipeline" |
| 79 | + By simply modifying the orientation and specifying the checkpoint path, you can leverage the power of pre-trained models in the Auto3DSeg setup. This makes it easy to compare different configurations and accelerate your experimentation process. |
| 80 | + |
| 81 | + |
| 82 | +## Head Triage CT classification |
| 83 | +:material-progress-clock: Coming soon... |
| 84 | + |
| 85 | + |
| 86 | +<br/> |
| 87 | +<br/> |
| 88 | + |
| 89 | +!!! tip "Zero-shot evaluation" |
| 90 | + All the zero shot eval can be found on the [reproduce analysis page](./analysis.md) |
0 commit comments