Closed Benny1o1 closed 1 year ago
Hi Benny, I think this issue is due to an API change in the scipy library. They seperated the public methods form the private ones.
Try to change the import of ~/opt/anaconda3/envs/detectree/lib/python3.10/site-packages/detectree/filters.py
From from scipy.ndimage.filters import _gaussian_kernel1d
To from scipy.ndimage._filters import _gaussian_kernel1d
Hope this helps. Best regards Max
Hi Max,
Thank you for your answer!
Best regards, Benny
I think this issue is due to an API change in the scipy library. They seperated the public methods form the private ones. Try to change the import of ~/[…]/detectree/filters.py
From:
from scipy.ndimage.filters import _gaussian_kernel1d
To:
from scipy.ndimage._filters import _gaussian_kernel1d
This also works for me, thanks @MaxJarofka I'm not familiar with GitHub, but maybe someone could open a Pull request using the solution cited.
Cheers!
Fixed in detectree PR#13.
When executing the detecter-example notebook, the following error occurred:
ImportError Traceback (most recent call last) Input In [2], in <cell line: 4>() 1 import os 2 from os import path ----> 4 import detectree as dtr 5 import geopandas as gpd 6 import rasterio as rio
File ~/opt/anaconda3/envs/detectree/lib/python3.10/site-packages/detectree/init.py:2, in
1 """detectree init."""
----> 2 from .classifier import Classifier, ClassifierTrainer
3 from .lidar import LidarToCanopy, rasterize_lidar
4 from .train_test_split import TrainingSelector
File ~/opt/anaconda3/envs/detectree/lib/python3.10/site-packages/detectree/classifier.py:12, in
9 from dask import diagnostics
10 from sklearn import ensemble
---> 12 from . import pixel_features, pixel_response, settings, utils
14 all = ["ClassifierTrainer", "Classifier"]
16 MOORE_NEIGHBORHOOD_ARR = np.array([[0, 0, 0], [0, 0, 1], [1, 1, 1]])
File ~/opt/anaconda3/envs/detectree/lib/python3.10/site-packages/detectree/pixel_features.py:13, in
10 from skimage import color, morphology, transform
11 from skimage.filters import rank
---> 13 from . import filters, settings, utils
15 all = ["PixelFeaturesBuilder"]
17 # to convert to illumination-invariant color space
18 # https://www.cs.harvard.edu/~sjg/papers/cspace.pdf
File ~/opt/anaconda3/envs/detectree/lib/python3.10/site-packages/detectree/filters.py:4, in
1 """Utilities to produce filters."""
3 import numpy as np
----> 4 from scipy.ndimage.filters import _gaussian_kernel1d
5 from skimage.filters import gabor_kernel
7 all = ["get_texture_kernel", "get_gabor_filter_bank"]
ImportError: cannot import name '_gaussian_kernel1d' from 'scipy.ndimage.filters' (/Users/benny/opt/anaconda3/envs/detectree/lib/python3.10/site-packages/scipy/ndimage/filters.py)
Would be glad if you can help me out here. Thanks.