Open PkuRainBow opened 6 years ago
we've not implemented data augmentations yet. Currently, random crop is supported. Feel free to do a PR to port the data augmentations from flownet2-caffe
@fitsumreda We will try to reimplement it. I recommend a torch version below(transform it to pytorch will be more convenient):
https://github.com/anuragranj/spynet/blob/master/transforms.lua
https://github.com/anuragranj/spynet/blob/master/donkey.lua
You can find a flow augmentation here : https://github.com/ClementPinard/FlowNetPytorch/blob/master/flow_transforms.py
As for flownet2 implementation, they set up a very elegant solution, based on affine transformation matrices.
You can find how they construct the flow map here and how they construct the affine matrices here
I tried to explain the general workflow with LaTeX equations here : to view it, copy paste in e.g. stackedit
So basically,
torch.arange
)affine_grid
and grid_sample
, you can easily apply such transformation : apply A1 to both I1 and FlowMap, and A2 to I2@
and flattened Flowmap (flattend_flow = flow.view(flow.size(0), 2, -1)
if considering batchwise flow augmentation)It may not be the simplest way to integrate it, but this is the most flexible, because it works for every possible value of affine matrix, provided that R2 is invertible. That includes shearing, flip, and every other affine transormation.
Thanks @PkuRainBow and @ClementPinard
Just curious if this issue has been fixed/ is required any longer. I would like to take this one up. Thanks. -H
I find that in the original version of the FlowNet/ FlowNet-2,the data augmentation techniques include :
But it seems that there only exists the center crop augmentation op in the current implementations.