Skip to main content

Segmention using DeepLearning ONNX models packaged as *.czann files

Project description

napari-czann-segment

License PyPI Python Version napari hub

Semantic Segmentation using DeepLearning ONNX models packaged as *.czann files.


This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.

Train on APEER and use model in Napari

Installation

  • Please clone this repository first using your favorite tool.

  • Ideally one creates a new conda environment or use an existing environment that already contains Napari.

Feel free to create a new environment using the YAML file at your own risk:

cd the-github-repo-with-YAML-file
conda env create --file conda_env_napari_czann_segment.yml
conda activate napari_czmodel
  • Install the plugin locally

Please run the the following command:

pip install -e .

You can install napari-czann-segment via pip soon, when it will be published:

pip install napari-czann-segment

To install latest development version:

pip install git+https://github.com/sebi06/napari_czann_segment.git

What does the plugin do

The plugin allows you read open a *.czann file contains das Deep Neural Network (ONNX) for semantic segmentation and metadata. Such a model con be created in two ways:

  • Train the segmentation model fully automated on APEER and download the *.czann file
  • Train your model in a Jupyter notebook etc. and package it using the czmodel python package as an *.czann
  • To process also larger multi-dimensional images it uses the cztile package to chunk the individual 2d arrays using a specific overlap.

Using this plugin

Sample Data

A test image and a *.czann model file can be downloaded here.

  • PGC_20X.ome.tiff --> use PGC_20X_nucleus_detector.czann to segment

In order to use this plugin the user has to do the following things:

  • Open the image using "File - Open Files(s)" (requires napari-aicsimageio plugin).
  • Activate the napari-czann-segment plugin from "Plugins".
  • *Select a .czann file to use the model for segmentation.

Napari - Image loaded and czann selected

  • Adjust the minimum overlap used to the tiling (optional).
  • Select the layer to be segmented.
  • Press Segment Selected Image Layer to run the segmentation.

Napari - Image successfully segmented

A successful is obviously only the starting point for further image analysis steps to extract the desired numbers from the segmented image. Another example is shown below demonstrating a simple "Grain Size Analysis" using a deep-learning model trained on APEER used in napari

Napari - Simple Grain Size Analysis

Remarks

IMPORTANT: Currently the plugin only supports using models trained on a single channel image. Therefore make sure that during the training on APEER or somewhere else the correct inputs images are used. It is quite simple to train an single RGB image, which actually has three channels, load this image in napari and notice only then that the model will not work, because the image will 3 channels inside napari.

  • Only the CPU will be used for the inference using the ONNX runtime for the ONNX-CPU runtime
  • GPUs are not supported yet and will require ONNX-GPU runtime

Contributing

Contributions and Feedback are very welcome.

License

Distributed under the terms of the BSD-3 license, "napari-czann-segment" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

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

napari-czann-segment-0.0.12.tar.gz (12.4 MB view details)

Uploaded Source

Built Distribution

napari_czann_segment-0.0.12-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file napari-czann-segment-0.0.12.tar.gz.

File metadata

  • Download URL: napari-czann-segment-0.0.12.tar.gz
  • Upload date:
  • Size: 12.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for napari-czann-segment-0.0.12.tar.gz
Algorithm Hash digest
SHA256 045dc661916a5f2159f93f443baff2787d270a823e6fbbe7f60a8db4dde44321
MD5 25e3e438380c26088d57a61a609b9a8d
BLAKE2b-256 0dec5e6532d74a908795a192baab5df5429070f061a478e3646dce8bd5eb2531

See more details on using hashes here.

File details

Details for the file napari_czann_segment-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_czann_segment-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 bd8ca4f1295d2db4ac48a6075a94a18751f5426761f0bbff43f5bed1ea441496
MD5 a2a8af4028f0d48664209020803c3577
BLAKE2b-256 2293ab1c24d395b72709546c1a8e342d00975726e40b8f3ff56271a4bd5cd4bb

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