End-to-end differentiable 6DoF object pose estimation with local and global constraints