- Detect boundaries of cell nuclei in images of human U2OS cells using Deep Contour-Aware Networks (DCAN) model created by Chen et. al
- Note: in contrast to paper, there is no auxiliary supervision in the upsampled layers
- Image set: https://data.broadinstitute.org/bbbc/BBBC006/
All code within tf-dcan/
was written for the Broad Institute human U2OS cells image set referenced above. This image set contains 384 images at 32 different z-indices (from an automated microscope), and are of size 692 x 520.
For running on your own images, you must:
- Generate a set of ground truth contours and segments as described in the DCAN paper.
- Use
fm-prep/traceBounds.m
as a starting point.
- Use
- Customize
bbbc006.py
andbbbc006_input.py
indcan-tensorflow/
according to your data (e.g., image dimensions, file type decoding).
To run the code on the U2OS image set, follow all steps in the sections below.
The fm-prep/
directory contains MATLAB scripts to automatically select the optimal focal plane for each image.
- Move all directories from the U2OS image set to the repo's root.
- Run
fmeasureAll()
in MATLAB to compute the focus measure of each image.- Make sure to install the
fmeasure
function and change line 10 offmeasureAll.m
to point to the directory.
- Make sure to install the
- Run
saveImgsAll()
in MATLAB to save the detected in-focus images to an output directory calledBBBC006_v1_focused/
.- Change line 6 of
saveImgs.m
if you want to rename the output directory.
- Change line 6 of
The tf-dcan/
contains all TensorFlow code, which uses the CIFAR-10 tutorial code as a skeleton.
- Using virtualenv, run the following to install all dependencies.
virtualenv venv --distribute
source venv/bin/activate
pip install -r requirements.txt
- Run
bbbc006_train.py
(orbbbc006_multi_gpu_train.py
for multiple GPUs) to train the network.- Adjust the parameters lines 54-60 of
bbbc006.py
to fit your training data (especially lines 59-60, which deal with class imbalance).
- Adjust the parameters lines 54-60 of
- Run
bbbc006_eval.py
for evaluation using dice coefficient. - Use TensorBoard to visualize the results in
/tmp/bbbc006_train
and/or/tmp/bbbc006_eval
for training and evaluation results, respectively.