Could have been a case of walking while black, in some neighborhoods that will get you stopped.
In the vast majority of cases I've seen, it's not some self-initiated action by the officer, but some other local, who doesn't like the way a person looks.