This is my personal implementation of MRN. I also summarize MRN paper in my blog.
Two novel multi-resolution networks are proposed to learn from input patches extracted at multiple levels. These patches share the same centroid and shape (size in pixels), but with an octave based increase of the pixel size, micrometers per pixel (mpp). Only the central high resolution patch is segmented at the output. - Feng Gu et al. (2018)
pip install -r requirements.txt
Above, I install python 3.6 with CUDA 11.4
model/mrn.py
: main MRN model scriptmodel/mrn_se_resnext101_32x4d.py
: main MRN model scriptdatagen.py
: the data dataloader and augmentation scriptfunctional.py
: naming a weight of model and converting outputs to images scripttest_view.py
: visualizing outputs scripttrain.py
: main training script
MRN_Data
├ slide_num_1
| ├ input_x1
| ├ input_x2
| └ input_y1
.
.
.
└ slide_num_n
├ input_x1
├ input_x2
└ input_y1
- input_x1: mpp=1 image patches(512x512) directory
- input_x2: mpp=2 image patches(512x512) directory
- input_y1: mpp=1 mask patches(512x512) directory
You can get this data structure by using util_multi.py
python train.py --BASE_PATH './MRN_Data/*/input_y1/*.png' --BACKBONE 'seresnext101' --CLASSES 4 --LOSS_FUNCTION 'diceloss' --DESCRIPTION 'MRN_Test'
--BASE_PATH
: The path of input_y1 mask patches--BACKBONE
: The backbond model of MRN model. You can choose vgg16 or seresnext101--BATCH_SIZE
: The batch size of training model.--CLASSES
: The number of output classes.--MULTIPLE
: If you want to setting input_x2 mpp=4 with input_x1 mpp=1, you can add this option 2.--EPOCHS
: The epochs batch size of training model.--LOSS_FUNCTION
: Choose the loss function either celoss or diceloss.--DESCRIPTION
: Add the name of a training model weight.