Issue opening a .czmodel in python

Discuss questions and projects related to processing of imaging data here
Elizabeth Pereira
Posts: 2
Joined: Mon Oct 18, 2021 3:42 pm

Issue opening a .czmodel in python

Post by Elizabeth Pereira »

I'm trying to load a trained model from the Zeiss Intellesis program into Python to use. I've exported the model from Intellesis and it creates a folder with 3 files in it- a .model file, an xml document, and another file that I think just has the modelid.

I was told by a Zeiss rep that the model file is an ONNX model but when I tried to open the model using the onnx package in python I get the error-

File "C:\Users\epereira\PycharmProjects\Imaging\Intellesis\lib\site-packages\onnx\__init__.py", line 99, in _deserialize
decoded = cast(Optional[int], proto.ParseFromString(s))
google.protobuf.message.DecodeError: Error parsing message

Is there something wrong with the files? I've tried multiple exported models and they all give this error. Also the model files are quite small (~200 KB) which makes me think something is wrong?

I also looked into trying to open as a tensorflow model but there are no .pb files produced from export from Intellesis so I didn't see a way of doing that

How do you open these models in python?
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Issue opening a .czmodel in python

Post by CarlZeissMicroscopy3 »

Hello Elizabeth Pereira,

Files exported from the Zeiss Intellesis module (wizard, trained etc.) are not ONNX compatible.

In Open Application Development (OAD) of Zen there is an object model which can be accessed via macro (Iron-Python).

The root object is ZenIntellesis and features are like:

Code: Select all

ZenIntellesis.ObjectClassification.ImportModel()
ZenIntellesis.ObjectClassification.FindModelByName()
ZenIntellesis.ObjectClassification.ListAvailableModels()

ZenIntellesis.Segmentation.GetAvailableFeatureSets()
ZenIntellesis.Segmentation.GetAvailablePostProcessings()
ZenIntellesis.Segmentation.ImportModel()
ZenIntellesis.Segmentation.ListAvailableModels()
I hope this gives an impression how we work in Python.
Elizabeth Pereira
Posts: 2
Joined: Mon Oct 18, 2021 3:42 pm

Re: Issue opening a .czmodel in python

Post by Elizabeth Pereira »

Thanks for the reply. I think my actual question is can the trained Intellesis models be run outside of the Zen ecosystem?

Thank you.
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Issue opening a .czmodel in python

Post by CarlZeissMicroscopy3 »

Can the trained Intellesis models be run outside of the Zen ecosystem?
Sorry no, not with current releases.

But this is of course a feature to be discussed for future Zen versions.

Thank you for your contribution!
Sebastian Rhode
Posts: 2
Joined: Wed May 27, 2020 4:33 pm

Re: Issue opening a .czmodel in python

Post by Sebastian Rhode »

Hi all,

there is a fundamental misunderstanding here.

- ZEN supports executing ONNX models since a while, but the training for such Deep Neural networks is not done in ZEN but on www.apeer.com. There the DNN will be export as a czmodel, which is just a ZIP file with some metadata in it and the ONNX model

- if you train a model directly in ZEN Intellesis it will be a RandomForrest-based decision tree (sklearn), which you obviously cannot use outside in you Python code by trying to load an ONNX model because there is none
Karl Effelt
Posts: 1
Joined: Fri Mar 24, 2023 10:18 am

Re: Issue opening a .czmodel in python

Post by Karl Effelt »

Azriel Jaxx wrote: Tue Mar 21, 2023 11:10 am Please check https://accedii.com/ the following compatibility matrix for ZEN Blue/Core and the respective version (self.version) of the CZANN Model Specification JSON Meta data file fnf
Thanks for clarification. It was very helpful.
Damon Jeffrey
Posts: 1
Joined: Wed May 10, 2023 9:46 pm

Re: Issue opening a .czmodel in python

Post by Damon Jeffrey »

If you are unable to load the model using the onnx package, you might consider reaching out to Zeiss support or the Intellesis program's support team for assistance. They can provide specific guidance on how to correctly import auritine and use the exported models from their program in Python. They should be familiar with any potential quirks or specific requirements of the exported models.
Last edited by Damon Jeffrey on Wed May 31, 2023 10:37 pm, edited 1 time in total.
all apps
Posts: 2
Joined: Mon May 22, 2023 7:03 am

Re: Issue opening a .czmodel in python

Post by all apps »

To open a .czmodel file exported from Zeiss Intellesis in Python, you need to use the Zeiss Intellesis SDK. This SDK provides the necessary tools and functions to load and work with Intellesis models.

Here are the general steps to open a .czmodel file using the Intellesis SDK:

Install the Intellesis SDK: You can obtain the Intellesis SDK from Zeiss and follow the installation instructions provided.

Import the necessary modules: In your Python script, import the required modules from the Intellesis SDK.

Code: Select all

from zeiss.intellesis.io import ModelIO
Load the model: Use the ModelIO class to load the .czmodel file.

Code: Select all

model_io = ModelIO()
model = model_io.read_model("path/to/your/model.czmodel")
Make sure to replace "path/to/your/model.czmodel" with the actual path to your .czmodel file.
https://alllearningapps.com/careerist-review/
With the loaded model, you can perform various operations like inference or further analysis depending on your requirements.

Note that the .czmodel file is specific to the Zeiss Intellesis program and requires the Intellesis SDK for proper handling. It is not directly compatible with other common machine learning frameworks like ONNX or TensorFlow.

If you continue to experience issues or have further questions, I recommend reaching out to Zeiss support for more specific guidance and assistance with using the Intellesis SDK.
Sebastian Rhode
Posts: 2
Joined: Wed May 27, 2020 4:33 pm

Re: Issue opening a .czmodel in python

Post by Sebastian Rhode »

Hello all

the only officially supported package to unpack a model (*.czann) file is the https://pypi.org/project/czmodel/ python package.

- The is no officially supported Intellesis SDK
- If "someone created" such a tool we would be really curious to learn about it

Best regards,

The Intellesis DevTeam
James Middleditch
Posts: 1
Joined: Mon Jan 15, 2024 12:07 pm
Contact:

Re: Issue opening a .czmodel in python

Post by James Middleditch »

I'd start by looking in to the parsing error to try and troubleshoot and resolve the issue:

1. Verify the ONNX model file's integrity: ensure that the .model file you are trying to open is indeed an ONNX model. You can do this by checking the file's header for the typical ONNX magic number or signature. The ONNX format usually starts with specific bytes that identify it as an ONNX file. Given the small size of the model file (~200 KB), it's worth considering if the file is complete or if there was an error during the export process.

2. Ensure that the version of the ONNX Python package you are using supports the ONNX version of the exported model.

3. Make sure the Python environment and dependencies are all correctly set up and up to date.

Hope it helps! I ran into similar issues earlier, and got no reply from support. Spent my days playing games until I figured help is not gonna arrive and had to figure it out myself - turned out to be that somewhere during the model downloading / exporting process, it had just gone wrong and I had a corrupted file in my hands. Re-exporting it fixed the problem for me, hopefully for you too.
A husband, a father, a racing car driver, a geek for all things tech and videogames. Oh, and a CTO on the side.
Currently building a free gaming website, including 2 player games at https://www.hahagames.com/tags/2-player
Post Reply