Closed kcpevey closed 5 years ago
I saw the above behavior a couple of times. I just recreated it with two new lines and just ran update contour
once and now the results from very similar lines look like this:
I've been noticing erratic behavior like this from grabcuts quite a bit but I haven't been able to nail down the cause.
I've been noticing erratic behavior like this from grabcuts quite a bit but I haven't been able to nail down the cause.
Is this recently or has it always been acting odd for you?
I've always thought something was off. Unfortunately I reported a lot of it in a PR (https://github.com/pyviz/EarthSim/pull/186) instead of an issue. I'm sure some of it just the grabcut algorithm itself being finicky, but the issue above seems like it might be on our side.
Since we're on the topic, we need to switch the foreground and background specification. In a highly disjointed delta, grabcuts performs much much better when the the red marker is used to specify the water (because of the assumptions of the algorithm and which one is being used as 'source'. I haven't made an issue for this since I wanted to check to see if that was true for all images or if we just need to change the blue marker to a non-water color and explain that if you don't achieve good results, try and reverse them.
This helped me uncover an issue in the memoization of a DynamicMap. What should happen is that Update Contours
should cache the result of the grabcut output and filter/simplify should only operate on the cached output of the algorithm. What was happening instead was that due to bad hashing behavior the cache wouldn't be used, resulting in the grabcut algorithm being rerun and I guess because it's unstable in some cases the output changes between runs, producing suboptimal results. I'll push a fix to holoviews and then you can check if the behavior has improved.
Here's the PR with a fix: https://github.com/pyviz/holoviews/pull/3490
This has improved.
If I run grabcuts once and get this:
If I just change the minimum tolerance from 0 to 500 and click
Filter Contour
, I get this:This isn't intuitive to me - what is going on here? Is
Filter contour
running more iterations? Even if it where, this still wouldn't be intuitive.