Skip to content

DeepMIALab/UC-NfNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UC-NfNet: Ulcerative Collitis Grade Classifer

In this work, we propose an AI-assisted and easily interpretable ulcerative collitis (UC) classification system supported by an additional synthetic data generation approach that confidentially and accurately classifies endoscopic images from UC. Additionaly, we introduce new 352 UC endoscopy images were labelled by our experienced gastroenterologists.

Example Results

Real Images and Grad-CAM++ Result

Real and Synthetic Images

Dataset

The dataset used in this study is derived from the original Hyper-Kvasir open-source dataset. UC images were classified according to the Mayo scoring method, which consists of score 0 representing no disease, score 1 representing mild disease, score 2 representing moderate disease, and score 3 representing severe disease.

We introduce new labelled 352 UC endoscopy images from Hyper-Kvasir dataset including 98 for grade 0, 93 for grade 1, 91 for grade 2, and 70 for grade 3 were labelled by our experienced gastroenterologists.

The dataset used in this study includes a total of 321 UC endoscopy-labelled images with grade 0, grade 1, grade 2, and grade 3 from original Hyper-Kvasir .

Our study contains a total of 673 images from the UC endoscopy images;

  • 120 grade 0
  • 212 grade 1
  • 218 grade 2
  • 123 grade 3

UC labelled dataset is publicly available on the link

Prerequisites

  • Linux or macOS
  • Python 3
  • CPU or NVIDIA GPU + CUDA CuDNN

Getting started

  • Clone this repo:
git clone https://github.com/DeepMIALab/Ulcer_grade_classificaiton
cd Ulcer_grade_classificaiton
  • Install PyTorch 3.7 and other dependencies (e.g., torchvision, visdom, dominate, gputil).

  • For pip users, please type the command pip install -r requirements.txt.

  • For Conda users, you can create a new Conda environment using conda env create -f environment.yml.

Training and Test

  • The image identity numbers which were used in train, validation and test sets are given as .txt files in docs/ for both Brain and Lung dataset. To replicate the results, you may download dataset and create a subset using these .txt files.

The data used for training are expected to be organized as follows:

DATASET                
 ├──  train
 |      ├──Grade_0
 |           ├── 1.png     
 |           ├── ...
 |           └── n.png
 |      ├──Grade_1
 |           ├── 1.png     
 |           ├── ...
 |           └── n.png
 |      ├──Grade_2
 |           ├── 1.png     
 |           ├── ...
 |           └── n.png
 |      ├──Grade_3
 |           ├── 1.png     
 |           ├── ...
 |           └── n.png
 ├──  test
 |      ├──Grade_0
 |           ├── 1.png     
 |           ├── ...
 |           └── n.png
 |      ├──Grade_1
 |           ├── 1.png     
 |           ├── ...
 |           └── n.png
 |      ├──Grade_2
 |           ├── 1.png     
 |           ├── ...
 |           └── n.png
 |      ├──Grade_3
 |           ├── 1.png     
 |           ├── ...
 |           └── n.png
  • Train the UC model:
python classifer.py --action train --train_data ./dataset/train --test_data ./dataset/test --model_name $MODEL --epoch_number $EPOCH_NUMBER --bs $BATCH_SIZE --lr $LEARNING_RATE
  • Test the UC model:
python classifer.py --action test --test_data ./dataset/test --load_from TRAINED_WEIGHT_PATH --model_name $MODEL --epoch_number $EPOCH_NUMBER --bs $BATCH_SIZE --lr $LEARNING_RATE

The list of other arguments is as follows:

  • --model_name: CNN model name is avaliable in pytorch-image-models

  • --scheduler: Learning schedululer selection (CosineAnnealingLR or ReduceLROnPlateau)

  • --optimizer: Optimizers selection ( SGD, Adam or RMSprop )

  • --augmentation_size:

  • To view training results and loss plots, run python -m visdom.server and click the URL http://localhost:8097.

The test results will be saved to a html file here: ./results/${result_dir_name}/latest_train/index.html

Apply a pre-trained UC Grade Classificaiton model and evaluate

For reproducability, you can download the pretrained models for each algorithm here.

Issues

  • Please report all issues on the public forum.

License

© DeepMIA Lab This code is made available under the MIT License and is available for non-commercial academic purposes.

Funding

This work was funded by TUBITAK for International Fellowship for Outstanding Researchers.

Reference

If you find our work useful in your research or if you use parts of this code please consider citing our paper:

@misc{durmus2022,
      title={UC-NfNet: Ulcerative Collitis Grade Classifer}, 
      author={Furkan Durmus and Mehmet Turan},
      year={2022},
}

Acknowledgments

Our code is developed based on pytorch-image-models. We also thank FastGAN-pytorch for the PyTorch implementation of FastGAN used in our single-image translation setting.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors