old_contents: import os.path as osp
  
  from PIL import Image
  
  
  class Preprocessor(object):
      def __init__(self, dataset, root=None, transform=None):
          self.dataset = dataset
          self.root = root
          self.transform = transform
  
      def __len__(self):
          return len(self.dataset)
  
      def __getitem__(self, index):
          fname, pid, camid = self.dataset[index]
          fpath = fname
          if self.root is not None:
              fpath = osp.join(self.root, fname)
          img = Image.open(fpath).convert('RGB')
          if self.transform is not None:
              img = self.transform(img)
          return img, fname, pid, camid
  
new_contents: import os.path as osp
  
  from PIL import Image
  
  
  class Preprocessor(object):
      def __init__(self, dataset, root=None, transform=None):
          self.dataset = dataset
          self.root = root
          self.transform = transform
  
      def __len__(self):
          return len(self.dataset)
  
      def __getitem__(self, indices):
          if isinstance(indices, (tuple, list)):
              return [self._get_single_item(index) for index in indices]
          return self._get_single_item(indices)
  
      def _get_single_item(self, index):
          fname, pid, camid = self.dataset[index]
          fpath = fname
          if self.root is not None:
              fpath = osp.join(self.root, fname)
          img = Image.open(fpath).convert('RGB')
          if self.transform is not None:
              img = self.transform(img)
          return img, fname, pid, camid
  
subject: Support a list of indices in the preprocessor