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

Expose leafmap backend options to user #257

Open
openSourcerer9000 opened this issue Mar 20, 2024 · 7 comments
Open

Expose leafmap backend options to user #257

openSourcerer9000 opened this issue Mar 20, 2024 · 7 comments

Comments

@openSourcerer9000
Copy link

openSourcerer9000 commented Mar 20, 2024

Based on this phenomenon (opengeos/leafmap#707 (comment)), I would like to be able to swap out the default backend for folium in hopes of getting this library to work with Kaggle Notebooks. Currently the API doesn't allow for this.
image

With how different backends are loaded, this may be a sensible way of changing the backend:

import leafmap.foliumap as leafmap
sam = SamGeo(
    model_type="vit_h",
    automatic=False,
    sam_kwargs=None,
    leafmap_backend=leafmap
)
@giswqs
Copy link
Member

giswqs commented Mar 20, 2024

Unfortunately, the interactive GUI requires ipyleaflet and ipyleaflet. Folium is very limited. It can't handle user input.

If you just need to display the image and segmentation results, you can still use the folium backend.

I would suggest you use Colab before the ipyleaflet issue is resolved in Kaggle.

@openSourcerer9000
Copy link
Author

openSourcerer9000 commented Mar 21, 2024

I tried google Colab first but I wasn't able to get a working environment setup. After installing samgeo and its dependencies in a GPU session, the notebook was no longer able to access the GPU (torch.cuda.is_available() Returns false). Seeing a similar issue in the Colab repo, they say they only maintain the base environment and anything else it's up to you to configure the packages correctly. While still trying to debug this, Colab locked me out of GPU sessions, which is when I tried switching to Kaggle.

This is where I left off; If you know how to get a working environment with samgeo and cuda in Colab that would be a big help:
https://colab.research.google.com/drive/1oO6MCY15pCVJdrY0db9S2vbFKyKGY-6O?usp=sharing

@giswqs
Copy link
Member

giswqs commented Mar 21, 2024

did you try pip install segment-geospatial on Colab?

@openSourcerer9000
Copy link
Author

openSourcerer9000 commented Mar 21, 2024

Ah thanks that's much simpler and it does work. When I click segment in the interactive window, it does run the model, but it won't show the output segmentation layer on the map. Have you seen it work in Colab?

@giswqs
Copy link
Member

giswqs commented Mar 21, 2024

It used to work. I have not used it recently. Need sometime to look into it

@openSourcerer9000
Copy link
Author

The only environment that I've gotten the segmentation to work reliably is jupyterlab. However, the save button doesn't seem to work in jupyterlab. Is there a way to access the layer from code? The following commands hit javascript errors:
image

@giswqs
Copy link
Member

giswqs commented Mar 30, 2024

Have you tried it on Google Colab? Did it work? I have not encourtered this issue before. Can you provide a notebook that can reproduce the issue?

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