code: def get_image(self, cat, img):
          
          filename = self.path(cat, img)
          data = []
          if filename.endswith('mat'):
              data = loadmat(filename)['output']
          else:
              data = imread(filename)
          if self.size is not None:
              return imresize(data, self.size)
          else:
              return data
docs: Loads an image from disk.