Something wrong when I use the Dataloader
The phrase which pre_proceed the dataset
class data_test(Dataset):
def __init__(self,data_root,transform=None):
    data_image=glob.glob(data_root+'/*.jpg')

    self.data_image=data_image
    self.transform=transform

def __getitem__(self, index):
    data_image_path=self.data_image[index]

    image_data=cv2.imread(data_image_path,-1) # unchanged
    if self.transform:
        image_data=self.transform(image_data)

    return image_data

The above operation is ordinary, but when I load the dataset,
`dataset=data_test(train_dataset,transforms)
data=DataLoader(dataset,batch_size=8,num_workers=0)
for idx,data in enumerate(data):
    print(data.shape)`

an error occur,


The error is actually pretty specific on the error, the error that was raised is NotImplementedError. You are supposed to implement the __len__ function in your custom dataset.
In your case that would be as simple as (assuming self.data_image contains all your dataset instances) adding this function to the data_test class:
    def __len__(self):
        return len(self.data_image)

