Closed littlespray closed 4 years ago
There are two parts of losses in VCN: 1) loss of flow estimation, and 2) loss of oor (out-of-range detection) module. To train PWCNet, only 1) is needed.
flowl0 = disc_aux[0].permute(0,3,1,2).clone()
mask = disc_aux[1].clone()
loss = 1.0*torch.norm((flow2*20-flowl0[:,:2]),2,1)[mask].mean() +\
0.5*torch.norm((flow3*20-flowl0[:,:2]),2,1)[mask].mean() + \
0.25*torch.norm((flow4*20-flowl0[:,:2]),2,1)[mask].mean() + \
0.25*torch.norm((flow5*20-flowl0[:,:2]),2,1)[mask].mean() + \
0.25*torch.norm((flow6*20-flowl0[:,:2]),2,1)[mask].mean()
I think you also need to change some interface of PWCNet, for example, pass disc_aux (some training auxiliary variable) to the forward function.
This piece of PWCNet code is not meant to be used for training, although I believe some simple modification would make it work.
Another thing to notice is that PWCNet is not easy to train from my experience, you may want to take a look of the supplement of VCN to change a few hyper-parameters.
Got it! Thank you very much for your help!
Hi, thank you for your great work.
I have used the VCN module and it works well. But when I wanted to train the PWC-Net module to make a comparison, I found that just changing this(line 201, in main.py)
to
cannot work, it shows:
I think it is because in models/PWCNet.py, line 300, the output is
It seems that he output[-2] and output[-1] are not the required loss and oor, so should I rewrite these part as that in VCN in order to train the PWCNet? namely, adding
Thank you very much for any help!