Skip to content

Bregman convolutional barycenter 2d return an error for non-square images #124

@ThibautLG

Description

@ThibautLG

When ever I call
ot.bregman.convolutional_barycenter2d(A, reg, weights)
with A whose shape is not of the form (k,n,n), the function returns an error.

In my case, using the same code as in the example in the doc, I get the following error for (600,500) images.

ValueError                                Traceback (most recent call last)
<ipython-input-13-f723cd8affb9> in <module>
     55         else:
     56             # call to barycenter computation
---> 57             pl.imshow(ot.bregman.convolutional_barycenter2d(A, reg, weights), cmap=cm)
     58             pl.axis('off')
     59 pl.show()

~/.local/lib/python3.6/site-packages/POT-0.6.0-py3.6-linux-x86_64.egg/ot/bregman.py in convolutional_barycenter2d(A, reg, weights, numItermax, stopThr, stabThr, verbose, log)
   1361         b = np.zeros_like(A[0, :, :])
   1362         for r in range(A.shape[0]):
-> 1363             KV[r, :, :] = K(A[r, :, :] / np.maximum(stabThr, K(U[r, :, :])))
   1364             b += weights[r] * np.log(np.maximum(stabThr, U[r, :, :] * KV[r, :, :]))
   1365         b = np.exp(b)

~/.local/lib/python3.6/site-packages/POT-0.6.0-py3.6-linux-x86_64.egg/ot/bregman.py in K(x)
   1352 
   1353     def K(x):
-> 1354         return np.dot(np.dot(xi1, x), xi1)
   1355 
   1356     while (err > stopThr and cpt < numItermax):

<__array_function__ internals> in dot(*args, **kwargs)

ValueError: shapes (600,500) and (600,600) not aligned: 500 (dim 1) != 600 (dim 0)

My system information:

Linux-5.3.0-28-generic-x86_64-with-Ubuntu-18.04-bionic
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0]
NumPy 1.17.4
SciPy 1.3.3
POT 0.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions