Training and evaluation code for brain tumor segmentation on Flair MRI images
Recommended way of project installation is below.
- Install requirements
pip install -r requirements.txt
- Use it!
You can download dataset from here.
You can download weights from Google Drive link. Also, you can convert this model to ONNX using transform_to_onnx.py script.
To use Weights&Biases you need to change train config file in trainer
section. Example:
...
logger:
- class_path: pytorch_lightning.loggers.WandbLogger
init_args:
name: tumor-segmentation-densevnet
project: tumor-segmentation
log_model: True
...
You need to change name
to your own. During first setup wandb
will ask you to insert your own credentials.
You can get those from here.
To train models you need to have only one config file:
Script for training:
python train.py --config configs/train_config.yaml
IMPORTANT: all folders should be accessible to the user, which executes scripts.
If you want to disable logging. And to leave only standart TensorBoardLogger
. Use this script:
python train.py --config configs/train_config.yaml --trainer.logger true
IMPORTANT: argument --trainer.logger
must be set after --config
.
Script for app evaluation:
python evalualte.py \
--checkpoint-path /checkpoints/best_checkpoint.ckpt \
--ct-path /data/ct_image.nii.gz \
--device-type cuda
This scripts starts simple OpenCV app. In this app you can interactively check model result.
- PyTorch - The NNs framework used
- pytorch-lightning - Train loop framework used
- MONAI - Framework for deep learning in healthcare imaging