Issue opening a .czmodel in python

Discuss questions and projects related to processing of imaging data here
Post Reply
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
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