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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: napari-czann-segment-0.0.10.tar.gz
  • Upload date:
  • Size: 28.9 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.10.tar.gz
Algorithm Hash digest
SHA256 d6a53c5399a9fcfb3fbe0495aabc21d895829202de4d7106c74ca634e4d373fa
MD5 4d808c3a178cb2574f9f42876dac144b
BLAKE2b-256 1e03cb734eb69c7a6d057ffe6bf2e62b8bcf7c4764e6391507ed16b0d9bfcce9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for napari_czann_segment-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 d0a9aca818b9f4bd32677858278d8b02ef1541226c13f488b05c27d6222b631d
MD5 d44cb2a0d35eb43c9823b90f3b80c7f0
BLAKE2b-256 212e8d22208b4719cb6f8571c185cadbcdc38211e3c40121a7d6471c6db62b23

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