PUTvision / qgis-plugin-deepness

Deepness is a remote sensing plugin that enables deep learning inference in QGIS
https://www.buymeacoffee.com/deepness
Apache License 2.0
89 stars 20 forks source link

OverflowError: cannot convert float infinity to integer when running segmentator on "visible part" #143

Open adrianloy opened 4 months ago

adrianloy commented 4 months ago

First of all, thanks a lot for this plugin, it is very useful for us.

With the latest version, it seems to me that running a segmentation model on "visible part" is bugged, here is the stacktrace I am getting:

An error has occurred while executing Python code: 

OverflowError: cannot convert float infinity to integer 
Traceback (most recent call last):
  File "/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/deepness.py", line 267, in _run_model_inference
    self._map_processor = map_processor_class(
  File "/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/map_processor/map_processor_segmentation.py", line 29, in __init__
    super().__init__(
  File "/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/map_processor/map_processor_with_model.py", line 19, in __init__
    super().__init__(
  File "/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/map_processor/map_processor.py", line 78, in __init__
    self.extended_extent = extent_utils.calculate_extended_processing_extent(
  File "/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/extent_utils.py", line 80, in calculate_extended_processing_extent
    current_x_pixels = round(tmp_extent.width() / rlayer_units_per_pixel)
OverflowError: cannot convert float infinity to integer

Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] 
QGIS version: 3.34.3-Prizren Prizren, exported 

Python Path:
/usr/share/qgis/python
/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python
/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/share/qgis/python
/usr/share/qgis/python/plugins
/usr/lib/python3/dist-packages/qgis
/usr/share/qgis/python/qgis
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python
/home/adrianloy/.local/share/QGIS/QGIS3/profiles/default/python/plugins/deepness/python3.10

I can reproduce this both with our custom model as well as with the deeplabv3 "landcover" segmentor model . Running on the whole layer works.

bartoszptak commented 4 months ago

Hi @adrianloy , thanks for reporting, we have to check it!

Could you provide the version of your operating system, python interpreter and QGIS?

bartoszptak commented 4 months ago

Ooo, now I see.

Python is 3.10.12 and QGIS is 3.34.3, so please share the operating system's version with us.

adrianloy commented 4 months ago

I am executing it within docker. My image is based on FROM qgis/qgis:release-3_34 That should run some ubuntu under the hood, I can check in a bit which exact version. Host machine is also Ubuntu based, but that should not matter I guess.

bartoszptak commented 4 months ago

Hi, I checked the pipeline using the container you provided, with the landcover example on Bing map loaded using QuickMapService and everything looks good. Maybe is there an issue with the compatibility of Deepness and your raster layer? Could you check the process on any layer from QuickMapService, e.g. Bing Aerial?

adrianloy commented 4 months ago

Thanks for checking it so quickly. I will give it a try, any ideas what could be the issue? This worked in the past, I could also try to downgrade deepness again to verify that the latest release broke this on our dataset

bartoszptak commented 4 months ago

Thanks. We are not able to check all OS/QGIS/Models/layers combinations. Therefore, we generally base on automatic python tests for Ubuntu 20/22 and two or three manual GUI tests. So, if you discover any specific problem, we will try to fix it ASAP!