Skip to main content

cell segmentation algorithm improving on the Cellpose framework

Project description

bacteria omnipose

Why use Omnipose

Omnipose solves the over-segmentation problems of Cellpose on large, ansiotropic cells. This is particularly relevant for bacterial cells, but Omnipose is suitable for aribtrary cell shapes.

How to use Omnipose

To use Omnipose on bacterial cells, use model_type=bact_omni. For other cell types, try model_type=cyto2_omni. You can also use your own Cellpose models with omni=True to use the Omnipose mask reconstruction algorithm to alleviate over-segmentation.

We trained our bact_omni model using the following command, and you can train custom Omnipose models similarly:

python -m cellpose --train --use_gpu --dir <bacterial dataset directory> --mask_filter _masks --n_epochs 4000 --pretrained_model None --learning_rate 0.1 --diameter 0 --batch_size 16 --omni

Notably, while we found that while Cellpose does not benefit much from more than 500 epochs, Omnipose continues to improve until around 4000 epochs. Omnipose outperforms Cellpose at 500 epochs but is significantly better at 4000. You can use --save_every <n> and --save_each to store intermediate model training states to explore this behavior.

More about Omnipose

Omnipose builds on Cellpose in a number of ways described in our paper. It turns out that cell 'centers' are not well-defined, and this is a huge problem for any cells that are long and curved - generally leading to over-segmentation.

To fix this, we turned to the distance field (also known as the distance transform). This morphology-independent field replaces the uniform cell probability field of Cellpose, and its gradient replaces the heat-derived flow field of Cellpose.

The distance field works the same way as cell probability output, meaning it can be thresholded (with the same values!) to seed cell masks. However, it carries a lot more information and we use it to refine the mask recontruction parameters when cells get too thin.

The flow field points towards the skeleton of the cell, and we built a new mask recontruction algorithm to leverage this fact. While cellpose tends to over-segement long cells, Omnipose can segment cells of any morphology whatsoever.

Omnipose has a fourth ouput class (as opposed to three in Cellpose). This extra output is a boundary probability field, which we found helped the network to make better predictions at cell boundaries. It is also useful in mask recontruction.

Licensing

See LICENSE.txt for details. This license does not affect anyone using Cellpose/Omnipose for noncommerical applications.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omnipose-0.2.0.tar.gz (29.7 MB view details)

Uploaded Source

Built Distribution

omnipose-0.2.0-py3-none-any.whl (80.5 kB view details)

Uploaded Python 3

File details

Details for the file omnipose-0.2.0.tar.gz.

File metadata

  • Download URL: omnipose-0.2.0.tar.gz
  • Upload date:
  • Size: 29.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for omnipose-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ffecffcfbbee7fddb84d9480f089bd7edbf01f53283da00f3ea8bedb91d5e37c
MD5 4f1551831c7c2e199e88914aad66c8d2
BLAKE2b-256 87bf2c2266633a5a552f62888e07e81cbe5b7e5c5756ed1dde0376a2cdc3da3d

See more details on using hashes here.

File details

Details for the file omnipose-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: omnipose-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 80.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1

File hashes

Hashes for omnipose-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f4f074b7e8d62e3ebc99346c2e313f69e3de338cd465a70988d38ea42a857ec
MD5 89e25c7833924fc9062c49f90525a7a7
BLAKE2b-256 d8ec689d2ec7ad9ef7b74a542147572f2ff161b0fb8dfb641b48628ae0c20e59

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page