A young dad was told to look himself in the mirror by a judge after he followed a woman down an alleyway and masturbated in front of her.