coolzhao / Geo-SAM

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

Error in QGIS plugin #33

Open falahatshahrzad opened 4 months ago

falahatshahrzad commented 4 months ago

I faced with the following error when using Geo-SAM plugin. How can I solve it? "QGIS version: 3.32.3-Lima QGIS code revision: 67d46100b5 Qt version: 5.15.3 Python version: 3.9.5 GDAL version: 3.7.2 GEOS version: 3.12.0-CAPI-1.18.0 PROJ version: Rel. 9.3.0, September 1st, 2023 PDAL version: 2.5.5 (git-version: 24f78d) Algorithm started at: 2024-02-20T00:25:25 Algorithm 'Geo-SAM Image Encoder' starting… Input parameters: { 'BANDS' : [1,2,3], 'BATCH_SIZE' : 1, 'CKPT' : 'C:\Users\Shahrzad\Downloads\sam_vit_b_01ec64.pth', 'CRS' : None, 'CUDA' : False, 'CUDA_ID' : 0, 'EXTENT' : '588708.944200000,588771.672200000,2942778.169800000,2942862.779700000 [EPSG:32640]', 'INPUT' : 'C:/Users/Shahrzad/Desktop/1.ecw', 'LOAD' : True, 'MODEL_TYPE' : 2, 'OUTPUT' : 'TEMPORARY_OUTPUT', 'RANGE' : [nan,nan], 'RESOLUTION' : None, 'STRIDE' : 1024 }

Input data value range to be rescaled: [0.0, 255.0] (automatically set based on min-max value of input image inside the processing extent.) Band statistics took time 0.000s Layer path: C:/Users/Shahrzad/Desktop/1.ecw Layer name: 1 Layer CRS: EPSG:32640 Layer pixel size: 0.030289999999997135, 0.030289999999995005 meters Bands selected: [1, 2, 3] Target CRS: EPSG:32640 Target resolution: 0.030289999999997135 meters Processing extent: minx:588708.944200, maxx:588771.672200,miny:2942778.169800, maxy:2942862.779700 Processing image size: (width 2071, height 2793) Traceback (most recent call last): File "C:\Users/Shahrzad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM-main\tools\sam_processing_algorithm.py", line 471, in processAlgorithm rlayer_ds = SamTestRasterDataset( File "C:\Users/Shahrzad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo-SAM-main\tools\torchgeo_sam.py", line 410, in init super().init(root, crs, res, bands, transforms, cache) File "C:\Users\Shahrzad\AppData\Roaming\Python\Python39\site-packages\torchgeo\datasets\geo.py", line 447, in init raise FileNotFoundError(msg) FileNotFoundError: No SamTestRasterDataset data was found in paths='C:/Users/Shahrzad/Desktop'' with bands=['Band 1: Red', 'Band 2: Green', 'Band 3: Blue']

Execution failed after 0.03 seconds

Loading resulting layers Algorithm 'Geo-SAM Image Encoder' finished"

Fanchengyan commented 4 months ago

Hi @falahatshahrzad,

This seems to be a logic error in the dev version. We should have fixed this issue in the newest code. You can try downloading the code directly from the main repository and replacing the original code to see if it works.

falahatshahrzad commented 4 months ago

Thank you for your response. I did what you suggested. Unfortunately, it wasn't effective. What else can I do now?

On Wed, Feb 21, 2024, 12:38 Fanchengyan @.***> wrote:

Hi @falahatshahrzad https://github.com/falahatshahrzad,

This seems to be a logic error in the dev version. We should have fixed this issue in the newest code. You can try downloading the code directly from the main repository and replacing the original code to see if it works.

— Reply to this email directly, view it on GitHub https://github.com/coolzhao/Geo-SAM/issues/33#issuecomment-1956192515, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGBC5L7MY4S3ZTZJZZRUUWLYUW2RHAVCNFSM6AAAAABDQB2CYKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJWGE4TENJRGU . You are receiving this because you were mentioned.Message ID: @.***>

Fanchengyan commented 4 months ago

Hi @falahatshahrzad

Try using TIF. You need to convert the ECW file to TIF. It seems our code might not handle formats other than TIF, but I’m not sure. Please give it a try first.

falahatshahrzad commented 4 months ago

It works. Thank you