wuhuikai / DeepGuidedFilter

Official Implementation of Fast End-to-End Trainable Guided Filter, CVPR 2018

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about implementation of FastGuidedFilter

adgaudio opened this issue · comments

Hello!

Thank you for this well written library. I have been comparing your implementation to the Guided Filter paper (http://kaiminghe.com/publications/pami12guidedfilter.pdf) and the most recent note (from 2015) on arXiv for the Fast Guided Filter implementation: https://arxiv.org/pdf/1505.00996.pdf

There appears to be a difference between the original paper (Section 5, EXPERIMENTS, under "Joint Upsampling") and step 5 of Algorithm 2 of the 2015 paper. Specifically, the original paper says, in the joint upsampling section, to remove step 5 (specifically, "bilinearly upsample [...] to the fine scale (replacing the mean filter on a and b),") but the 2015 paper includes the mean filter.

Your implementation follows the original paper. Just above this line in the code, one could add a box filter for A and for b just before interpolation.

mean_A = F.interpolate(A, (h_hrx, w_hrx), mode='bilinear', align_corners=True)

Is the argument in support of removing step 5 simply that bilinear interpolation (when upsampling) acts like a mean filter? (I think that isn't correct but am not sure).

I was wondering whether you were aware of this difference, and whether you have done any testing to evaluate the guided filter with and without step 5? I ran a simple test comparing FastGuidedFilter (with no down sampling) against OpenCV and found that sq. difference increases (from 160 to >600) with inclusion of step 5. But then I implemented the extension to the (fast) guided filter to support color guide image and grayscale filter image and found the mean filter decreased the error (from 2.5 to .09). So this leaves me wondering.

... Perhaps at the end of the day the difference in performance doesn't matter too much.

Algorithm 2 of the 2015 paper is for joint filtering, i.e. both the input and guidance image are in high resolution. The original paper and ours are for joint upsampling, i.e. the input image is in low resolution while the guidance image is in high resolution. Thus, we remove step 5. We did not do any experiment to support this choice. Experiments and pull requests are welcome if step 5 improves the performance : )

@adgaudio Hi, could you please share the code supporting color guide image and grayscale filter image ?

Dear @mangdian ,

Thanks for writing. I would be happy to share my code. I was planning to write a paper on it, but alas still haven't gotten around to this one. (I would be happy to collaborate with you, or anyone else). I suppose the best way to contribute is to write a PR, but I only have a pytorch implementation. I will open a pr and link to this issue. If you want to collaborate on a paper, I would be very happy to.

Alex