Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: IndexError: list index out of range #18

Open
4del-Yousefi opened this issue Sep 2, 2023 · 5 comments
Open

dev: IndexError: list index out of range #18

4del-Yousefi opened this issue Sep 2, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@4del-Yousefi
Copy link

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

@Fanchengyan
Copy link
Collaborator

Fanchengyan commented Sep 3, 2023

@4del-Yousefi . Did you delete the demo feature and image?

@4del-Yousefi
Copy link
Author

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.

@Fanchengyan
Copy link
Collaborator

Fanchengyan commented Sep 5, 2023

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.

@Fanchengyan Fanchengyan added the bug Something isn't working label Sep 5, 2023
@fastratkafka
Copy link

Has anyone found another solution? I have the identical bug, tried everything. Also reinstallation. I can't find anything noticeable in the code either.

@4del-Yousefi
Copy link
Author

@fastratkafka
My solution was:

  1. check the current Raster CRS, if the units are not in meters then do the following
  2. In QGIS go to Raster -> Projections -> warp, then for target CRS select one with meter unit
  3. encode reprojected image

I hope this helps, might not be the best solution but worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants