dev: IndexError: list index out of range
4del-Yousefi opened this issue · 5 comments
i using the latest dev build 1.3.1 and facing this issue:
IndexError: list index out of range
Traceback (most recent call last):
File "C:\Users/Adel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo SAM\tools\widgetTool.py", line 996, in toggle_load_demo_img
self._set_feature_related()
File "C:\Users/Adel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo SAM\tools\widgetTool.py", line 422, in _set_feature_related
self.sam_model = SAM_Model(self.feature_dir, str(self.cwd))
File "C:\Users/Adel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo SAM\tools\SAMTool.py", line 31, in init
self._prepare_data_and_layer()
File "C:\Users/Adel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo SAM\tools\SAMTool.py", line 35, in _prepare_data_and_layer
self.test_features = SamTestFeatureDataset(
File "C:\Users/Adel/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo SAM\tools\torchgeo_sam.py", line 205, in init
raster_name = os.path.basename(raster_list[0])
IndexError: list index out of range
@4del-Yousefi . Did you delete the demo feature and image?
Although I’m not certain what caused the issue, I was able to resolve it by reinstalling the plugin. However, there are times when I load a shpfile that I’ve worked on and the hovermode stops working. When I click, it doesn’t show until I save the selection. This is a random occurrence that happens from time to time, and I’m still unsure why. Deleting the shp file sometimes fixes the issue since it generates the default shpfile.
Hi @4del-Yousefi . I believe this issue may be caused by a mismatch between the project CRS in QGIS and the CRS of your image features. In this version, we are utilizing the rubberBand class provided by QGIS instead of using a shapefile to display polygons. This approach is aimed at improving rendering speed for preview mode. However, the rubberBand only works correctly when the CRS of the polygons matches the project CRS. To potentially resolve this problem, you can try reloading the features by clicking the 'Load' button before labeling (this will change project CRS to image feature CRS) and observe if it resolves the issue. Thanks for your feedback. I'll check the connection between this issue and shapefile, and address this issue in the upcoming version.
Has anyone found another solution? I have the identical bug, tried everything. Also reinstallation. I can't find anything noticeable in the code either.
@fastratkafka
My solution was:
- check the current Raster CRS, if the units are not in meters then do the following
- In QGIS go to Raster -> Projections -> warp, then for target CRS select one with meter unit
- encode reprojected image
I hope this helps, might not be the best solution but worked for me!