Skip to content

Nelson-Gon/cytounet

Repository files navigation

cytounet: Deep Learning Based Cell Segmentation

PyPI version DOI Stage Test Install PyPI license Documentation Status Total Downloads Monthly Downloads Weekly Downloads Maintenance GitHub last commit GitHub issues GitHub issues-closed

Background

Project Workflow

This project was largely done as a summer 2020 intern in Dr. Mikael Bjorklund's
lab, whose guidance, resources, and time I am grateful for.

The aim was to automate a549 and rpe cancer cell segmentation and size determination.

RPE Sample

Sample data(10 random images each of train, validate, test sets) is provided in original_data.

A complete a549 cancer cell segmentation notebook is also provided.

Finally, pre-trained weights are provided that can be used for transfer learning. These were trained on considerably more data and for more epochs. For more pre-trained weights and/or data, please contact the author.

Note

  • To generate masks(labels) provided here a549 cancer cells were stained and imaged with fluorescence microscopy. These fluorescent images were then thresholded with threshold_images with a threshold value of 83. The images were then saved with save_images. The original fluorescent images are not provided here mainly due to the already huge size of the project.

  • This project is not limited to cancer cells. The model can be trained on almost any object, living and non-living. More examples are given below.


Installation

From PyPI:


pip install cytounet

From source or to use without installing locally:

git clone https://github.com/Nelson-Gon/cytounet.git
# proceed with usual source build procedure

Or:


pip install git+https://github.com/Nelson-Gon/cytounet.git

Import


from cytounet.model import *
from cytounet.data import *
from cytounet.augmentation import *
from cytounet.post_model import *

Detailed Sample Usage

Script mode

python -m cytounet -t "examples/original_data/a549/train" -i "images" -m "masks" -v 
"examples/original_data/a549/validation" -l "1e-8" -s 512 -ep 5 -se 250 -b 8 -tt "examples/original_data/a549/test/" 
-w "models/a549_test/test_model" -o "Adam" -mt "dice_coef" -ls "dice_coef_loss" -sd 2 -f 0 -p 0

To get help:

python -m cytounet -h 

Notebooks

Please see the following examples:

nbviewer

nbviewer

Visually:

CHO

Sample Object Area Visualization(see the typical usage notebook above for detailed usage)

Area Determination

For more examples or to add your own, please see the examples folder.

Experiments/Benchmarks

This section shows some experimental results based on publicly available data.

  • Comparison of low vs high quality masks on the model's output

This notebook shows the effects of "filled holes"(outlines whose area is filled with some colour e.g. white) on the model's quality. The results in general show that filled masks which are also better seen by the human eye result in better quality output.

The notebook can be accessed via this link.

TODO List

A checked box indicates support. You can either add more feature requests here or tackle unchecked boxes and make a pull request to add such support.

  • Single class segmentation

  • Grayscale images

  • Model Validation

  • Determining areas of objects in an image

  • Custom Number of Layers

  • Multi-class segmentation

  • Colored image input

  • COCO Datasets

  • CSV Based Annotations

  • XML Based Annotations

Frequently Asked Questions

Please read our Wiki Pages

To raise an issue or question

If the wiki does not answer your question, please raise a new issue. You can also open an issue if you have any discussion, criticism, or bug reports.

Thank you very much.


References

Credits

This repository has considerably diverged from the original implementation hence the need to distribute it separately.

This decision was taken in part due to the relative inactivity of the original implementation which would have made it harder to collaborate. Please take a look at the list of changes from the original implementation.

  • The Unet algorithm was introduced by Ronneberger et al. in their paper.

If you would like to cite this work, please use:

Nelson Gonzabato(2020) cytounet: Deep Learning Based Cell Segmentation, https://github.com/Nelson-Gon/cytounet

BibTex


@misc{Gonzabato2021,
  author = {Gonzabato, N},
  title = {cytounet: Deep Learning Based Cell Segmentation},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/Nelson-Gon/cytounet}},
  commit = {58bd951ef4417fc8542f8f3e277071e6cd6980ea}
}