这是我的代码:
data_directory = Path('G:\Pneumonia\chest_xray\chest_xray')
train_directory = data_directory / 'train'
val_directory = data_directory / 'val'
test_directory = data_directory / 'test'
normal_cases_directory = train_directory / 'NORMAL'
pneumonia_cases_directory = train_directory / 'PNEUMONIA'
normal_cases = normal_cases_directory.glob('*.jpeg')
pneumonia_cases = pneumonia_cases_directory.glob('*.jpeg')
train_data = []
for images in normal_cases:
train_data.append((images, 0))
for images in pneumonia_cases:
train_data.append((images, 1))
train_data = pd.DataFrame(train_data, columns=['image', 'label'],index=None)
这是输出:OSError: [WinError 123] 文件名、目录名或卷标语法不正确:'\u202aG:\Pneumonia\chest_xray\chest_xray\train\NORMAL'。
我在开头注意到了 \u202a 符号,但我不知道如何修复它。