Skip to content

KD-NU/BiUNet

Repository files navigation

BiUNet

This repo holds code for BiUNet: Towards More Effective U-Net with Bi-Level Routing Attention.

Installation

conda create -n biunet python=3.7 -y
conda activate biunet
conda install pytorch==1.10.1 torchvision==0.11.2 cudatoolkit=11.3.1 torchaudio==0.10.1 -c pytorch -c conda-forge -y
pip install -r requirements.txt

Usage

1. Data Preparation

1.1. QaTa-COV19 and MoNuSeg Datasets

The original data can be downloaded in following links:

1.2. Format Preparation

Then prepare the datasets in the following format for easy use of the code:

├── datasets
    ├── QaTa-Covid19
    │   ├── Test_Folder
    │   │   ├── img
    │   │   └── labelcol
    │   ├── Train_Folder
    │   │   ├── img
    │   │   └── labelcol
    │   └── Val_Folder
    │       ├── img
    │       └── labelcol
    └── MoNuSeg
        ├── Test_Folder
        │   ├── img
        │   └── labelcol
        ├── Train_Folder
        │   ├── img
        │   └── labelcol
        └── Val_Folder
            ├── img
            └── labelcol

2. Training

The first step is to change the settings in Config.py, all the configurations including learning rate, batch size and etc. are in it. Then run:

python train_model.py

3. Testing

3.1. Get Pre-trained Models

Here, we provide pre-trained weights on Covid19 and MoNuSeg, if you do not want to train the models by yourself, you can download them in the following links:

password: 1234

3.2. Test the Model and Visualize the Segmentation Results

First, change the session name in Config.py as the training phase. Then run:

python test_model.py

You can get the Dice and IoU scores and the visualization results.

4. Reproducibility

In our code, we carefully set the random seed and set cudnn as 'deterministic' mode to eliminate the randomness. However, there still exsist some factors which may cause different training results, e.g., the cuda version, GPU types, the number of GPUs and etc. See https://pytorch.org/docs/stable/notes/randomness.html for more details.

Reference

Open an issue or mail me directly in case of any queries or suggestions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages