My dog has this problem too. When people walk by during his walks, he gets really excited and wants to jump on them. Usually what I do is that when I see him staring at them (like following them with his eyes), I'll nudge him a little with my foot (not hard), so he'll get back to walking. We're still working on it though.