1. A computer-implemented method comprising: obtaining a pair of images comprising a first image and a second image; segmenting each image of the pair into a respective foreground region and a respective background region; generating (i) a first modified version of the first image by modifying the background region of the first image, (ii) a different, second modified version of the first image by modifying the foreground region of the first image, (iii) a first modified version of the second image by modifying the background region of the second image, and (iv) a different, second modified version of the second image by modifying the foreground region of the second image; generating an image descriptor for each of (i) the first modified version of the first image in which the background region of the first image is modified, (ii) the different, second modified version of the first image in which the foreground region of the first image is modified, (iii) the first modified version of the second image in which the background region of the second image is modified, and (iv) the different, second modified version of the second image in which the foreground region of the second image is modified; generating an aggregated image descriptor for the first image based at least on (i) the image descriptor for the first modified version of the first image in which the background region of the first image is modified, and (ii) the image descriptor for the different, second modified version of the first image in which the foreground region of the first image is modified; generating an aggregated image descriptor for the second image based at least on (i) the image descriptor for the first modified version of the second image in which the background region of the second image is modified, and (ii) the image descriptor for the different, second modified version of the second image in which the foreground region is modified; and classifying the pair of images as similar or as not similar based at least on (i) the aggregated image descriptor for the first image and (ii) the aggregated image descriptor for the second image.