Information about my target-
I’m following the site’s tutorial.
Except I want ItemsB to be deteminstiacally set and not randomly.
The problem-
Whenever I call split_by_valid func it divides the Itemlist according to the items
attribute and leaving itemsB
undivided. This creates a mismatch between the indexes of items
and itemsB
.
Was wondering If anyone has an idea how to overcome this.
Code -
class ImageTupleList(ImageList):
_label_cls=TargetTupleList
def __init__(self, items, itemsB=None, **kwargs):
super().__init__(items, **kwargs)
self.itemsB = itemsB
self.copy_new.append('itemsB')
def get(self, i):
img1 = super().get(i)
fn = self.itemsB[i]
return ImageTuple(img1, open_image(fn))
def reconstruct(self, t:Tensor):
return ImageTuple(Image(t[0]/2+0.5),Image(t[1]/2+0.5))
@classmethod
def from_folders(cls, path, folderA, folderB, **kwargs):
itemsB = ImageList.from_folder(path/folderB).items
res = super().from_folder(path/folderA, itemsB=itemsB, **kwargs)
res.path = path
return res