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

Unable to evaluate 3D unet in CLI #27

Open
buswinka opened this issue Nov 15, 2022 · 2 comments
Open

Unable to evaluate 3D unet in CLI #27

buswinka opened this issue Nov 15, 2022 · 2 comments

Comments

@buswinka
Copy link

Hello! I am trying to evaluate the 3D UNet on a plant segmentation datasets via the CLI with this command: https://github.com/security
python -m omnipose --omni --dir ./ --dim 3 --z_axis 0 --all_channels --use_gpu --verbose

The input images are greyscale 3D tifs of shape [Z, X, Y]. The CLI seems to evaluate a 2D model on each slice, instead of 3D model, then fails here:

Traceback (most recent call last):
  File "/home/chris/anaconda3/envs/omnipose/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/chris/anaconda3/envs/omnipose/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/chris/anaconda3/envs/omnipose/lib/python3.10/site-packages/omnipose/__main__.py", line 3, in <module>
    main(omni_CLI=True)
  File "/home/chris/anaconda3/envs/omnipose/lib/python3.10/site-packages/cellpose/__main__.py", line 344, in main
    out = model.eval(image, channels=channels, diameter=diameter, rescale = args.rescale,
  File "/home/chris/anaconda3/envs/omnipose/lib/python3.10/site-packages/cellpose/models.py", line 300, in eval
    masks, flows, styles = self.cp.eval(x,
  File "/home/chris/anaconda3/envs/omnipose/lib/python3.10/site-packages/cellpose/models.py", line 706, in eval
    masks, styles, dP, cellprob, p, bd, tr = self._run_cp(x,
  File "/home/chris/anaconda3/envs/omnipose/lib/python3.10/site-packages/cellpose/models.py", line 900, in _run_cp
    p = np.array(p)
ValueError: could not broadcast input array from shape (2,512,512) into shape (2,)

Is there a better way to evaluate the 3D model from the CLI? Thank you!

@kevinjohncutler
Copy link
Owner

@buswinka That is an oversight on my part, I may not have validated the use of 3D models via CLI. That command looks right to me with --dim 3, so something is just going wrong with passing parameters in main.py. I will work on a fix tonight.

@buswinka
Copy link
Author

Ayy not a problem. I got it running in 3D via the api. Not worth losing sleep over. Its good to double check! Thank you!

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