def __getitem__(self, index): path = self.path_list[index] img_path = os.path.join(self.root, path) label = self.label_list[index] img = read_image(img_path, mode=self.mode) if self.transforms is not None: img = self.transforms(img) return img, label
def __getitem__(self, index): path = self.path_list[index] img_path = os.path.join(self.root, path) label = self.label_list[index] img = read_image(img_path, mode=self.mode) if self.bboxes and self.bboxes.get(path): x1, y1, x2, y2 = self.bboxes[path] img = img.crop((x1, y1, x2, y2)) if self.transforms is not None: img = self.transforms(img) return img, label