lliuz / ARFlow

The official PyTorch implementation of the paper "Learning by Analogy: Reliable Supervision from Transformations for Unsupervised Optical Flow Estimation".
MIT License
249 stars 49 forks source link

loss explodes when w_smooth=0 and w_ternary=0 #9

Closed awaelchli closed 3 years ago

awaelchli commented 3 years ago

Hi, thanks for sharing the code. I noticed that if I train without smoothing loss and without ternary loss, the losses explode at around epoch 7 and then eventually become NaN. Did you also observe that in your experiments and do you have any ideas what could cause this behaviour?

lliuz commented 3 years ago

I do not try this case, but I can give some explanation from my point of view:

When training with our pipeline, the smooth loss and photometric loss provide a basic guarantee that the network can always perform well on regular samples, and the augment loss encourage the network to try on challenging samples with the guide of first forward pass.

If you training without ternary loss and smooth loss, the network lost the basic guarantee on regular samples, which makes the training unstable.

Besides, you can have a freeze model in the first forward pass so that you can train without smooth loss and ternary loss in a model distillation way.