Hi all, I have the following code to prepare triplet images and labels of tiny image net dataset
   kwargs = {'num_workers': 0, 'pin_memory': True} if args.no_cuda else {}

    transform = transforms.Compose([transforms.RandomSizedCrop(224),
                                    transforms.RandomHorizontalFlip(),
                                    transforms.ToTensor(),
                                    transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))])
    
    imagenet_traindata = datasets.ImageFolder('./tiny-imagenet-200/train', transform=transform)
    triplet_train_dataset = ImageNet_t(imagenet_traindata,'./tiny-imagenet-200')
    train_set = torch.utils.data.DataLoader(triplet_train_dataset, batch_size=args.train_batch_size, shuffle=True, **kwargs)
    
    imagenet_testdata = datasets.ImageFolder('./tiny-imagenet-200/test', transform=transform)
    triplet_test_dataset = ImageNet_t(imagenet_testdata,'./tiny-imagenet-200')
    test_set = torch.utils.data.DataLoader(triplet_test_dataset, batch_size=args.test_batch_size, shuffle=False, **kwargs)

where ImageNet_t is as
lass ImageNet_t(Dataset):
    
    raw_folder = 'raw'
    processed_folder = 'processed'
    training_file = 'training.pt'
    test_file = 'test.pt'
    train_triplet_file = 'train_triplets.txt'
    test_triplet_file = 'test_triplets.txt'

    def __init__(self, root, ImageNet_dataset, n_train_triplets=2000, n_test_triplets=700, train=True, transform=None):
        self.ImageNet_dataset = ImageNet_dataset
        self.train = train
        self.transform = transform        
        self.root = root
        self.count_n_train_triplets=0
        self.count_n_test_triplets=0

        if self.train:
            print("train")
            self.train_data=self.ImageNet_dataset.image
            self.train_labels=self.ImageNet_dataset.target
            self.make_triplet_list(n_train_triplets)
            triplets = []
            for line in open(os.path.join(root, self.processed_folder, self.train_triplet_file)):
                if self.count_n_train_triplets==n_train_triplets:
                    break
                elif not (line.split()==[]):
                    triplets.append((int(line.split()[0]), int(line.split()[1]), int(line.split()[2]))) # anchor, close, far
                    self.count_n_train_triplets+=1
                else:
                    continue
                    
            self.triplets_train = triplets
.
.
.

in lines
self.train_data=self.ImageNet_dataset.image
self.train_labels=self.ImageNet_dataset.target
I need to obtain the image and its label, but the below error has occurred.
'str' object has no attribute 'image'

how can I do that?
any help would be appreciated.