I converted the code for python 2.7 by replacing @ with np.matmul and removing nopython=True from the jit decorators. I am getting the following error when I try to run the demo:
bayesian_matting.py:182: RuntimeWarning: invalid value encountered in divide
f, b, alphaT = solve(mu_f, sigma_f, mu_b, sigma_b, p, 0.01, alpha_init, 50, 1e-6)
/mnt/c/Users/Yannis/Desktop/429_project/source/bayesian-matting-master/orchard_bouman_clust.py:18: RuntimeWarning: invalid value encountered in divide
self.mu = np.einsum('ij,i->j', self.X, w)/W
/mnt/c/Users/Yannis/Desktop/429_project/source/bayesian-matting-master/orchard_bouman_clust.py:21: RuntimeWarning: invalid value encountered in divide
self.cov = (np.matmul(t.T,t))/W + 1e-5*np.eye(3)
Traceback (most recent call last):
File "bayesian_matting.py", line 204, in
main()
File "bayesian_matting.py", line 195, in main
alpha = bayesian_matte(img, trimap)
File "bayesian_matting.py", line 177, in bayesian_matte
mu_f, sigma_f = clustFunc(f_pixels, f_weights)
File "/mnt/c/Users/Yannis/Desktop/429_project/source/bayesian-matting-master/orchard_bouman_clust.py", line 36, in clustFunc
nodes = split(nodes)
File "/mnt/c/Users/Yannis/Desktop/429_project/source/bayesian-matting-master/orchard_bouman_clust.py", line 50, in split
C_b = Node(C_i.X[np.logical_not(idx)], C_i.w[np.logical_not(idx)])
File "/mnt/c/Users/Yannis/Desktop/429_project/source/bayesian-matting-master/orchard_bouman_clust.py", line 23, in init
V, D = np.linalg.eig(self.cov)
File "/mnt/c/Users/Yannis/Desktop/429_project/source/venv/local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 1128, in eig
_assertFinite(a)
File "/mnt/c/Users/Yannis/Desktop/429_project/source/venv/local/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 217, in _assertFinite
raise LinAlgError("Array must not contain infs or NaNs")
numpy.linalg.linalg.LinAlgError: Array must not contain infs or NaNs