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.11.tar.gz (12.4 MB view details)

Uploaded Source

Built Distribution

napari_czann_segment-0.0.11-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: napari-czann-segment-0.0.11.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.11.tar.gz
Algorithm Hash digest
SHA256 ad9d1eeb36e7b581db367e4311188e3a0a381e2a8899b9c54fd6f473b4ee0404
MD5 d9e3a55e1255e9af4ca65386c00d84d3
BLAKE2b-256 8111e4e862556745464fa04eeaf2219086554a6b96ddba857f0ff5ddff4bec00

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for napari_czann_segment-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 837edc12e7f142456d10aa2bda386138e0ac050fee3b192ef186fad49aa2ec43
MD5 5e53ba14cb550021f0257ce092bd3edf
BLAKE2b-256 45cc8bbf3d5b86cb7b04b63b820ff7f66f792733a9fda4382156e843ef6a3f77

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