MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.33k stars 382 forks source link

[BUG] `IndexError` when running cyto3 from the GUI for 3D Segmentation with GPU #870

Closed zoccoler closed 7 months ago

zoccoler commented 7 months ago

Describe the bug I have an image with the shape 21 x 3 x 2152 x 2552 (ZCYX). Actually there is only one channel, but I converted all slices from grayscale to RGB and reshaped it (not sure if this was necessary, but could not visualize it properly otherwise). It consists a tissue labelled with a membrane dye (non-specific). Unfortunately, I cannot share the raw image, since it is private data from a collaborator.

I tried to run the cyto3 pre-trained model in 3D (use GPU enabled), but the process gets stuck at 75% and I get the following error in the prompt:

Click to expand ``` python -m cellpose --Zstack 2024-02-22 10:52:10,674 [INFO] WRITING LOG OUTPUT TO C:\Users\mazo260d\.cellpose\run.log 2024-02-22 10:52:10,675 [INFO] cellpose version: 3.0.4 platform: win32 python version: 3.8.18 torch version: 2.2.1 2024-02-22 10:52:11,079 [INFO] ** TORCH CUDA version installed and working. ** GUI_INFO: loading image: D:/Datasets/Priyanka/TauInternalization/membrane_channel_rgb_3D_ZCYX.tiff 2024-02-22 10:52:18,947 [INFO] reading tiff with 21 planes 100%|██████████████████████████████████████████████████████████████████████████████████| 21/21 [00:00<00:00, 38.22it/s] GUI_INFO: converted to float and normalized values to 0.0->255.0 GUI_INFO: normalization checked: computing saturation levels (and optionally filtered image) {'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': False, 'sharpen_radius': 0, 'smooth_radius': 0, 'tile_norm_blocksize': 0, 'tile_norm_smooth3D': 1, 'invert': False} 2024-02-22 10:55:04,201 [INFO] ** TORCH CUDA version installed and working. ** 2024-02-22 10:55:04,201 [INFO] >>>> using GPU 2024-02-22 10:55:04,203 [INFO] >> cyto3 << model set to be used 2024-02-22 10:55:04,426 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training) {'lowhigh': None, 'percentile': [1.0, 99.0], 'normalize': True, 'norm3D': False, 'sharpen_radius': 0, 'smooth_radius': 0, 'tile_norm_blocksize': 0, 'tile_norm_smooth3D': 1, 'invert': False} 2024-02-22 10:55:05,109 [INFO] ~~~ FINDING MASKS ~~~ 2024-02-22 10:55:05,117 [INFO] multi-stack tiff read in as having 21 planes 3 channels 2024-02-22 10:55:10,926 [INFO] 0%| | 0/21 [00:00>>> TOTAL TIME 112.02 sec Traceback (most recent call last): File "C:\Users\mazo260d\mambaforge\envs\cellpose-gpu3\lib\site-packages\cellpose\gui\guiparts.py", line 139, in self.clicked.connect(lambda: self.press(parent)) File "C:\Users\mazo260d\mambaforge\envs\cellpose-gpu3\lib\site-packages\cellpose\gui\guiparts.py", line 143, in press parent.compute_segmentation(model_name=self.model_name) File "C:\Users\mazo260d\mambaforge\envs\cellpose-gpu3\lib\site-packages\cellpose\gui\gui.py", line 2228, in compute_segmentation self.flows.append(resize_image(self.flows[j], Ly=self.Ly, IndexError: list index out of range ```

To Reproduce Steps to reproduce the behavior:

  1. Open cellpose GUI from the command line with flag --Zstack
  2. Open data by drag and drop
  3. Enter new diameter (200) and hit enter
  4. Enter new stich threshold value (0.8) and hit enter
  5. Click on run cyto3 (use GPU is enabled)

Run log These are the package versions installed in my environment:

Click to expand ``` # packages in environment at C:\Users\mazo260d\mambaforge\envs\cellpose-gpu3: # # Name Version Build Channel blas 2.121 mkl conda-forge blas-devel 3.9.0 21_win64_mkl conda-forge bzip2 1.0.8 hcfcfb64_5 conda-forge ca-certificates 2024.2.2 h56e8100_0 conda-forge cachetools 5.3.2 pypi_0 pypi cellpose 3.0.4 pypi_0 pypi certifi 2024.2.2 pypi_0 pypi charset-normalizer 3.3.2 pypi_0 pypi colorama 0.4.6 pypi_0 pypi cuda-cccl 12.3.101 0 nvidia cuda-cudart 12.1.105 0 nvidia cuda-cudart-dev 12.1.105 0 nvidia cuda-cupti 12.1.105 0 nvidia cuda-libraries 12.1.0 0 nvidia cuda-libraries-dev 12.1.0 0 nvidia cuda-nvrtc 12.1.105 0 nvidia cuda-nvrtc-dev 12.1.105 0 nvidia cuda-nvtx 12.1.105 0 nvidia cuda-opencl 12.3.101 0 nvidia cuda-opencl-dev 12.3.101 0 nvidia cuda-profiler-api 12.3.101 0 nvidia cuda-runtime 12.1.0 0 nvidia fastremap 1.14.1 pypi_0 pypi filelock 3.13.1 pyhd8ed1ab_0 conda-forge fsspec 2024.2.0 pypi_0 pypi gettext 0.21.1 h5728263_0 conda-forge glib 2.78.4 h12be248_0 conda-forge glib-tools 2.78.4 h12be248_0 conda-forge google-api-core 2.17.1 pypi_0 pypi google-auth 2.28.1 pypi_0 pypi google-cloud-core 2.4.1 pypi_0 pypi google-cloud-storage 2.14.0 pypi_0 pypi google-crc32c 1.5.0 pypi_0 pypi google-resumable-media 2.7.0 pypi_0 pypi googleapis-common-protos 1.62.0 pypi_0 pypi gst-plugins-base 1.22.9 h001b923_0 conda-forge gstreamer 1.22.9 hb4038d2_0 conda-forge icu 73.2 h63175ca_0 conda-forge idna 3.6 pypi_0 pypi imagecodecs 2023.3.16 pypi_0 pypi importlib-metadata 7.0.1 pypi_0 pypi intel-openmp 2024.0.0 h57928b3_49841 conda-forge jinja2 3.1.3 pyhd8ed1ab_0 conda-forge krb5 1.21.2 heb0366b_0 conda-forge libblas 3.9.0 21_win64_mkl conda-forge libcblas 3.9.0 21_win64_mkl conda-forge libclang 15.0.7 default_hde6756a_4 conda-forge libclang13 15.0.7 default_h85b4d89_4 conda-forge libcublas 12.1.0.26 0 nvidia libcublas-dev 12.1.0.26 0 nvidia libcufft 11.0.2.4 0 nvidia libcufft-dev 11.0.2.4 0 nvidia libcurand 10.3.4.107 0 nvidia libcurand-dev 10.3.4.107 0 nvidia libcusolver 11.4.4.55 0 nvidia libcusolver-dev 11.4.4.55 0 nvidia libcusparse 12.0.2.55 0 nvidia libcusparse-dev 12.0.2.55 0 nvidia libffi 3.4.2 h8ffe710_5 conda-forge libglib 2.78.4 h16e383f_0 conda-forge libhwloc 2.9.3 default_haede6df_1009 conda-forge libiconv 1.17 hcfcfb64_2 conda-forge libjpeg-turbo 3.0.0 hcfcfb64_1 conda-forge liblapack 3.9.0 21_win64_mkl conda-forge liblapacke 3.9.0 21_win64_mkl conda-forge libnpp 12.0.2.50 0 nvidia libnpp-dev 12.0.2.50 0 nvidia libnvjitlink 12.1.105 0 nvidia libnvjitlink-dev 12.1.105 0 nvidia libnvjpeg 12.1.1.14 0 nvidia libnvjpeg-dev 12.1.1.14 0 nvidia libogg 1.3.4 h8ffe710_1 conda-forge libpng 1.6.42 h19919ed_0 conda-forge libsqlite 3.45.1 hcfcfb64_0 conda-forge libuv 1.47.0 hcfcfb64_0 conda-forge libvorbis 1.3.7 h0e60522_0 conda-forge libxml2 2.12.5 hc3477c8_0 conda-forge libzlib 1.2.13 hcfcfb64_5 conda-forge llvmlite 0.41.1 pypi_0 pypi m2w64-gcc-libgfortran 5.3.0 6 conda-forge m2w64-gcc-libs 5.3.0 7 conda-forge m2w64-gcc-libs-core 5.3.0 7 conda-forge m2w64-gmp 6.1.0 2 conda-forge m2w64-libwinpthread-git 5.0.0.4634.697f757 2 conda-forge markupsafe 2.1.5 py38h91455d4_0 conda-forge mkl 2024.0.0 h66d3029_49657 conda-forge mkl-devel 2024.0.0 h57928b3_49657 conda-forge mkl-include 2024.0.0 h66d3029_49657 conda-forge mpmath 1.3.0 pyhd8ed1ab_0 conda-forge msys2-conda-epoch 20160418 1 conda-forge natsort 8.4.0 pypi_0 pypi networkx 3.1 pyhd8ed1ab_0 conda-forge numba 0.58.1 pypi_0 pypi numpy 1.24.4 pypi_0 pypi opencv-python-headless 4.9.0.80 pypi_0 pypi openssl 3.2.1 hcfcfb64_0 conda-forge packaging 23.2 pyhd8ed1ab_0 conda-forge pcre2 10.42 h17e33f8_0 conda-forge pip 24.0 pyhd8ed1ab_0 conda-forge ply 3.11 py_1 conda-forge protobuf 4.25.3 pypi_0 pypi pthreads-win32 2.9.1 hfa6e2cd_3 conda-forge pyasn1 0.5.1 pypi_0 pypi pyasn1-modules 0.3.0 pypi_0 pypi pygments 2.17.2 pypi_0 pypi pyqt 5.15.9 py38hd6c051e_5 conda-forge pyqt5-sip 12.12.2 py38hd3f51b4_5 conda-forge pyqt6 6.6.1 pypi_0 pypi pyqt6-qt6 6.6.2 pypi_0 pypi pyqt6-sip 13.6.0 pypi_0 pypi pyqtgraph 0.13.3 pypi_0 pypi python 3.8.18 h4de0772_1_cpython conda-forge python_abi 3.8 4_cp38 conda-forge pytorch 2.2.1 py3.8_cuda12.1_cudnn8_0 pytorch pytorch-cuda 12.1 hde6ce7c_5 pytorch pytorch-mutex 1.0 cuda pytorch pyyaml 6.0.1 py38h91455d4_1 conda-forge qt-main 5.15.8 h9e85ed6_19 conda-forge qtpy 2.4.1 pypi_0 pypi requests 2.31.0 pypi_0 pypi roifile 2023.5.12 pypi_0 pypi rsa 4.9 pypi_0 pypi scipy 1.10.1 pypi_0 pypi setuptools 69.1.0 pyhd8ed1ab_1 conda-forge sip 6.7.12 py38hd3f51b4_0 conda-forge superqt 0.6.1 pypi_0 pypi sympy 1.12 pyh04b8f61_3 conda-forge tbb 2021.11.0 h91493d7_1 conda-forge tifffile 2023.7.10 pypi_0 pypi tk 8.6.13 h5226925_1 conda-forge toml 0.10.2 pyhd8ed1ab_0 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge tqdm 4.66.2 pypi_0 pypi typing_extensions 4.9.0 pyha770c72_0 conda-forge ucrt 10.0.22621.0 h57928b3_0 conda-forge urllib3 2.2.1 pypi_0 pypi vc 14.3 hcf57466_18 conda-forge vc14_runtime 14.38.33130 h82b7239_18 conda-forge vs2015_runtime 14.38.33130 hcb4865c_18 conda-forge wheel 0.42.0 pyhd8ed1ab_0 conda-forge xz 5.2.6 h8d14728_0 conda-forge yaml 0.2.5 h8ffe710_2 conda-forge zipp 3.17.0 pypi_0 pypi zstd 1.5.5 h12be248_0 conda-forge ```

I am running on Windows 10 with 4GB GPU and CUDA Version: 12.1

Screenshots If applicable, add screenshots to help explain your problem.

carsen-stringer commented 7 months ago

thanks adding this to another issue

zoccoler commented 7 months ago

Ok, should I install the current version with pip install git+https://github.com/mouseland/cellpose.git then?

zoccoler commented 7 months ago

Ok, should I install the current version with pip install git+https://github.com/mouseland/cellpose.git then?

Sorry, but is that the current solution to the issue? Just checking cause it is clear to me :)

carsen-stringer commented 7 months ago

Yes or pip install cellpose --upgrade

zoccoler commented 7 months ago

Awesome! it works now, thanks!