coolzhao / Geo-SAM

A QGIS plugin tool using Segment Anything Model (SAM) to accelerate segmenting or delineating landforms in geospatial raster images.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sam_feature_history[-1][0] error

4del-Yousefi opened this issue · comments

image

using version 1.2.1 I am loading features folder and trying to work on it but this errors shows up.

Could you please provide a detailed description of the scenario in which this issue is triggered? Does it occur when finishing a labeling session and labeling after loading new features?

I launch QGIS and open the Geo SAM tool. The demo image appears and works fine in both hover and selection modes. However, when I attempt to work with the features folder, the tool becomes buggy. Based on my observations, I suspect that the issue is related to the shapefile, or something related to it. I also tried loading a previously worked-on shapefile, but it didn’t work either.

I think it's better to add a create new shapefile button maybe the automate system that creates shapefiles gets bugged I am not sure.

I will try to record a video and share it with you.

"C:\Users/ASUS/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo SAM\tools\widgetTool.py", line 609, in save_shp_file if self.sam_feature_history[-1][0] IndexError: list index out of rang

Thank you for your feedback. I look forward to your video. The previous testing primarily focused on labeling. We will conduct new tests specifically for loading new shapefiles and features in the future.

Hello here an example of my workflow:

bug.mp4

Hi @4del-Yousefi . In the video, it seems like you were using a very early dev version. Could you please conduct the testing on the latest dev version?

I encoded new image then worked on it saved the shapefile then reloaded the feature folder and shape file. Thats when its stop working
The issue happens when we reload the feature folder and shape file.

I tried with almost all versions same issue. I will try again to see if one of dev builds work.

Can the stable version run properly? It appears the issue may be caused by the inability to convert the projection of the features to the projection of the shapefile. Additionally, could you please help test if the problem occurs when creating a new shapefile by clicking the "From file" button?

Okay an update, creating a new shapefile using "from file" makes a new shp file where the selection hovering and saving works. However, loading a saved shp doesn't.

when i close QGIS it shows this crash i dont know if its related.

image
on latest dev version.

Hi @4del-Yousefi. Could you please share the projection details for both the previous and current shapefiles? The projection files have the same name as the shapefile, with the extension ".prj", and can be opened with a text editor. We did not encounter this issue during our testing on our own dataset. Your case can help us further improve the code.

prj file with issues:

PROJCS["WGS_1984_UTM_Zone_40N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",57.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

PROJCS["WGS_1984_UTM_Zone_40N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",57.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

newly created prj that works:
1)
PROJCS["WGS_1984_UTM_Zone_40N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",57.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

I don't think the issue is from that.

When working with shp files that are bugged or previously saved it shows this error on saving (pressing S).
image

While it doesnt show on newly created shp files.

According to this log, it seems that the newly added feature IDs (FID) are smaller than the ones previously saved. It appears that QGIS did not add the FIDs in chronological order. In the future, we will try customizing the FIDs in the attribute table instead of relying on QGIS's automatic generation. However, this will take some time. For now, please work with the new shapefile for your remaining work, and merge it after finishing all the work. Besides, if possible, could you share your shapefile with issues so that we can further investigate the cause of the error, debug the code, and resolve the issue.

BuggedShp.zip

I have attached the bugged shapefiles. take a look.

Thank you for sharing. We will use this shapefile to determine the source of the issue, but it may take some time to resolve it and publish a new version.