examples icon indicating copy to clipboard operation
examples copied to clipboard

Add the GrabCut example

Open maximlt opened this issue 3 years ago • 18 comments

This PR adds the GrabCut example taken from Earthsim's topics. While the original example relied on the earthsim library, this example relies on the module earthsim.py that sits next to the notebook. This module has been extracted and adapted from earthsim. Doing so has allowed to significantly reduce the number of dependencies required to run the grabcut example, and as a consequence made it possible to update the remaining ones.

Compared to the original example:

  • No more dependency on quest to download map tiles, instead the module relies on the function get_tile_rgb available in the util.py module of geoviews.
  • The last step that used a PolyAnnotator to modify the contour generated during the main/previous stage has been entirely removed since annotators are currently broken in geoviews (https://github.com/holoviz/geoviews/issues/526).
  • Added a few comments and some metadata (authors, last updated...).

maximlt avatar Nov 15 '21 00:11 maximlt

@jlstevens if you don't mind having a look at this, I think that this time we're closer to what we wanted to have from the beginning! Too bad that the annotators seem to be broken in geoviews, I just realized it quite late in the process of updating the main grabcut class.

maximlt avatar Nov 15 '21 01:11 maximlt

annotators seem to be broken in geoviews

That's alarming!!

jbednar avatar Nov 15 '21 05:11 jbednar

Thanks for the PR!

I'll try this out tonight - this will be a nice test case for my deployment tool. :-)

annotators seem to be broken in geoviews

That sounds like an issue to file on geoviews if you can submit a small, reproducible example...

jlstevens avatar Nov 15 '21 12:11 jlstevens

@jlstevens thanks! And there was already an issue opened on geoviews 🙃

maximlt avatar Nov 15 '21 14:11 maximlt

I've rebased this PR and if I can get it to build I'll merge to master and update the public website.

jlstevens avatar Jan 27 '22 11:01 jlstevens

@maximlt just reminded me that there is one last change to be made to the grabcut project: we need to serve a panel dashboard with .servable() if we want to deploy (with some necessary hackery due to the lack of openGL in the deployment containers).

jlstevens avatar Jan 27 '22 13:01 jlstevens

@jlstevens I've made Grabcut servable by creating a small dashboard with a pipeline that includes the first two stages introduced in the notebook. I've not added the 3rd stage (allow to manually edit the contour obtained after running grabcut) since the 4th stage which should allow to download the output (or do something with it, anything really) isn't included in the notebook, since it wasn't included in Earthsim. I don't even know if it's possible to export a Path or Polygon to a shapefile with geoviews?

Last section of the notebook: image

First stage of the deployed app: image

maximlt avatar Feb 21 '22 23:02 maximlt

Looks great!

A two stage pipeline is fine for now: I'll see if I can deploy a running version of this project shortly and if that works well, we can think about whether it is worth introducing more stages.

jlstevens avatar Feb 21 '22 23:02 jlstevens

Cool! I believe shapely can export a shapefile.

jbednar avatar Feb 22 '22 00:02 jbednar

Cool! I believe shapely can export a shapefile.

That would be with fiona, I don't think shapely does any I/O. Maybe also with pyshp.

maximlt avatar Feb 22 '22 08:02 maximlt

Oh man, I can definitely understand why Maxime had concerns about panel-chat-examples and future maintenance; for old, unmaintained repos, its a nightmare.

Took me the whole day to get it barely functioning. It's cool when it works, but super, extremely finicky.

https://github.com/holoviz-topics/examples/assets/15331990/49da16d0-c354-4ac7-aa65-da9226e0041e

This drained the life out of me, and I'd prefer to rebuild existing ideas thru slightly more modern tools like https://twitter.com/giswqs/status/1649416858645282822 instead next time.

ahuang11 avatar Mar 01 '24 00:03 ahuang11

Oh man, I can definitely understand why Maxime had concerns about panel-chat-examples and future maintenance; for old, unmaintained repos, its a nightmare.

Welcome to the gang :D Code that doesn't run dies quicker than one would think!

maximlt avatar Mar 01 '24 12:03 maximlt

Would like a review on this.

ahuang11 avatar Mar 19 '24 18:03 ahuang11

Can we merge this?

ahuang11 avatar Apr 29 '24 15:04 ahuang11

Please!

jbednar avatar Apr 29 '24 16:04 jbednar

Let me review please, I see some changes to make, to the project config for instance...

maximlt avatar Apr 29 '24 16:04 maximlt

@ahuang11 did you use anaconda-project to set up your environment to work on Grabcut? I see the project is not locked on osx-arm64.

maximlt avatar Apr 30 '24 03:04 maximlt

It's been a while so I don't really remember. I believe I did, but I didn't lock the project.

ahuang11 avatar Apr 30 '24 03:04 ahuang11