ClementPinard / FlowNetPytorch

Pytorch implementation of FlowNet by Dosovitskiy et al.
MIT License
843 stars 205 forks source link

Sparsity in ```validation()``` #111

Closed yasserben closed 2 years ago

yasserben commented 2 years ago

Hi, :smiley: I have a question related to the way sparsity is handled. In the train() function we have the condition :

 if args.sparse:
            # Since Target pooling is not very precise when sparse,
            # take the highest resolution prediction and upsample it instead of downsampling target
            h, w = target.size()[-2:]
            output = [F.interpolate(output[0], (h,w)), *output[1:]]

Which interpolates the first feature map (the biggest btw) to have the same dimensions as the target in case of sparsity. But this condition doesn't appear in validate() where sparsity of optical flow normally still remains. So I don't know if it's on purpose but in case of sparsity the mean EPE will be computed differently from train() to validate (). Thanks !! :wink:

ClementPinard commented 2 years ago

Hi,

during validation, the output is always upscaled, so you don't have problems with sparsity.

Even with dense target, the EPE computed during train is not the same as EPE during validation. That's why we made differentiation between multiscale EPE, and real EPE

yasserben commented 2 years ago

Thank you for your explanations !! :smiley: