Learning the geometry of wave-based imaging