@ptrblck I changed to the ImageFolder class and there is no problem! Therefore, I am sure that my ImageFolderSuperpixel class have some problems that I cannot find it.
The example to use this API, the main purpose for this API is to load two image folder at same time (ImageFolder only support loading one image dir):
dataset_path = './data/imagenet'
traindir = os.path.join(dataset_path, 'train')
traindir_sp = os.path.join(dataset_path, 'train')
train_dataset = ImageFolderSuperpixel(
    traindir,
    traindir_sp,
    transforms.Compose([
        transforms.RandomResizedCrop(224),
        transforms.RandomHorizontalFlip(),
        transforms.ToTensor(),
    ]))

train_loader = torch.utils.data.DataLoader(
    train_dataset, batch_size=1, shuffle=False,
    num_workers=1, pin_memory=True, sampler=None)

for i, (images, target, images_sp, _) in enumerate(train_loader):