运行我的代码时,我收到此错误消息“ RuntimeError:DataLoader worker (pid(s) 48817, 48818) 意外退出” 我完全不确定从哪里开始解决此问题。任何指导都将不胜感激。下面发布了代码和回溯
batch_size = 128
image_size = (64,64)
stats = (0.5, 0.5, 0.5), (0.5, 0.5, 0.5)
transform_ds = transforms.Compose([transforms.Resize(image_size),
# transforms.RandomCrop(32, padding=2),
# transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(*stats)
])
train_ds = facesDataset(csv_file = 'imagesdataset.csv', root_dir = 'images',
transform = transform_ds)
train_dl = DataLoader(train_ds, batch_size, shuffle=True, num_workers=3, pin_memory=True)
print(len(train_ds))
def denorm(img_tensors):
return img_tensors * stats[1][0] + stats[0][0]
def show_images(img, nmax=64):
fig, ax = plt.subplots(figsize=(8, 8))
ax.set_xticks([]); ax.set_yticks([])
ax.imshow(make_grid(denorm(img.detach()[:nmax]), nrow=8).permute(1, 2, 0))
def show_batch(dl, nmax=64):
for img, …Run Code Online (Sandbox Code Playgroud)