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

QGIS problem for running SAM #21

Open
bouyeijiang opened this issue Nov 23, 2023 · 2 comments
Open

QGIS problem for running SAM #21

bouyeijiang opened this issue Nov 23, 2023 · 2 comments

Comments

@bouyeijiang
Copy link

QGIS version: 3.34.0-Prizren
QGIS code revision: ffbdd67881
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: 2023-11-23T08:41:12
Algorithm 'Segment Anything Model (SAM)' starting…
Input parameters:
{ 'Checkpoints' : 0, 'Mask' : 'TEMPORARY_OUTPUT', 'Polygons' : 'TEMPORARY_OUTPUT', 'Raster' : 'F:/xx/xx.tif', 'batch' : False, 'box_nms_thresh' : None, 'crop_n_layers' : None, 'crop_n_points_downscale_factor' : None, 'crop_nms_thresh' : None, 'crop_overlap_ratio' : None, 'min_mask_region_area' : None, 'points_per_batch' : None, 'points_per_side' : None, 'pred_iou_thresh' : None, 'stability_score_offset' : None, 'stability_score_thresh' : None, 'unique' : False }

Failed to load python modules for SAM predictions. Try using the configure tool or manually install the segment-geospatial package using pip install segment-geospatial.
Execution completed in 0.03 seconds
Results:
{}

@agentmorris
Copy link

I had the same symptom: I had installed segment-geospatial and could successfully run "import samgeo" in the QGIS Python console, but I got the same error from the plugin. In my case, this was because I created a Python environment very recently using mamba, which as of 12/19/23 defaults to Python 3.12. I installed QGIS and segment-geospatial in that environment, using "pip install segment-geospatial". Paradoxically, this installs a very old version of segment-geospatial, I believe because very old versions of PyTorch didn't pin the Python version the same way. I.e., new versions of PyTorch are not yet compatible with Python 3.12, so pip had to install a very old version of PyTorch, which resulted in a very old version of segment-geospatial getting installed, so "from samgeo import common" didn't work.

Fixed by doing everything the same way, but in a Python 3.11 environment.

@bouyeijiang
Copy link
Author

bouyeijiang commented Dec 19, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants