nnUNet icon indicating copy to clipboard operation
nnUNet copied to clipboard

Deprecation Warnings with scipy

Open scarere opened this issue 1 year ago • 1 comments

These are really annoying and hard to silence. Seems like the imports just need to be updated in nnunetv2 and batchgenerators

scipy version: 1.13.1 nnunetv2 version: 2.4.2 batchgenerators version: 0.25

/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_filter` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:20: DeprecationWarning: Please import `gaussian_gradient_magnitude` from the `scipy.ndimage` namespace; the `scipy.ndimage.filters` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.filters import gaussian_filter, gaussian_gradient_magnitude
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:21: DeprecationWarning: Please import `grey_dilation` from the `scipy.ndimage` namespace; the `scipy.ndimage.morphology` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.morphology import grey_dilation
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/batchgenerators/augmentations/utils.py:23: DeprecationWarning: Please import `label` from the `scipy.ndimage` namespace; the `scipy.ndimage.measurements` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.measurements import label as lb
/home/shawn/venvs/fl4health/lib/python3.10/site-packages/nnunetv2/preprocessing/resampling/default_resampling.py:8: DeprecationWarning: Please import `map_coordinates` from the `scipy.ndimage` namespace; the `scipy.ndimage.interpolation` namespace is deprecated and will be removed in SciPy 2.0.0.
  from scipy.ndimage.interpolation import map_coordinates

scarere avatar Jul 12 '24 18:07 scarere

I noticed I don't always get these deprecation warnings. I'm using the flwr api. When I import something from this package before importing something from nnunet, then the warnings appear. Otherwise they don't. The warnings are definitely originating from the nnunet imports. Not sure what the relation is there.

A temporary solution to silence warnings

import warnings
with warnings.catch_warnings():
    warnings.filter_warnings('ignore', category=DeprecationWarning)
    # nnunet imports below within scope...

scarere avatar Jul 19 '24 17:07 scarere

You should raise these issues in batchgenerators (https://github.com/MIC-DKFZ/batchgenerators) as the issues originate from batchgenerators scipy imports.

TaWald avatar Nov 05 '24 18:11 TaWald