def __getitem__(self, item):
    with Image.open(self._images[item]['path']) as img_raw:
        size = (img_raw.size[1], img_raw.size[0])
        img = self.transform(img_raw.convert(mode='RGB'))
    return {'img': img, 'idx': self._images[item]['idx'], 'size': size, 'abs_path': self._images[item]['path'], 'rel_path': path.relpath(self._images[item]['path'], self.in_dir)}
def __getitem__(self, item):
    with Image.open(self._images[item]['path']) as img_raw:
        size = (img_raw.size[1], img_raw.size[0])
        img = self.transform(img_raw.convert(mode='RGB'))
    return {'img': img, 'idx': self._images[item]['idx'], 'size': size, 'abs_path': self._images[item]['path'], 'rel_path': path.relpath(self._images[item]['path'], self.in_dir)}