I think your dog might be trying to protect you. Or maybe he's jealous? I used to have a dog who barked whenever I stopped to talk to someone - it was more barking at me though, I think lol.....
Pepper barks on people walking through the gate (the cling sets him off

), once he was growling and barking at two kids sitting in front of the house - through the window. Once out the house, he wants to greet everyone...