Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using omnipose models in Matlab Cellpose integration #60

Open
smury opened this issue Oct 25, 2023 · 1 comment
Open

Using omnipose models in Matlab Cellpose integration #60

smury opened this issue Oct 25, 2023 · 1 comment

Comments

@smury
Copy link

smury commented Oct 25, 2023

Not really an issue with omnipose as such but I'm trying to use the omnipose models in the Cellpose add-on for Matlab 2023b.

I found the model folder to which the models are downloaded and passed them to the Matlabs cellpose function.
However there is a problem with bact_phase_omnitorch_0

`Error using module>load_state_dict
Python Error: RuntimeError: Error(s) in loading state_dict for CPnet:
size mismatch for output.2.weight: copying a param with shape torch.Size([4, 32, 1, 1]) from checkpoint, the
shape in current model is torch.Size([3, 32, 1, 1]).
size mismatch for output.2.bias: copying a param with shape torch.Size([4]) from checkpoint, the shape in current
model is torch.Size([3]).

Error in resnet_torch>load_model (line 233)

Error in models>init (line 369)

Error in MWCellposeWrapper>createmodel (line 41)

Error in untitled (line 1)
cp=cellpose(Model='bact_phase_omnitorch_0',ModelFolder='C:\Users\murrays.TER.cellpose\models')`

The bact_phase_cptorch_0 model doesn't give an error but it does not segment my image no matter the parameters.

Any idea how to get either of these models working? Or are they specifc to omnipose and simply do not work with cellpose?

@smury smury changed the title Location of model files Using omnipose models in Matlab Cellpose integration Oct 25, 2023
@kevinjohncutler
Copy link
Owner

@smury sorry for the delay. Correct, the Omnipose models do not work with stock Cellpose, as the network initialization is a bit different (nclasses 3 for published Omnipose models, 2 for Cellpose). However, there is an implementation by another member of my lab (@tlo-bot) that will show you how to integrate Omnipose into Matlab (just calling it from terminal, as I recall): https://github.com/tlo-bot/supersegger-omnipose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants