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

[BUG] cucim.skimage.filters.median is not working #520

Closed
issara3 opened this issue Feb 24, 2023 · 2 comments · Fixed by #521
Closed

[BUG] cucim.skimage.filters.median is not working #520

issara3 opened this issue Feb 24, 2023 · 2 comments · Fixed by #521
Labels
bug Something isn't working

Comments

@issara3
Copy link

issara3 commented Feb 24, 2023

Describe the bug
Running example code from cucim median filter gives me an error

Steps/Code to reproduce bug

import cupy as cp
from skimage import data
from cucim.skimage.morphology import disk
from cucim.skimage.filters import median
img = cp.array(data.camera())
med = median(img, disk(5))

(cucim) issara@Issara-1ZY7043:~/DEEP-working$ python testing2.py
Traceback (most recent call last):
File "/home/issara/DEEP-working/testing2.py", line 6, in
med = median(img, disk(5))
File "/home/issara/anaconda3/envs/cucim/lib/python3.10/site-packages/cucim/skimage/_shared/utils.py", line 228, in fixed_func
return func(*args, **kwargs)
File "/home/issara/anaconda3/envs/cucim/lib/python3.10/site-packages/cucim/skimage/filters/_median.py", line 207, in median
return ndi.median_filter(image, size=size, footprint=footprint, output=out,
File "/home/issara/anaconda3/envs/cucim/lib/python3.10/site-packages/cucim/skimage/_vendored/_ndimage_filters.py", line 1033, in median_filter
return _rank_filter(input, lambda fs: fs // 2,
File "/home/issara/anaconda3/envs/cucim/lib/python3.10/site-packages/cucim/skimage/_vendored/_ndimage_filters.py", line 1129, in _rank_filter
return _filters_core._call_kernel(kernel, input, None, output,
File "/home/issara/anaconda3/envs/cucim/lib/python3.10/site-packages/cucim/skimage/_vendored/_ndimage_filters_core.py", line 160, in _call_kernel
kernel(*args)
File "cupy/_core/_kernel.pyx", line 857, in cupy._core._kernel.ElementwiseKernel.call
File "cupy/_core/_kernel.pyx", line 597, in cupy._core._kernel._broadcast
ValueError: Loop size is undecided.

Expected behavior
Expect the code to pass without an error

Environment details (please complete the following information):

  • Ubuntu 22.04.1 LTS in WSL2
  • Method of cuCIM install:
       conda create -n cucim -c rapidsai -c conda-forge cucim cudatoolkit=11.8
    

Additional context

(cucim) issara@Issara-1ZY7043:~/DEEP-working$ conda list
# packages in environment at /home/issara/anaconda3/envs/cucim:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
appdirs                   1.4.4              pyhd3eb1b0_0
blas                      1.0                         mkl
blosc                     1.21.3               h6a678d5_0
brotli                    1.0.9                h5eee18b_7
brotli-bin                1.0.9                h5eee18b_7
brotlipy                  0.7.0           py310h7f8727e_1002
brunsli                   0.1                  h2531618_0
bzip2                     1.0.8                h7b6447c_0
c-ares                    1.18.1               h7f8727e_0
ca-certificates           2023.01.10           h06a4308_0
certifi                   2022.12.7       py310h06a4308_0
cffi                      1.15.1          py310h5eee18b_3
cfitsio                   3.470                h5893167_7
charls                    2.2.0                h2531618_0
charset-normalizer        2.0.4              pyhd3eb1b0_0
click                     8.0.4           py310h06a4308_0
cloudpickle               2.0.0              pyhd3eb1b0_0
cryptography              38.0.4          py310h9ce1e76_0
cucim                     23.02.00        cuda_11_py310_gb8cfaa2_0    rapidsai
cudatoolkit               11.8.0              h37601d7_11    conda-forge
cupy                      11.5.0          py310h9216885_0    conda-forge
cytoolz                   0.12.0          py310h5eee18b_0
dask-core                 2022.7.0        py310h06a4308_0
fastrlock                 0.8             py310hd8f1fbe_3    conda-forge
fftw                      3.3.9                h27cfd23_1
freetype                  2.12.1               h4a9f257_0
fsspec                    2022.11.0       py310h06a4308_0
giflib                    5.2.1                h5eee18b_3
idna                      3.4             py310h06a4308_0
imagecodecs               2021.8.26       py310hecf7e94_1
imageio                   2.19.3          py310h06a4308_0
intel-openmp              2021.4.0          h06a4308_3561
jbig                      2.1                  hdba287a_0
jpeg                      9e                   h7f8727e_0
jxrlib                    1.1                  h7b6447c_2
keyutils                  1.6.1                h166bdaf_0    conda-forge
krb5                      1.20.1               h81ceb04_0    conda-forge
lcms2                     2.12                 h3be6417_0
ld_impl_linux-64          2.38                 h1181459_1
lerc                      3.0                  h295c915_0
libaec                    1.0.4                he6710b0_1
libbrotlicommon           1.0.9                h5eee18b_7
libbrotlidec              1.0.9                h5eee18b_7
libbrotlienc              1.0.9                h5eee18b_7
libcucim                  23.02.00        cuda11_gb8cfaa2_0    rapidsai
libcurl                   7.88.1               hdc1c0ab_0    conda-forge
libdeflate                1.8                  h7f8727e_5
libedit                   3.1.20221030         h5eee18b_0
libev                     4.33                 h7f8727e_1
libffi                    3.4.2                h6a678d5_6
libgcc-ng                 12.2.0              h65d4601_19    conda-forge
libgfortran-ng            11.2.0               h00389a5_1
libgfortran5              11.2.0               h1234567_1
libgomp                   12.2.0              h65d4601_19    conda-forge
libnghttp2                1.51.0               hff17c54_0    conda-forge
libnsl                    2.0.0                h5eee18b_0
libpng                    1.6.37               hbc83047_0
libsqlite                 3.40.0               h753d276_0    conda-forge
libssh2                   1.10.0               hf14f497_3    conda-forge
libstdcxx-ng              12.2.0              h46fd767_19    conda-forge
libtiff                   4.5.0                h6a678d5_1
libuuid                   2.32.1            h7f98852_1000    conda-forge
libwebp                   1.2.4                h11a3e52_1
libwebp-base              1.2.4                h5eee18b_1
libzlib                   1.2.13               h166bdaf_4    conda-forge
libzopfli                 1.0.3                he6710b0_0
locket                    1.0.0           py310h06a4308_0
lz4-c                     1.9.4                h6a678d5_0
mkl                       2021.4.0           h06a4308_640
mkl-service               2.4.0           py310h7f8727e_0
mkl_fft                   1.3.1           py310hd6ae3a3_0
mkl_random                1.2.2           py310h00e6091_0
ncurses                   6.4                  h6a678d5_0
networkx                  2.8.4           py310h06a4308_0
numpy                     1.23.5          py310hd5efca6_0
numpy-base                1.23.5          py310h8e6c178_0
openjpeg                  2.4.0                h3ad879b_0
openssl                   3.0.8                h0b41bf4_0    conda-forge
packaging                 22.0            py310h06a4308_0
partd                     1.2.0              pyhd3eb1b0_1
pillow                    9.3.0           py310h6a678d5_2
pip                       22.3.1          py310h06a4308_0
pooch                     1.4.0              pyhd3eb1b0_0
pycparser                 2.21               pyhd3eb1b0_0
pyopenssl                 22.0.0             pyhd3eb1b0_0
pysocks                   1.7.1           py310h06a4308_0
python                    3.10.9          he550d4f_0_cpython    conda-forge
python_abi                3.10                    3_cp310    conda-forge
pywavelets                1.4.1           py310h5eee18b_0
pyyaml                    6.0             py310h5eee18b_1
readline                  8.2                  h5eee18b_0
requests                  2.28.1          py310h06a4308_0
scikit-image              0.19.3          py310h6a678d5_1
scipy                     1.10.0          py310hd5efca6_0
setuptools                65.6.3          py310h06a4308_0
six                       1.16.0             pyhd3eb1b0_1
snappy                    1.1.9                h295c915_0
tifffile                  2021.7.2           pyhd3eb1b0_2
tk                        8.6.12               h1ccaba5_0
toolz                     0.12.0          py310h06a4308_0
tzdata                    2022g                h04d1e81_0
urllib3                   1.26.14         py310h06a4308_0
wheel                     0.38.4          py310h06a4308_0
xz                        5.2.10               h5eee18b_1
yaml                      0.2.5                h7b6447c_0
zfp                       0.5.5                h295c915_6
zlib                      1.2.13               h166bdaf_4    conda-forge
zstd                      1.5.2                ha4553b6_0
@issara3 issara3 added the bug Something isn't working label Feb 24, 2023
@grlee77
Copy link
Contributor

grlee77 commented Feb 24, 2023

Thanks for reporting this @issara3, I can reproduce the issue. This seems to be a bug newly introduced in release 23.02.

A temporary workaround is to inctall cuCIM 22.12.00

conda create -n cucim -c rapidsai -c conda-forge cucim=22.12.00 cudatoolkit=11.8

@grlee77
Copy link
Contributor

grlee77 commented Feb 24, 2023

This should be fixed by #521 for the upcoming 23.04 release.

If you need to use 23.02 instead of rolling back to 22.12 you could apply the fix locally by making this small fix to the corresponding file in your installed package. The filename you would need to modify can be retrieved via:

import os

from cucim import skimage

print(os.path.join(os.path.dirname(skimage.__file__), '_vendored', '_ndimage_filters.py'))

@rapids-bot rapids-bot bot closed this as completed in #521 Mar 8, 2023
rapids-bot bot pushed a commit that referenced this issue Mar 8, 2023
closes #520

#485 Introduced a bug in rank filtering kernels that was not caught by our current test cases
(so this bug is only present in the 23.02 release)

This MR fixes the bug and adds test coverage for this case.

Authors:
  - Gregory Lee (https://github.com/grlee77)
  - https://github.com/jakirkham

Approvers:
  - https://github.com/jakirkham

URL: #521
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants