Person re-identification with pairwise learning and ranking