rflamary · GitHub

@atong01

Copy link Copy Markdown

Contributor

Thank you for your awesome package!

The code and examples for ot.bregman.convolutional_barycenter2d assumes a symmetric image. This PR changes the kernel to allow for non-symmetric images and adds a simple test of this functionality.

This addresses Issue #124

@rflamary

Copy link Copy Markdown

Collaborator

This is great, thank you for the PR.

I think one day we should implement a proper convolution instead of those matrix products (or even circular convolution with Fourier as an option).

you can add you name at the top of the file as Author . I will do the merge in the next days. I am still waiting for a few things but I will do a new release shortly.

@rflamary rflamary changed the title Fix convolutional_barycenter2d kernel for non-symmetric images [MRG] Fix convolutional_barycenter2d kernel for non-symmetric images

Mar 6, 2020
Add authorship

@atong01

@atong01

Copy link Copy Markdown

Contributor Author

Agreed a proper convolution does sound useful in some circumstances. Interesting to note a simple usage of scipy.ndimage.filter.gaussian_filter with this kernel is ~4X slower on the example images. I would guess matrix products are simply better optimized at this scale.

def K(x):
    # sigma to match previous behavior
    sigma = [np.sqrt(reg / 2) * dim for dim in x.shape]
    x = gaussian_filter(x, sigma=sigma, mode="constant")
    return x

@rflamary

Closed

Read the original on github.com ↗