def __getitem__()

in src/data_loader.py [0:0]


    def __getitem__(self, index):
        """
        Args:
            index (int): Index
        Returns:
            tuple: (image, target) where target is a dictionary of the XML tree.
        """

        img = Image.open(self.images[index]).convert('RGB')
        target = self.parse_voc_xml(ET.parse(self.annotations[index]).getroot())

        if self.transform is not None:
            img = self.transform(img)

        target = target['annotation']['object']
        # handle 1-object case
        if type(target) is dict:
            target = [target]

        idxs = list(range(len(target)))
        if self.shuffle:
            np.random.shuffle(idxs)

        # build target
        target_list = []
        for t in idxs:
            category_name = target[t]['name']
            category_id = self.cats.index(category_name)
            if category_id not in target_list:
                target_list.append(category_id)

        # eos
        if self.include_eos:
            target_list.append(0)

        return img, target_list