NJU-LHRS / official-CMID

The official implementation of paper "Unified Self-Supervised Learning Framework for Remote Sensing Images".
80 stars 5 forks source link

Change Detection中 utils 的 dataloaders.py的相关问题 #27

Closed Chenshuaiyu1120 closed 1 month ago

Chenshuaiyu1120 commented 1 month ago

您好作者,您在上述文件中出现如下错误:`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

` 在源代码的24行中"train "上多加了一个空格,需要删除

pUmpKin-Co commented 1 month ago

多谢指出!已改正!