@ptrblck I get the following error when using this exact code in __getitem__ function
    img2 = np.random.choice([self.root.samples[i] for i,sample in enumerate(self.root.samples) if sample[1]==data[1]])
  File "mtrand.pyx", line 1122, in mtrand.RandomState.choice
ValueError: a must be 1-dimensional