Thanks to visit codestin.com
Credit goes to github.com

Skip to content

In this we have used DeepLabV3 architecture for lung segmentation, pretrained weight Resnet is used.

License

Notifications You must be signed in to change notification settings

UkeshThapa/segmantation

Repository files navigation

pytorch-deeplab

TODO

  • Support different backbones
  • Support darwinlugs, JSTR, MC, SH, NIH datasets
  • Multi-GPU training
Backbone train/eval os mIoU in val Pretrained Model
ResNet101 16/16 78.43% google drive
MobileNet 16/16 70.81% google drive
DRN 16/16 78.87% google drive

Introduction

This is a PyTorch(1.11.0) implementation of DeepLab-V3-Plus. It can use Modified Aligned Xception and ResNet as backbone. Currently, we train DeepLab V3 Plus using Darwinlugs, JSTR, MC, SH, NIH.

Image

Installation

The code was tested with Python 3.9.7 After installing the Virtual environment:

  1. Clone the repo:

    https://github.com/UkeshThapa/Lung-Segmentation-Using-DeeplabV3.git
    cd Lung-Segmentation-Using-DeeplabV3
  2. Install dependencies:

    For PyTorch dependency, see pytorch.org for more details.

    For custom dependencies:

    pip install matplotlib pillow tensorboardX tqdm

Training

Follow steps below to train your model:

  1. Configure your dataset path in [mypath.py].

  2. Input arguments: (see full input arguments via python train.py --help):

    usage: train.py [-h] [--backbone {resnet,xception,drn,mobilenet}]
                [--out-stride OUT_STRIDE] [--dataset {pascal,coco,cityscapes,darwinlungs}]
                [--use-sbd] [--workers N] [--base-size BASE_SIZE]
                [--crop-size CROP_SIZE] [--sync-bn SYNC_BN]
                [--freeze-bn FREEZE_BN] [--loss-type {ce,focal}] [--epochs N]
                [--start_epoch N] [--batch-size N] [--test-batch-size N]
                [--use-balanced-weights] [--lr LR]
                [--lr-scheduler {poly,step,cos}] [--momentum M]
                [--weight-decay M] [--nesterov] [--no-cuda]
                [--gpu-ids GPU_IDS] [--seed S] [--resume RESUME]
                [--checkname CHECKNAME] [--ft] [--eval-interval EVAL_INTERVAL]
                [--no-val]
    
  3. To train deeplabv3+ using Pascal VOC dataset and ResNet-101 as backbone:

    bash train_voc.sh
  4. To train DeeplabV3+

     python train.py --backbone resnet --dataset darwinlungs --batch-size 4
  5. To train fcn

     python fcn_train.py --backbone resnet --dataset darwinlungs --batch-size 4

Testing

  1. To test fcn
     python fcn_inference.py 
  2. To test DeeplabV3+
     python inference.py 

Acknowledgement

PyTorch-Encoding

Synchronized-BatchNorm-PyTorch

drn

About

In this we have used DeepLabV3 architecture for lung segmentation, pretrained weight Resnet is used.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published