Expose leafmap backend options to user
Based on this phenomenon (https://github.com/opengeos/leafmap/issues/707#issue-2198216506), 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.
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
)
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.
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
did you try pip install segment-geospatial on Colab?
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?
It used to work. I have not used it recently. Need sometime to look into it
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:
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?