MixMatch-pytorch icon indicating copy to clipboard operation
MixMatch-pytorch copied to clipboard

How to apply it to my own dataset?

Open ghost opened this issue 4 years ago • 3 comments

I tried to apply it to my own dataset, but it didn't work because unmarked data had to be enhanced twice. Thank you very much for who can help me

ghost avatar Nov 06 '20 06:11 ghost

what is your problem? I suggest write your own dataset class to read your images. Here is the dataset class read images from a path

class YourDatasetName(Dataset):
    def __init__(self, root_dir, transform=None):
        self.root_dir = root_dir
        self.transform = transform
        self.image_lists = os.listdir(root_dir)

    def __len__(self):
        return len(self.image_lists)

    def __getitem__(self, item):
        image_path = os.path.join(self.root_dir, self.image_lists[item])
        image = Image.open(image_path)
        image = image.convert('RGB')
        if self.transform:
            img_tensor_1 = self.transform(image)
            img_tensor_2 = self.transform(image)
        return img_tensor_1, img_tensor_2

sakumashirayuki avatar Dec 01 '20 02:12 sakumashirayuki

Thank you for your help. Under your inspiration, I solved this problem. Thank you very much

ghost avatar Dec 09 '20 13:12 ghost

@sakumashirayuki Have you tried training in a multi gpu setting with DP/DDP?

thiyagu145 avatar Sep 02 '21 18:09 thiyagu145