You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------------------------------------------------------------------------KeyErrorTraceback (mostrecentcalllast)
1hausdorf_loss=SamplesLoss("hausdorff", p=2, blur=0.05)
2source, target=torch.rand(1, 100, 3), torch.rand(1, 100, 3)
---->3hausdorf_loss(source, target)
Filepath/python3.8/site-packages/torch/nn/modules/module.py:1190, inModule._call_impl(self, *input, **kwargs)
1186# If we don't have any hooks, we want to skip the rest of the logic in1187# this function, and just call forward.1188ifnot (self._backward_hooksorself._forward_hooksorself._forward_pre_hooksor_global_backward_hooks1189or_global_forward_hooksor_global_forward_pre_hooks):
->1190returnforward_call(*input, **kwargs)
1191# Do not call functions when jit is used1192full_backward_hooks, non_full_backward_hooks= [], []
Filepath/python3.8/site-packages/geomloss/samples_loss.py:265, inSamplesLoss.forward(self, *args)
262α, x, β, y=α.unsqueeze(0), x.unsqueeze(0), β.unsqueeze(0), y.unsqueeze(0)
264# Run ---------------------------------------------------------------------------------->265values=routines[self.loss][backend](
266α,
267x,
268β,
269y,
270p=self.p,
271blur=self.blur,
272reach=self.reach,
273diameter=self.diameter,
274scaling=self.scaling,
275truncate=self.truncate,
276cost=self.cost,
277kernel=self.kernel,
278cluster_scale=self.cluster_scale,
279debias=self.debias,
280potentials=self.potentials,
281labels_x=l_x,
282labels_y=l_y,
283verbose=self.verbose,
284 )
286# Make sure that the output has the correct shape ------------------------------------287if (
288self.potentials289 ): # Return some dual potentials (= test functions) sampled on the input measuresFilepath/python3.8/site-packages/geomloss/kernel_samples.py:108, inkernel_loss(α, x, β, y, blur, kernel, name, potentials, use_keops, ranges_xx, ranges_yy, ranges_xy, **kwargs)
92defkernel_loss(
93α,
94x,
(...)
105**kwargs106 ):
107ifkernelisNone:
-->108kernel=kernel_routines[name]
110# Center the point clouds just in case, to prevent numeric overflows:111# N.B.: This may break user-provided kernels and comes at a non-negligible112# cost for small problems, so let's disable this by default.
(...)
115116# (B,N,N) tensor117K_xx=kernel(
118double_grad(x), x.detach(), blur=blur, use_keops=use_keops, ranges=ranges_xx119 )
KeyError: None
Am I doing something wrong?
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered:
I had the same issue, and it turned out that I wasn't in the right environment. Note that, while you can pip install geomloss, you need to install KeOps as well.
If that doesn't work, there also might be a bug with name defaulting to None and thus getting nothing from the list. A way around this is passing in the kernel function you want instead of going with the default argument value:
from geomloss.kernel_samples import gaussian_kernel
geomloss.SamplesLoss(loss='hausdorff', p=2, kernel=gaussian_kernel, blur=.05, verbose=True)
Hi Jean,
Thank you for the excellent library!
I have a question about how to use the Hausdorff distance. I'm using it like this:
however, I got the following error:
Am I doing something wrong?
Thank you in advance for your help!
The text was updated successfully, but these errors were encountered: