DiamondLightSource / SuRVoS

(Su)per (R)egion (Vo)lume (S)egmentaton workbench
Apache License 2.0
25 stars 5 forks source link

SuRVoS crashes when attempting to press the save classifier to disk #109

Closed stevel705 closed 3 years ago

stevel705 commented 3 years ago

Hello. After I train any classification model, I want to save the model. But when I click save classifier to disk, I get


Traceback (most recent call last):
  File "/home/stevel/anaconda3/envs/survos-env/lib/python3.6/site-packages/survos/plugins/training.py", line 234, in on_save_clf_clicked
    self.DM.save_classifier(path, attrs)
  File "/home/stevel/anaconda3/envs/survos-env/lib/python3.6/site-packages/survos/core/model.py", line 263, in save_classifier
    self.save_supervox_and_filter_settings(out_file, has_classifier=True)
  File "/home/stevel/anaconda3/envs/survos-env/lib/python3.6/site-packages/survos/core/model.py", line 289, in save_supervox_and_filter_settings
    if not any(d.get('feature_idx', None) == int(sv_source_index) for d in result_list):
  File "/home/stevel/anaconda3/envs/survos-env/lib/python3.6/site-packages/survos/core/model.py", line 289, in <genexpr>
    if not any(d.get('feature_idx', None) == int(sv_source_index) for d in result_list):
ValueError: invalid literal for int() with base 10: 'data'
Aborted (core dumped)```

Also I tried to reinstall and run on different operating systems. I trained the model in ubuntu and windows 10. And I get the same problem.
OllyK commented 3 years ago

Hi @Stevel705, thanks for reporting this. I just tried a fresh install on Windows 10 and couldn't repeat this issue. Could you give more detail on which features you were using when training your model and which model type you were using?

stevel705 commented 3 years ago

Select sources: Data or any features. Without a difference. The model that is used is a random forest. image

OllyK commented 3 years ago

Thanks @Stevel705 for getting back to me. I've manged to reproduce this bug now. This only happens if you've created supervoxels directly from the raw data, which is something that we don't normally do. I'll look in to fixing it, but in the meantime, you can get round this by creating your supervoxels with a feature layer as a source rather than directly from the raw data. For example I would recommend using a Gaussian or Total Variation denoised volume as the source for your supervoxels. This generally gives better supervoxels, since any noise in the data can lead to distorded supervoxel shapes.

OllyK commented 3 years ago

Have put in a fix but will need to rebuild SuRVoS and create a new release before it can be installed. For now, raw data cannot be used as the source for creation of supervoxels if settings/classifier are to be saved.

stevel705 commented 3 years ago

Thank you for the quick response and correction. And thank you for the recommendations and new information.