kevinjohncutler / omnipose

Omnipose: a high-precision solution for morphology-independent cell segmentation
https://omnipose.readthedocs.io
Other
85 stars 29 forks source link

Issues training on CLI #23

Closed carolche closed 1 year ago

carolche commented 1 year ago

Hello, I am trying to train my model on Omnipose CLI, but I keep getting two different errors: 1) raise RuntimeError('affine matrix has wrong number of rows') 2) AttributeError: 'CPnet' object has no attribute 'module'. Did you mean: 'modules'? I tried using my own images as well as data from the Stardist training set. Any help would be greatly appreciated.

Screen Shot 2022-10-25 at 14 15 15 Screen Shot 2022-10-25 at 14 15 41

Thanks so much for your work and help.

JojoDevel commented 1 year ago

I am getting exactly the same error

JojoDevel commented 1 year ago

The problem seems to be in this if/else statement. When I disable the if the training runs through.

https://github.com/kevinjohncutler/cellpose/blob/6b6a2888745c2a6afe9fdc02c35165fba31f15a8/cellpose/core.py#L1051

kevinjohncutler commented 1 year ago

@JojoDevel @carolche Could you let me know which version of pytorch you have installed with pip list? I am running 1.12.1 with no training issues, but the torch API and cuda support changes so frequently that upgrading to 1.13.0 or downgrading to 1.8.1 caused two compeltely different issues to the one you raise. Let me know your cuda version as well, if applicable (could be a training on CPU issue, which I'll take a look at as well - might be likely considering that note on the if statement).

Edit: indeed, this issue appears when training on CPU. I'll do my best to fix this. I think the main branch of cellpose does not support training on CPU because it's probably too slow to be useful (or worse, pytorch actually doesn't support it). We shall see.

kevinjohncutler commented 1 year ago

Ok, @JojoDevel that if/else was entirely removed in cellpose a long time ago (presumably this an mxnet/torch compatibility thing). Download v0.7.2 cellpose-omni for the fixed version!

carolche commented 1 year ago

@kevinjohncutler I downloaded the 0.7.2 cellpose-omni version and it worked! Thank you so much! take care

JojoDevel commented 1 year ago

@kevinjohncutler I just looked into the cellpose submodule in the repo. Is that not in sync with the cellpose version we should use?