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
106 stars 24 forks source link

ValueError: cannot convert float NaN to integer #183

Closed robmarkcole closed 1 week ago

robmarkcole commented 1 month ago

Describe the bug Running the Storage tank model on Bing, as per the example video

Traceback (most recent call last):
  File "/Users/robin.cole/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/deepness/deepness.py", line 268, in _run_model_inference
    self._map_processor = map_processor_class(
  File "/Users/robin.cole/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/map_processor/map_processor_detection.py", line 27, in __init__
    super().__init__(
  File "/Users/robin.cole/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/map_processor/map_processor_with_model.py", line 18, in __init__
    super().__init__(
  File "/Users/robin.cole/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/map_processor/map_processor.py", line 70, in __init__
    self.base_extent = extent_utils.calculate_base_processing_extent_in_rlayer_crs(
  File "/Users/robin.cole/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/extent_utils.py", line 172, in calculate_base_processing_extent_in_rlayer_crs
    expected_extent = round_extent_to_rlayer_grid(extent=expected_extent, rlayer=rlayer)
  File "/Users/robin.cole/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/deepness/processing/extent_utils.py", line 29, in round_extent_to_rlayer_grid
    x_min = grid_start[0] + int((extent.xMinimum() - grid_start[0]) / grid_spacing[0]) * grid_spacing[0]
ValueError: cannot convert float NaN to integer

Screenshots (including Deepness options selected)

image

Desktop (please complete the following information):

robmarkcole commented 1 month ago

When I change to Visible part and changed the resolution, the error is cleared

image
przemyslaw-aszkowski commented 1 month ago

Hi, thanks for reporting. I suspect the issue was caused by the resolution per pixel being too high (20000 cm/pixel), and probably some dimension was divided by zero. Nevertheless, it is worth adding a sanity check to the code to create a meaningful error message :) Cheers Przemek