Towards automatic identification of mismatched image pairs through loop constraints