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

Geo-SAM python encoder #25

Open
cycle4 opened this issue Nov 1, 2023 · 1 comment
Open

Geo-SAM python encoder #25

cycle4 opened this issue Nov 1, 2023 · 1 comment

Comments

@cycle4
Copy link

cycle4 commented Nov 1, 2023

Hello !
Thank you for thinking about releasing a python library to encode the image without going through QGIS (even if it works very well in QGIS). However I am having troubles when I want to modify the parameters of the encoding in the settings json file. I export it from QGIS to have the "template" of the json file but I am still having issues. Can you provide an exemple of the json settings file to be sure I have the right namings ?
I am currently working with this :
{
"area_units": "m2",
"distance_units": "meters",
"ellipsoid": "EPSG:7030",
"inputs": {
"BANDS": null,
"BATCH_SIZE": 1,
"CKPT": "/home/Desktop/IMG_ENC/checkpoint/sam_vit_l_0b3195.pth",
"CRS": null,
"CUDA": true,
"CUDA_ID": 0,
"EXTENT": null,
"INPUT": "F:/exemple.tif",
"LOAD": true,
"MODEL_TYPE": 1,
"OUTPUT": "TEMPORARY_OUTPUT",
"RANGE": "None,None",
"RESOLUTION": 1.2,
"STRIDE": 922
}
}

I am not sure if this is the expected format as the library works well on a single image with the default parameters (no json settings file implied) but crashes when I try to implement the settings

By the way, I had this error trying to run it with GPU :
line 642, in
settings = {Parameter_Mapping[k]: v for k,
KeyError: 'CUDA'

It has been solved by adding to image_encoder.py line 642 this part :
settings = {Parameter_Mapping[k]: v for k, v in settings.items() if k != 'CRS' and k in Parameter_Mapping}

Thanks for your help

@Fanchengyan
Copy link
Collaborator

Hi @cycle4

The keys for the parameters are fixed. You can copy the settings from Encoder Copilot and paste it into any text editor to view all the required parameters. 'CUDA' is not in those parameters/keys, so you need to delete this parameter before running.

The default parameters are enough to run it. Our tutorials just specify the paths, without any other parameters [see Run by specify parameters directly section for more details]:

https://geo-sam.readthedocs.io/en/latest/Usage/encoder_package.html#run-by-specify-parameters-directly

I suggest you directly run the Colab tutorials, which can help you understand the results of each step in more detail.

https://colab.research.google.com/github/coolzhao/Geo-SAM/blob/dev/GeoSAM-Image-Encoder/examples/geosam-image-encoder.ipynb

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