From re-identification to identity inference: labeling consistency by local similarity constraints