jeanfeydy / geomloss

Geometric loss functions between point clouds, images and volumes
MIT License
599 stars 60 forks source link

ValueError: Maximum allowed size exceeded #34

Open bit0123 opened 4 years ago

bit0123 commented 4 years ago

I am trying to computer Sinkhorn distance between two tensor of size 2x256. My data are quite sparse. I got the folowing error:

`File "/usr/local/lib/python3.6/dist-packages/geomloss/sinkhorn_samples.py", line 48, in sinkhorn_tensorized diameter, ε, ε_s, ρ = scaling_parameters( x, y, p, blur, reach, diameter, scaling ) File "/usr/local/lib/python3.6/dist-packages/geomloss/sinkhorn_divergence.py", line 72, in scaling_parameters ε_s = epsilon_schedule( p, diameter, blur, scaling ) File "/usr/local/lib/python3.6/dist-packages/geomloss/sinkhorn_divergence.py", line 61, in epsilon_schedule

AdrienCorenflos commented 4 years ago

I had the same issue, the scaling you're using is too close to 1. @jeanfeydy I fixed it locally by using a generator. Do you want me to send a PR for that?

bit0123 commented 4 years ago

PR would be great. Thanks

AdrienCorenflos commented 4 years ago

Jean will correct me if I'm mistaken, but the real fix for you is to lower your scaling parameter I'd presume, except if you know you really, really can't do without this precision (also if you have put a scaling of 1 you will still end up having an infinite loop anyway, even with my PR)

AEGISEDGE commented 3 years ago

Hi there, I met the same question frequently. It seems the list of values created by np.arange is too long. So I tried with small scaling parameter (1e-3) but it came a again. So I wonder how can I do to fix or avoid this error? Thank u!

A-Vzer commented 3 years ago

For me it was the estimated diameter parameter becoming too large because of instable training. I looked at the magnitude of my samples and set the parameter myself.