Giter Club home page Giter Club logo

biomedical-segmentation-with-pytorch's Introduction

Biomedical Segmentation with PyTorch

Pixel-wise segmentation for biomedical images using Pytorch. This project was part of my Bachelor Thesis.

Dataset

alt text

The code was tested on a biomedical breast cancer dataset which can't be provided due to data privacy. A very similar dataset can be found at bioimage.ucsb.edu Note: The images have a different size than the images I'm using. The network achitecture (reshaping of tensors, padding after each convolution) needs to be tuned a little bit to work with the data.

Architectures

I have implemented the following architecture:

Required packages

torch
torchvision
numpy
PIL
pydensecrf

The code is based on Python 3.6

Folder Structure

.
├── data                    # training dataset
├── val                     # validation set
├── checkpoints             # checkpoints to store the model

Data and Val folder needs to contain .txt files with filenames of the data. The "create_txt" script can be used to generate these.

Usage

There are multiple parameters which can be used:

main.py

-e	# number of epochs to train
-l	# learning rate
-g	# use this parameter to utilize your GPU
-c	# load a pretrained model

predict.py

-m	# path to the pretrained model / checkpoint
-i	# input image to predict
-o	# filename of the output image
-c	# GPU support is enabled by default. Use this parameter to predict on CPU

There are some more parameters which can be useful.

Evaluation

Further evaluation needs to be done in the future. For now the net reached an Accuracy of 87% (Dice Coefficient of 0.87) on a small validation set.

Some notes about hardware

I'm using a Nvidia GTX 1070 (8GB VRAM) to train the net. The highest memory usage I could observe was about 5,5GB. The size of the images is 510x512 which will be downscaled to 255x256. Downscaling even further will lower the memory needed.

Training took about 1 1/2 hours.

biomedical-segmentation-with-pytorch's People

Contributors

sleyai avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

biomedical-segmentation-with-pytorch's Issues

About upsampling

Hello.
I see that you said you wanted to learn the umsampling layers, but i dont see were you sset param.require_grad() = false, this means you learned them?
I have like 3k images with brain tumors, i have a FCN8s net and i managed to obtain 50% IOU accuracy, and with a unet 60% Dice. I see that you obtain more. Can I use your net, and do you have thet weigths sa I can make transfer learning?
PS. You can use google colab, where you have 15GB gpu memory for free

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.