Skip to content

[BUG] ROIs deleted after running CPSAM in v 4.0.8 #1350

@totoro7034

Description

@totoro7034

Describe the bug
Disclaimer, this is my first time using cellpose and I am a relatively novice coder.

I installed the GUI for cellpose v 4.0.8 without issues and am able to open it. I uploaded an image and drew rois, but every time I run CPSAM, the rois are deleted and listed as 0. Am I missing something? What does the percentage refer to in the segmentation box? I was under the impression that after running CPSAM masks would be generated that resemble the ROIs that I drew.

To Reproduce
Steps to reproduce the behavior:

  1. run % python -m cellpose
  2. Upload image to GUI
  3. Draw ROIs
  4. Click "run CPSAM"
Run log
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.2.6 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/opt/anaconda3/envs/cellpose/lib/python3.10/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/site-packages/cellpose/__init__.py", line 1, in <module>
    from cellpose.version import version, version_str
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/site-packages/cellpose/version.py", line 7, in <module>
    import torch
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/site-packages/torch/__init__.py", line 1477, in <module>
    from .functional import *  # noqa: F403
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/site-packages/torch/functional.py", line 9, in <module>
    import torch.nn.functional as F
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/site-packages/torch/nn/__init__.py", line 1, in <module>
    from .modules import *  # noqa: F403
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/site-packages/torch/nn/modules/__init__.py", line 35, in <module>
    from .transformer import TransformerEncoder, TransformerDecoder, \
  File "/opt/anaconda3/envs/cellpose/lib/python3.10/site-packages/torch/nn/modules/transformer.py", line 20, in <module>
    device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
/opt/anaconda3/envs/cellpose/lib/python3.10/site-packages/torch/nn/modules/transformer.py:20: UserWarning: Failed to initialize NumPy: _ARRAY_API not found (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/torch/csrc/utils/tensor_numpy.cpp:84.)
  device: torch.device = torch.device(torch._C._get_default_device()),  # torch.device('cpu'),
2025-10-19 16:23:09,356 [INFO] WRITING LOG OUTPUT TO /Users/Name/.cellpose/run.log
2025-10-19 16:23:09,356 [INFO] 
cellpose version: 	4.0.7 
platform:       	darwin 
python version: 	3.10.18 
torch version:  	2.2.2
2025-10-19 16:23:09,868 [INFO] Neither TORCH CUDA nor MPS version not installed/working.
GUI_INFO: image shape: (2253, 3007, 3)
GUI_INFO: normalization checked: computing saturation levels (and optionally filtered image)
{'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': True, 'sharpen_radius': 0.0, 'smooth_radius': 0.0, 'tile_norm_blocksize': 0.0, 'tile_norm_smooth3D': 1.0, 'invert': False}
[0, 255.0]
(1, 2253, 3007, 3)
GUI_INFO: 3 masks found
GUI_INFO: creating cellcolors and drawing masks
GUI_INFO: loaded in previous changes
GUI_INFO: loading image: /Users/Name/Downloads/cells.jpg
GUI_INFO: image shape: (640, 640, 3)
GUI_INFO: normalization checked: computing saturation levels (and optionally filtered image)
{'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': True, 'sharpen_radius': 0.0, 'smooth_radius': 0.0, 'tile_norm_blocksize': 0.0, 'tile_norm_smooth3D': 1.0, 'invert': False}
[np.float32(12.0), np.float32(255.0)]
2025-10-19 16:24:08,227 [INFO] >>>> using CPU
2025-10-19 16:24:08,227 [INFO] >>>> using CPU
2025-10-19 16:24:10,364 [INFO] >>>> loading model /Users/Name/.cellpose/models/cpsam
{'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': True, 'sharpen_radius': 0.0, 'smooth_radius': 0.0, 'tile_norm_blocksize': 0.0, 'tile_norm_smooth3D': 1.0, 'invert': False}
NET ERROR: Numpy is not available
GUI_INFO: 1 ROIs saved to /Users/Name/Downloads/cells_seg.npy
GUI_INFO: 2 ROIs saved to /Users/Name/Downloads/cells_seg.npy
2025-10-19 16:24:24,307 [INFO] >>>> using CPU
2025-10-19 16:24:24,307 [INFO] >>>> using CPU
2025-10-19 16:24:26,423 [INFO] >>>> loading model /Users/Name/.cellpose/models/cpsam
{'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': True, 'sharpen_radius': 0.0, 'smooth_radius': 0.0, 'tile_norm_blocksize': 0.0, 'tile_norm_smooth3D': 1.0, 'invert': False}
NET ERROR: Numpy is not available
GUI_INFO: 1 ROIs saved to /Users/Name/Downloads/cells_seg.npy
GUI_INFO: 2 ROIs saved to /Users/Name/Downloads/cells_seg.npy
GUI_INFO: 3 ROIs saved to /Users/Name/Downloads/cells_seg.npy
2025-10-19 16:26:05,730 [INFO] >>>> using CPU
2025-10-19 16:26:05,731 [INFO] >>>> using CPU
2025-10-19 16:26:07,806 [INFO] >>>> loading model /Users/Name/.cellpose/models/cpsam
{'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': True, 'sharpen_radius': 0.0, 'smooth_radius': 0.0, 'tile_norm_blocksize': 0.0, 'tile_norm_smooth3D': 1.0, 'invert': False}
NET ERROR: Numpy is not available

Screenshots

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions