Imported from https://github.com/mazenmel/Deep-homography-estimation-Pytorch