coolzhao / Geo-SAM

A QGIS plugin tool using Segment Anything Model (SAM) to accelerate segmenting or delineating landforms in geospatial raster images.
MIT License
199 stars 26 forks source link

Cannot load in an image #41

Open PMorrison-78 opened 2 months ago

PMorrison-78 commented 2 months ago

Hello, I am able to use the Geo-SAM tool on the demo image but when I try to load in any other image I get this error:

2024-04-04T10:33:43     WARNING    Traceback (most recent call last):
              File "C:\Users/admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM-main\tools\widgetTool.py", line 900, in load_feature
              self._set_feature_related()
              File "C:\Users/admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM-main\tools\widgetTool.py", line 458, in _set_feature_related
              self.sam_model = SAM_Model(self.feature_dir, str(self.cwd))
              File "C:\Users/admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM-main\tools\SAMTool.py", line 37, in __init__
              self._prepare_data_and_layer()
              File "C:\Users/admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM-main\tools\SAMTool.py", line 51, in _prepare_data_and_layer
              raise Exception("No sam model type info. found in feature files")
             Exception: No sam model type info. found in feature files

I am using QGIS 3.36.0, is there anything else I need to do besides load the directory that the image is in?

Thank you.

Fanchengyan commented 2 months ago

Hi @PMorrison-78 ,

You need to encode your image into features using Geo-SAM Image Encoder. Then loading generated features load-image-features before using Geo-SAM Segmentation (QGIS plugin)