Retinal Vessel Segmentation with Pixel-wise Adaptive Filters (ISBI 2022)
Introduction
This is the official code of Retinal Vessel Segmentation with Pixel-wise Adaptive Filters and Consistency Training (ISBI 2022). We evaluate our methods on three datasets, DRIVE, CHASE_DB1 and STARE.
Datesets
You can download the three datasets from Google drive.
Of course, you can download the dataset from DRIVE, CHASE_DB1 and STARE respectively.
Quick start
Requirement
- Refer to Pytorch to install
Pytorch >= 1.1
. pip install -r requirements.txt
Config file
DATASET: "DRIVE"
TRAIN_DATA_PATH: ".../training/images" # modify it to your own path
TRAIN_LABEL_PATH: ".../training/1st_manual"
TEST_DATA_PATH: ".../test/images"
TEST_PRED_PATH: "results/test/DRIVE/prediction"
TEST_LABEL_PATH: ".../test/label/1st_manual"
# view
#VAL_PICTURE_PATH: "/gdata1/limx/mx/dataset/Drive19/visualization"
#VIEW_VAL_PATH: "results/val_view"
#VIEW_TRAIN_PATH: "results/train_view"
MODEL_PATH: "results/test/DRIVE/model"
LOG_PATH: "results/test/DRIVE/logging.txt"
# train
LEARNING_RATE: 0.005
BATCH_SIZE: 5
EPOCH: 6000
CHECK_BATCH: 50
multi_scale: [0.3]
INPUT_CHANNEL: 3
MAX_AFFINITY: 5
RCE_WEIGHT: 1
RCE_RATIO: 10
# inference
MODEL_NUMBER: "epoch_2750_f1_0.8261"
# load breakpoint
IS_BREAKPOINT: False
BREAKPOINT: ""
Please modify TRAIN_DATA_PATH
, TRAIN_LABEL_PATH
, TEST_DATA_PATH
and TEST_LABEL_PATH
.
Training
Please specify the configuration file.
For example, you can run .sh
file to train the specific dataset.
cd rootdir
sh pbs/DRIVE_RUN.sh
After finishing the training stage, you will obtain the /results/test/DRIVE/logging.txt
. The logging.txt file can log the metrics, like model number, f1, auc, acc, specificity, precision, sensitivity.
Testing
Please select the best model in loggging.txt and modify the MODEL_NUMBER
in configuration file.
cd rootdir
python inference.py --lib/DRIVE.yaml
Evaluation
To evalutate the results offline bewteen cfg['TEST_PRED_PATH']
and cfg['TEST_LABEL_PATH']
. Your can run the code like it.
cd rootdir
python eval.py --lib/DRIVE.yaml