您好作者,您在上述文件中出现如下错误:`def full_path_loader(data_dir):
data_dir = Path(data_dir)
train_data = [i for i in os.listdir(data_dir / "train" / "A") if not
i.startswith('.')]
train_data.sort()
valid_data = [i for i in os.listdir(data_dir / "val" / "A") if not
i.startswith('.')]
valid_data.sort()
train_label_paths = []
val_label_paths = []
for img in train_data:
train_label_paths.append(data_dir / "train " / "OUT" / img)
for img in valid_data:
val_label_paths.append(data_dir / 'val' / 'OUT' / img)
train_data_path = []
val_data_path = []
for img in train_data:
train_data_path.append([data_dir / 'train', img])
for img in valid_data:
val_data_path.append([data_dir / 'val', img])
train_dataset = {}
val_dataset = {}
for cp in range(len(train_data)):
train_dataset[cp] = {'image': train_data_path[cp],
'label': train_label_paths[cp]}
for cp in range(len(valid_data)):
val_dataset[cp] = {'image': val_data_path[cp],
'label': val_label_paths[cp]}
return train_dataset, val_dataset
您好作者,您在上述文件中出现如下错误:`def full_path_loader(data_dir): data_dir = Path(data_dir) train_data = [i for i in os.listdir(data_dir / "train" / "A") if not i.startswith('.')] train_data.sort()
` 在源代码的24行中"train "上多加了一个空格,需要删除