awi-response / darts-nextgen

Panarctic Database of Active Layer Detachment Slides and Retrogressive Thaw Slumps from Deep Learning on High Resolution Satellite Imagery.
https://awi-response.github.io/darts-nextgen/
MIT License
5 stars 1 forks source link

can't convert np.ndarray of type numpy.uint16. (albedo) #46

Closed iona5 closed 2 days ago

iona5 commented 3 days ago

got an error on albedo:

[2024-10-29 10:00:09] DEBUG    Loading TCVis took 32.04953122138977 seconds                                 tcvis.py:114
                      DEBUG    Loading data masks from                                                      planet.py:82
                               /input/planet/PSOrthoTile/1070819
                               /5760141_1070819_2022-07-03_2451
[2024-10-29 10:00:11] DEBUG    Loaded data masks in 2.3790271282196045 seconds.                            planet.py:109
[2024-10-29 10:00:14] DEBUG    Predicting on a tensor with shape torch.Size([1, 10, 8000, 8000]) with       utils.py:121
                               patch_size 1024, overlap 16 and batch_size 8 on device cuda
[2024-10-29 10:00:15] DEBUG    Creating patches from a tensor with shape torch.Size([1, 10, 8002, 8002])     utils.py:57
                               with patch_size 1024 and overlap 16
