Thanks for helping! I had a quick question. Here’s what I’ve implemented:
__img_factory = {
    'market1501': Market1501,
    'cuhk03': CUHK03,                                                                                                                                                                                                                                                                                                                                    
}

def init_img_dataset(name, **kwargs):
    if name not in __img_factory.keys():
        raise KeyError("Invalid dataset, got '{}', but expected to be one of {}".format(name, __img_factory.keys()))
    return __img_factory[name](**kwargs)

class ImageDataset(Dataset):
    def __init__(self,dataset,transform=None):
        self.dataset = dataset
        self.transform = transform
    
    def __len__(self):
        return len(self.dataset)
    
    def __getitem__(self,index):
        img_path,pid,camid = self.dataset[index]
        img = read_image(img_path)
        if self.transform is not None:
            img = self.transform(img)
        return img,pid,camid

dataset = dataset_manager.init_img_dataset(
    root='data',name=dataset_name)
)

And my trainloader looks like this:
trainloader = DataLoader(
    ImageDataset(dataset.train,transform=tfms_train),
    sampler = RandomIdentitySampler(dataset.train,num_instances=num_instances),
    batch_size = train_batch,num_workers=workers,
    pin_memory=pin_memory,drop_last=True,
)

How can I adjust these in self.data in __init__ method ?