Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Segmentation error - predictions still loaded #1

Open
hermancollin opened this issue Feb 3, 2023 · 1 comment
Open

Segmentation error - predictions still loaded #1

hermancollin opened this issue Feb 3, 2023 · 1 comment

Comments

@hermancollin
Copy link
Member

First thank you for the work put into this. I find the napari plugin much more user-friendly and the interface also looks better. I especially like that the drag-and-drop feature! It feels faster than fsleyes too.
Also, we discussed slow startup but on my side the plugin loaded instantly.

When I apply the default_SEM_model, everything works fine and the predictions are displayed in napari. However in the terminal I get this error:

> File "/home/herman/Documents/NEUROPOLY_21/napari-ads/napari-plugin/napari-ADS/napari_ADS/_widget.py", line 184, in _on_apply_model_button_click
    segment.segment_image(
    │       └ <function segment_image at 0x7f3d835db430><module 'AxonDeepSeg.segment' from '/home/herman/Documents/NEUROPOLY_21/napari-ads/AxonDeepSeg/segment.py'>

  File "/home/herman/Documents/NEUROPOLY_21/napari-ads/AxonDeepSeg/segment.py", line 169, in segment_image
    model_resolution, patch_size = get_model_native_resolution_and_patch(path_model)
                                   │                                     └ PosixPath('/home/herman/Documents/NEUROPOLY_21/napari-ads/AxonDeepSeg/models/default_SEM_model')
                                   └ <function get_model_native_resolution_and_patch at 0x7f3e0c268550>

  File "/home/herman/Documents/NEUROPOLY_21/napari-ads/AxonDeepSeg/segment.py", line 92, in get_model_native_resolution_and_patch
    model_resolution = [model['transformation']['Resample']['wspace'], model['transformation']['Resample']['hspace']]
                        │                                              └ {'n_classes': 3, 'thresholds': [0, 0.2, 0.8], 'trainingset_patchsize': 512, 'trainingset': 'SEM_3c_512', 'batch_size': 8, 'ep...
                        └ {'n_classes': 3, 'thresholds': [0, 0.2, 0.8], 'trainingset_patchsize': 512, 'trainingset': 'SEM_3c_512', 'batch_size': 8, 'ep...

KeyError: 'transformation'

From further investigation, I found I did not download the models so obviously the segmentation couldn't be performed. However, segmentations with correct suffixes were present in the folder and they were loaded regardless. This is not ideal because if the user doesn't check his terminal, he doesn't even know that inference failed and could be mislead.

@Stoyan-I-A
Copy link
Member

I found I did not download the models

This is strange because the available models are given by ads_utils.get_existing_models_list(). Which should return a list of the models that are on your machine, in the axondeepseg/AxonDeepSeg/models folder. Or perhaps this model was present on your machine but it is an old one which is incompatible with the current version of ADS/Ivadomed?

This is not ideal because if the user doesn't check his terminal, he doesn't even know that inference failed and could be mislead.

I agree. Ideally, I would like to be able to catch the error from segment_image(). But if the error comes from Ivadomed I don't know if we can catch it. Also, segment_image() does not return an exit code, which could've been nice to know if there was an error.

@Stoyan-I-A Stoyan-I-A mentioned this issue Feb 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants