Skip to content

The final project of ECBM-4040-Neural Networks and Deep Learning in Columbia University. Learning-based EM image segmentation (based on PyraMid-LSTM)

License

Notifications You must be signed in to change notification settings

yt2639/DPLN-EMSeg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECBM 4040 Final Project: [Learning-based EM image segmentation]

Our group dealt with the segmentation of electron microscopy (EM) images of neuronal structures using the PyraMid-LSTM model proposed by the paper. We also achieved a Multi-Dimensional LSTM (MD-LSTM) model for comparison.

Group: DPLN

https://github.com/hz2538

https://github.com/yt2639

https://github.com/XuzheZ

Getting Started

These instructions will provide you a guideline for our basic functions as well as how to running on your machine for development and testing purposes.

Prerequisites

python 3.6 (some specific packages you may need)

numpy: pip install numpy

libtiff: pip install libtiff

tensorflow: pip install tensorflow-gpu

matplotlib: pip install matplotlib

Jupyter Notebook

Introducing the files in project

main.iqynp

This script is our main jupyter notebook. Implemented our whole project.

loaddata.iqynp

This script is our second jupyter notebook. However, you have to run it first, since it will read the tiff file and convert it to array make sure you hace already install libtiff before using it. ./DPLN/pyramidLSTM.py

./DPLN/Net_PyramidLSTM.py

./DPLN/MDLSTM.py

./DPLN/Net_MDLSTM.py

Above py files define the layers.

./DPLN/ProcGenerator.py

This py file is refered to as a batch generator.

./DPLN/ProcessingV2.py

This py file provides the basic function for image preprocessing, including ROF denoise, Z-score normalization and augmentation.

test-volume.tiff, train-volume.tiff, train-label.tiff

They are the training data, labels and test data. Because it is a little tricky to download them, we provide them in the submission

./model

Save the trained model in this folder mainOut256.iqynb this is the automated produced version when we trained our model on the serverl. It record the printout output while training the Pyramid-LSTM, with a batch size 256*256

Running the test

1. Firstly, run the loaddata.iqynb to read the tiff image.

2. Secondly, Open main.iqynb through Jupyter Notebook:

  • Run the first several cells to finish modules importing, to load the data and labels as well as to implement preprocessing
    • This step will print out the size of data and label
    • This step apply ROF denoise and Z-score to training data and test data, and also apply data augmentation to training data and labels
  • For PyramidLSTM training, run the corresponding cell (which contains training function)
    • Set up proper batch_size (how many batch used in one step), input size (the size of voxel batch, and max_step (training steps).
    • The recommendation is: batch_size=1, input_size=[128,128,15], max_step=1000, (256*256 training is very time-consuming, may take about 12 mins for 10 steps)
    • This step will print out the number of net parameters, restored model, and will display the loss for every 10 steps.
  • For PyramidLSTM validation, run the corresponding cell (which contains validation function)
    • The fifth cell will reshape and save the validation sets remained in the training. It will print out th size of validation set.
    • The sixth cell can load the saved validation set.
    • The seventh cell will prediction for validation sets. And you can run the next two cells to save the prediction to .tiff file.
  • For PyramidLSTM test, run the run the corresponding cell (which contains test function)
    • This step will use the trained model "model/pyramidnet_size128" to finish the prediction for test data. You can run the next cell to save the prediction result to .tiff file. And upload this 32-bit .tiff file to 2012 ISBI Challenge for evaluation.
  • Please kindly notice that, in the main.iqynb, some cells have been to converted Markdown, if you find some cell can't run, please kindly try to convert above or below cells to code, and try again. We don't have so many time to clean them. Sorry for any inconvenience, we very appreciate your understanding.

Or: Run main.iqynb from terminal

  • You can also run the script from terminal, after enter your proper environment, and cd to the proper folder by

cd ./project

  • and input:

$ jupyter nbconvert --to notebook --execute --allow-errors --ExecutePreprocessor.timeout=600 main.ipynb

Our data set

In our project, the data set we uesd is The Drosophila first instar larva ventral nerve cord (VNC, Cardona et al., 2010, 2012) , provided by 2012 ISBI Challenge: Segmentation of neuronal structures in EM stacks. It contains 30 consecutive images as the training set with the ground truth 2D segmentation as training labels, as well as 30 consecutive images as the testing set. The microcube measures 2 x 2 x 1.5 microns approx, with a resolution of 4x4x50 nm/pixel. Templete training data and labels

Templete training data and labels (image from ISBI) This dataset is not completely public. If you want to get access to the dataset, you have to register, to login and then you can download the data. Since the dataset is relative small-size: 3 .tiff file, including 30 slices of 512*512 TEM images, with a size about 180MB. So we will provide the dataset in our submission.

Evaluation

The evaluation of the test result is based on two empirical metrics: Foreground-restricted Rand Scoring after border thinning: $V^{Rand}$ and Foreground-restricted Information Theoretic Scoring after border thinning: $V^{Info}$. Since the ground-truth of test data is not provided publicly, to evaluate the test result, you have to register and login the 2012 ISBI Challenge website and then upload the result. The evaluation is manually implemented by the logistics of ISBI, so it may take some time.

Our result

test image

Test data

prediction

Prediction

Leaderboard

Leaderboard

Leaderboard

About

The final project of ECBM-4040-Neural Networks and Deep Learning in Columbia University. Learning-based EM image segmentation (based on PyraMid-LSTM)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%