New algorithm learns to 'watch where you're going'