Learning invariant representations and applications to face verification