Now, I have the following draft code for loading VOC2007 dataset.
However, this is only for image itself, what about labels for classification purpose ?
Could anyone advise how to load both images and the corresponding labels correctly ?
        #os.system("mkdir -p /home/rog/Downloads/AdderNetCuda/dataset/voc2007")
        #os.system("cd /home/rog/Downloads/AdderNetCuda/dataset/voc2007")
        
        #os.system("wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar")
        #os.system("wget http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar")

        os.system("mkdir -p /home/rog/Downloads/AdderNetCuda/dataset/voc2007/test")
        os.system("mkdir -p /home/rog/Downloads/AdderNetCuda/dataset/voc2007/train")

        os.system("tar -C /home/rog/Downloads/AdderNetCuda/dataset/voc2007/test -xf VOCtest_06-Nov-2007.tar")
        os.system("tar -C /home/rog/Downloads/AdderNetCuda/dataset/voc2007/train -xf VOCtrainval_06-Nov-2007.tar")
    
        train_dataset = datasets.ImageFolder(
            root="/home/rog/Downloads/AdderNetCuda/dataset/voc2007/train/VOCdevkit/VOC2007/JPEGImages", #args.data_dir, 
            transform=transforms.Compose([
                transforms.RandomHorizontalFlip(),
                #transforms.Resize(224),
                transforms.ToTensor(),
                transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                         std=[0.229, 0.224, 0.225])
            ]))
        val_dataset = datasets.ImageFolder(
            root="/home/rog/Downloads/AdderNetCuda/dataset/voc2007/test/VOCdevkit/VOC2007/JPEGImages", #args.data_dir, 
            transform=transforms.Compose([
                #transforms.Resize(224),
                transforms.ToTensor(),
                transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                         std=[0.229, 0.224, 0.225])
            ]))        

    train_loader = torch.utils.data.DataLoader(train_dataset,
        batch_size=args.batch_size, shuffle=False,num_workers=args.workers, pin_memory=True)
    val_loader = torch.utils.data.DataLoader(val_dataset,
        batch_size=args.batch_size, shuffle=False, num_workers=args.workers, pin_memory=True)