HenriquesLab / ZeroCostDL4Mic

ZeroCostDL4Mic: A Google Colab based no-cost toolbox to explore Deep-Learning in Microscopy
MIT License
553 stars 129 forks source link

CARE 2D: module 'numpy' has no attribute 'bool' #312

Open kaarjel opened 5 months ago

kaarjel commented 5 months ago

Describe the bug Hi, I am trying out CARE 2D and am stuck at cell section 4.1. When I run it, this error pops up:

!! WARNING: Model folder already exists and has been removed !!
==================================================================
    9 raw images x    1 transformations   =     9 images
    9 images     x   50 patches per image =   450 patches in total
==================================================================
Input data:
/content: target='/content/gdrive/MyDrive/CARE2D/CARE_imagepairs/High_NA', sources=['/content/gdrive/MyDrive/CARE2D/CARE_imagepairs/Low_NA'], axes='CYX', pattern='*.tif*'
==================================================================
Transformations:
1 x Identity
==================================================================
Patch size:
64 x 64
==================================================================
  0%|          | 0/9 [00:00<?, ?it/s]
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[<ipython-input-15-7ac281c24ca7>](https://localhost:8080/#) in <cell line: 33>()
     31     pattern='*.tif*')
     32 
---> 33 X, Y, XY_axes = data.create_patches(
     34     raw_data,
     35     patch_filter=None,

2 frames
[/usr/local/lib/python3.10/dist-packages/csbdeep/data/generate.py](https://localhost:8080/#) in create_patches(raw_data, patch_size, n_patches_per_image, patch_axes, save_file, transforms, patch_filter, normalization, shuffle, verbose)
    344         channel is None or patch_size[channel]==x.shape[channel] or _raise(ValueError('extracted patches must contain all channels.'))
    345 
--> 346         _Y,_X = sample_patches_from_multiple_stacks((y,x), patch_size, n_patches_per_image, mask, patch_filter)
    347 
    348         s = slice(i*n_patches_per_image,(i+1)*n_patches_per_image)

[/usr/local/lib/python3.10/dist-packages/csbdeep/data/generate.py](https://localhost:8080/#) in sample_patches_from_multiple_stacks(datas, patch_size, n_samples, datas_mask, patch_filter, verbose)
     79 
     80     if patch_filter is None:
---> 81         patch_mask = np.ones(datas[0].shape,dtype=np.bool)
     82     else:
     83         patch_mask = patch_filter(datas, patch_size)

[/usr/local/lib/python3.10/dist-packages/numpy/__init__.py](https://localhost:8080/#) in __getattr__(attr)
    317 
    318         if attr in __former_attrs__:
--> 319             raise AttributeError(__former_attrs__[attr])
    320 
    321         if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Hope you can help.

Best wishes, Kaarjel

uschmidt83 commented 4 months ago

This should be fixed with the latest release of csbdeep.