GithubHelp home page GithubHelp logo

jaeho3690 / lidc-idri-segmentation Goto Github PK

View Code? Open in Web Editor NEW
61.0 3.0 9.0 6.53 MB

This is the segmentation process of the LIDC-IDRI dataset. Checkout my preprocessing repository to use this repository

Python 1.39% Jupyter Notebook 98.61%
lung-cancer lung-nodule lidc-idri unet pytorch

lidc-idri-segmentation's Introduction

LIDC Segmentation of Lung Nodule with U-Net, U-Net++

This repository is the second stage for Lung Cancer project. Please check out my first repository LIDC-IDRI-Preprocessing Explanation for my first repository is on Medium as well! The input for this repository requires the output format from the first stage. This repository would train a segmentation model(U-Net, U-Net++) for Lung Nodules. The whole script is implemented in Pytorch Framework. The model script for U-Net++ and some of the script format is sourced from here

Requirements

  • pytorch 1.4
  • GPU is needed

1. Check out my LIDC-IDRI-Preprocessing repository

This repository goes through the preprocessing steps of the LIDC-IDRI data. Running the script will return .npy images for each lung cancer slice and mask slice. Also, a meta.csv, clean_meta.csv file will be made after running the jupyter file.

2. Fix directory settings

All the scripts were written when I was not so familiar with directory settings. I mostly used absolute directory. Please change each directory setting to fit yours. I apologize for the inconvenience.

Installation

  1. Create a virtual environment
conda create -n=<env_name> python=3.6 
conda activate <env_name>
  1. Install pip packages
pip install -r requirements.txt

File Structure

+-- Unet
|    # This folder contains the model code for U-Net
+-- UnetNested
|    # This folder contains the model code for U-Net++
+-- figures
|    # This folder saves figure images
+-- meta_csv
|    # This folder contains information of each images in a csv format. 
|    # The cs
+-- notebook
|    # This folder contains jupyter notebook files for some visuialization
+-- dataset.py
|    # Dataset class for Pytorch, Accepts .npy file format
+-- losses.py
|    # Loss function. Here I use the BCE dice loss. Sourced from 
+-- metrics.py
     # Metric function. It is interesting to note that somehow the dice coefficient doesn't increase as fast as IOU in the early stages of training.
+-- train.py
|    # Training of Segmentation model. Adjust hyperparameters
+-- utils.py
|    # Utility file
+-- validate.py
|    # For validation of the model

Training

  1. Train the model. There will be total of 4 cases. UNET_base, UNET_with_augmentation, NestedUNET_base, NestedUNET_with_augmentation
# Training U-net
python train.py --name UNET --augmentation True
# Training U-Net++
python train.py --name NestedUNET --augmentation True 
  1. Validate the model
# if you want to get the augmented version
python validate.py --name UNET --augmentaton True

Some resources that were useful

Evaluatuion Metric https://www.sciencedirect.com/science/article/pii/S1361841510000587?via%3Dihub

lidc-idri-segmentation's People

Contributors

jaeho3690 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lidc-idri-segmentation's Issues

About num_class

Hello, I am a beginner, I would like to ask why num_class=1, not 2, in your code, isn't the image segmentation task usually set to 2

About the segmentation performance

Thanks for your work! I would like to ask what is your final segmentation performance? The dice I get on the validation set is only around 0.5. Looking forward to your reply! Thank you! : )

CUDA Memory Error

Hi Jaeho,
It's a very nice repository for segmentation model. I'm using your repository for segmenting the data of LIDC-IDRI but I'm facing the following error while running your codes as per your directions:
image

I'm using NVIDIA Geforce 940MX GPU with cuda, pytorch installed in virtual env.
Can you please help, what could be the probable solution.
Thanks.

crop_nodule function

I am unable to find the function crop_nodule in View_output.ipynb.
The function crop_nodule is called in function crop_patch.

Dice score coefficient

Hi Jaeho,

I was wondering what results you were able to get with your segmentation model? Specifically UNET (with and without augmentation).
Please let me know!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.