The Balanced-Pairwise-Affinities Feature Transform