[2024-10-29 10:00:16] DEBUG    Creating 64 patches took 0.69s                                                utils.py:85
Predicting on patches ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:03
[2024-10-29 10:00:19] DEBUG    Predicting took 5.21s                                                        utils.py:180
[2024-10-29 10:00:20] ERROR    can't convert np.ndarray of type numpy.uint16. The only supported types are:    cli.py:73
                               float64, float32, float16, complex64, complex128, int64, int32, int16, int8,
                               uint8, and bool.
                               ╭───────────────────── Traceback (most recent call last) ─────────────────────╮
                               │ /darts-nextgen-rye/darts/src/darts/cli.py:67 in │
                               │ start_app                                                                   │
                               │                                                                             │
                               │   64 │   """Wrapp to start the app."""                                      │
                               │   65 │   try:                                                               │
                               │   66 │   │   setup_logging()                                                │
                               │ ❱ 67 │   │   app.meta()                                                     │
                               │   68 │   except KeyboardInterrupt:                                          │
                               │   69 │   │   logger.info("Interrupted by user. Closing...")                 │
                               │   70 │   except SystemExit:                                                 │
                               │                                                                             │
                               │ /darts-nextgen-rye/.venv/lib/python3.11/site-pa │
                               │ ckages/cyclopts/core.py:903 in __call__                                     │
                               │                                                                             │
                               │ /darts-nextgen-rye/darts/src/darts/cli.py:60 in │
                               │ launcher                                                                    │
                               │                                                                             │
                               │   57 ):                                                                     │
                               │   58 │   command, bound = app.parse_args(tokens)                            │
                               │   59 │   add_logging_handlers(command.__name__, console, log_dir)           │
                               │ ❱ 60 │   return command(*bound.args, **bound.kwargs)                        │
                               │   61                                                                        │
                               │   62                                                                        │
                               │   63 def start_app():                                                       │
                               │                                                                             │
                               │ /darts-nextgen-rye/darts/src/darts/native.py:48 │
                               │ in run_native_orthotile_pipeline                                            │
                               │                                                                             │
                               │   45 │   │   tile = load_and_preprocess_planet_scene(fpath, arcticdem_dir,  │
                               │   46 │   │                                                                  │
                               │   47 │   │   ensemble = EnsembleV1(model_dir / "RTS_v6_tcvis.pt", model_dir │
                               │      "RTS_v6_notcvis.pt")                                                   │
                               │ ❱ 48 │   │   tile = ensemble.segment_tile(                                  │
                               │   49 │   │   │   tile, patch_size=patch_size, overlap=overlap, batch_size=b │
                               │      reflection=reflection                                                  │
                               │   50 │   │   )                                                              │
                               │   51 │   │   tile = prepare_export(tile)                                    │
                               │                                                                             │
                               │ /darts-nextgen-rye/darts-ensemble/src/darts_ens │
                               │ emble/ensemble_v1.py:54 in segment_tile                                     │
                               │                                                                             │
                               │    51 │   │   tcvis_probabilities = self.rts_v6_tcvis_model.segment_tile(   │
                               │    52 │   │   │   tile, patch_size=patch_size, overlap=overlap, batch_size= │
                               │       reflection=reflection                                                 │
                               │    53 │   │   )["probabilities"].copy()                                     │
                               │ ❱  54 │   │   notcvis_propabilities = self.rts_v6_notcvis_model.segment_til │
                               │    55 │   │   │   tile, patch_size=patch_size, overlap=overlap, batch_size= │
                               │       reflection=reflection                                                 │
                               │    56 │   │   )["probabilities"].copy()                                     │
                               │    57                                                                       │
                               │                                                                             │
                               │ /darts-nextgen-rye/darts-segmentation/src/darts │
                               │ _segmentation/segment.py:130 in segment_tile                                │
                               │                                                                             │
                               │   127 │   │                                                                 │
                               │   128 │   │   """                                                           │
                               │   129 │   │   # Convert the tile to a tensor                                │
                               │ ❱ 130 │   │   tensor_tile = self.tile2tensor(tile)                          │
                               │   131 │   │                                                                 │
                               │   132 │   │   # Create a batch dimension, because predict expects it        │
                               │   133 │   │   tensor_tile = tensor_tile.unsqueeze(0)                        │
                               │                                                                             │
                               │ /darts-nextgen-rye/darts-segmentation/src/darts │
                               │ _segmentation/segment.py:88 in tile2tensor                                  │
                               │                                                                             │
                               │    85 │   │   │   band_data = tile[feature_name]                            │
                               │    86 │   │   │   # Normalize the band data                                 │
                               │    87 │   │   │   band_data = band_data * norm                              │
                               │ ❱  88 │   │   │   bands.append(torch.from_numpy(band_data.values))          │
                               │    89 │   │                                                                 │
                               │    90 │   │   return torch.stack(bands, dim=0)                              │
                               │    91                                                                       │
                               ╰─────────────────────────────────────────────────────────────────────────────╯
                               TypeError: can't convert np.ndarray of type numpy.uint16. The only supported
                               types are: float64, float32, float16, complex64, complex128, int64, int32,
                               int16, int8, uint8, and bool.

Environment Info:

``` $ rye show project: darts-nextgen path: /.../darts-nextgen-rye venv: /.../darts-nextgen-rye/.venv target python: 3.11 venv python: cpython@3.11.9 virtual: false workspace: /.../darts-nextgen-rye members: darts-nextgen (./) darts-acquisition (./darts-acquisition) darts-ensemble (./darts-ensemble) darts-export (./darts-export) darts-postprocessing (./darts-postprocessing) darts-preprocessing (./darts-preprocessing) darts-segmentation (./darts-segmentation) darts-superresolution (./darts-superresolution) configured sources: default (index: https://pypi.org/simple/) nvidia (index: https://pypi.nvidia.com) pytorch-cpu (index: https://download.pytorch.org/whl/cpu) pytorch-cu11 (index: https://download.pytorch.org/whl/cu118) pytorch-cu12 (index: https://download.pytorch.org/whl/cu121) ``` ``` $ rye list affine==2.4.0 aiosignal==1.3.1 asttokens==2.4.1 attrs==24.2.0 babel==2.16.0 bokeh==3.6.0 branca==0.8.0 cachetools==5.5.0 cairocffi==1.7.1 cairosvg==2.7.1 certifi==2024.8.30 cffi==1.17.1 charset-normalizer==3.4.0 click==8.1.7 click-plugins==1.1.1 cligj==0.7.2 cloudpickle==3.1.0 colorama==0.4.6 comm==0.2.2 contourpy==1.3.0 cssselect2==0.7.0 cucim-cu12==24.8.0 cupy-cuda12x==13.3.0 cycler==0.12.1 cyclopts==2.9.9 -e file:///darts-nextgen-rye/darts-acquisition -e file:///darts-nextgen-rye/darts-ensemble -e file:///darts-nextgen-rye/darts-export -e file:///darts-nextgen-rye -e file:///darts-nextgen-rye/darts-postprocessing -e file:////darts-nextgen-rye/darts-preprocessing -e file:////darts-nextgen-rye/darts-segmentation -e file:///darts-nextgen-rye/darts-superresolution dask==2024.10.0 dask-expr==1.1.16 debugpy==1.8.7 decorator==5.1.1 defusedxml==0.7.1 distributed==2024.10.0 docstring-parser==0.16 docutils==0.21.2 earthengine-api==1.1.5 efficientnet-pytorch==0.7.1 executing==2.1.0 fastcore==1.7.19 fastrlock==0.8.2 filelock==3.16.1 folium==0.18.0 fonttools==4.54.1 frozenlist==1.5.0 fsspec==2024.10.0 gdal==3.8.5 geopandas==1.0.1 ghp-import==2.1.0 gitdb==4.0.11 gitpython==3.1.43 google-api-core==2.21.0 google-api-python-client==2.149.0 google-auth==2.35.0 google-auth-httplib2==0.2.0 google-cloud-core==2.4.1 google-cloud-storage==2.18.2 google-crc32c==1.6.0 google-resumable-media==2.7.2 googleapis-common-protos==1.65.0 griffe==1.5.1 h5netcdf==1.4.0 h5py==3.12.1 httplib2==0.22.0 huggingface-hub==0.26.1 idna==3.10 imageio==2.36.0 importlib-metadata==8.5.0 importlib-resources==6.4.5 iniconfig==2.0.0 ipykernel==6.29.5 ipython==8.29.0 ipywidgets==8.1.5 jedi==0.19.1 jinja2==3.1.4 joblib==1.4.2 jsonschema==4.23.0 jsonschema-specifications==2024.10.1 jupyter-client==8.6.3 jupyter-core==5.7.2 jupyterlab-widgets==3.0.13 kiwisolver==1.4.7 lazy-loader==0.4 locket==1.0.0 lovely-numpy==0.2.13 lovely-tensors==0.1.17 lz4==4.3.3 mapclassify==2.8.1 markdown==3.7 markdown-it-py==3.0.0 markupsafe==3.0.2 matplotlib==3.9.2 matplotlib-inline==0.1.7 mdurl==0.1.2 mergedeep==1.3.4 mike==2.1.3 mkdocs==1.6.1 mkdocs-autorefs==1.2.0 mkdocs-get-deps==0.2.0 mkdocs-git-committers-plugin-2==2.4.1 mkdocs-git-revision-date-localized-plugin==1.3.0 mkdocs-material==9.5.42 mkdocs-material-extensions==1.3.1 mkdocstrings==0.26.2 mkdocstrings-python==1.12.2 mpmath==1.3.0 msgpack==1.1.0 munch==4.0.0 nest-asyncio==1.6.0 networkx==3.4.2 nodeenv==1.9.1 numpy==1.26.4 nvidia-cublas-cu12==12.1.3.1 nvidia-cuda-cupti-cu12==12.1.105 nvidia-cuda-nvrtc-cu12==12.1.105 nvidia-cuda-runtime-cu12==12.1.105 nvidia-cudnn-cu12==8.9.2.26 nvidia-cufft-cu12==11.0.2.54 nvidia-curand-cu12==10.3.2.106 nvidia-cusolver-cu12==11.4.5.107 nvidia-cusparse-cu12==12.1.0.106 nvidia-nccl-cu12==2.19.3 nvidia-nvjitlink-cu12==12.6.77 nvidia-nvtx-cu12==12.1.105 packaging==24.1 paginate==0.5.7 pandas==2.2.3 parso==0.8.4 partd==1.4.2 pathspec==0.12.1 pexpect==4.9.0 pillow==10.4.0 platformdirs==4.3.6 pluggy==1.5.0 pretrainedmodels==0.7.4 prompt-toolkit==3.0.48 proto-plus==1.25.0 protobuf==5.28.3 psutil==6.1.0 ptyprocess==0.7.0 pure-eval==0.2.3 pyarrow==17.0.0 pyasn1==0.6.1 pyasn1-modules==0.4.1 pycparser==2.22 pygments==2.18.0 pymdown-extensions==10.11.2 pyogrio==0.10.0 pyparsing==3.2.0 pyproj==3.7.0 pyright==1.1.386 pytest==8.3.3 python-dateutil==2.9.0.post0 pytz==2024.2 pyyaml==6.0.2 pyyaml-env-tag==0.1 pyzmq==26.2.0 rasterio==1.4.1 ray==2.38.0 referencing==0.35.1 regex==2024.9.11 requests==2.32.3 rich==13.9.3 rich-rst==1.3.1 rioxarray==0.17.0 rpds-py==0.20.0 rsa==4.9 ruff==0.7.1 safetensors==0.4.5 scikit-image==0.23.2 scikit-learn==1.5.2 scipy==1.14.1 segmentation-models-pytorch==0.3.4 shapely==2.0.6 six==1.16.0 smmap==5.0.1 sortedcontainers==2.4.0 stack-data==0.6.3 sympy==1.13.3 tblib==3.0.0 threadpoolctl==3.5.0 tifffile==2024.9.20 timm==0.9.7 tinycss2==1.4.0 toolz==1.0.0 torch==2.2.0+cu121 torchvision==0.17.0+cu121 tornado==6.4.1 tqdm==4.66.5 traitlets==5.14.3 triton==2.2.0 typing-extensions==4.12.2 tzdata==2024.2 uritemplate==4.1.1 urllib3==2.2.3 verspec==0.1.0 watchdog==5.0.3 wcwidth==0.2.13 webencodings==0.5.1 widgetsnbextension==4.0.13 xarray==2024.10.0 xee==0.0.19 xyzservices==2024.9.0 zict==3.0.0 zipp==3.20.2 ```