caching images and subsets of RandomSampleSubsets