ids_train = [ image_name for image_name in os.listdir(train_path) if is_image_file(image_name) ] # ids_train = [image_name for image_name in os.listdir(os.path.join(data_path, "train_test", "Sat")) if is_image_file(image_name)] ids_val = [ image_name for image_name in os.listdir(val_path) if is_image_file(image_name) ] ids_test = [ image_name for image_name in os.listdir(val_path) if is_image_file(image_name) ] device = torch.device("cuda" if torch.cuda.is_available() else "cpu") dataset_train = DeepGlobe(train_path, ids_train, label=True, transform=True) dataloader_train = torch.utils.data.DataLoader(dataset=dataset_train, batch_size=batch_size, num_workers=10, collate_fn=collate, shuffle=True, pin_memory=True) dataset_val = DeepGlobe(val_path, ids_val, label=True) dataloader_val = torch.utils.data.DataLoader(dataset=dataset_val, batch_size=batch_size, num_workers=10, collate_fn=collate, shuffle=False, pin_memory=True) dataset_test = DeepGlobe(test_path, ids_test, label=False)
] # ids_train = [image_name for image_name in os.listdir(os.path.join(data_path, "train_test", "Sat")) if is_image_file(image_name)] ids_val = [ image_name for image_name in os.listdir(os.path.join(data_path, "crossvali", "Sat")) if is_image_file(image_name) ] ids_test = [ image_name for image_name in os.listdir( os.path.join(data_path, "official_crossvali", "Sat")) if is_image_file(image_name) ] device = torch.device("cuda" if torch.cuda.is_available() else "cpu") dataset_train = DeepGlobe(os.path.join(data_path, "train"), ids_train, label=True, transform=True) dataloader_train = torch.utils.data.DataLoader( dataset=dataset_train, batch_size=batch_size, num_workers=args.num_workers, collate_fn=collate, shuffle=True, pin_memory=True, ) dataset_val = DeepGlobe(os.path.join(data_path, "crossvali"), ids_val, label=True) dataloader_val = torch.utils.data.DataLoader( dataset=dataset_val, batch_size=batch_size,
# device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # dataset_train = DeepGlobe(os.path.join(data_path, "train"), ids_train, label=True, transform=True) # dataloader_train = torch.utils.data.DataLoader(dataset=dataset_train, batch_size=batch_size, num_workers=10, collate_fn=collate, shuffle=True, pin_memory=True) # dataset_val = DeepGlobe(os.path.join(data_path, "crossvali"), ids_val, label=True) # dataloader_val = torch.utils.data.DataLoader(dataset=dataset_val, batch_size=batch_size, num_workers=10, collate_fn=collate, shuffle=False, pin_memory=True) # dataset_test = DeepGlobe(os.path.join(data_path, "offical_crossvali"), ids_test, label=False) # dataloader_test = torch.utils.data.DataLoader(dataset=dataset_test, batch_size=batch_size, num_workers=10, collate_fn=collate_test, shuffle=False, pin_memory=True) # ids_train = [image_name for image_name in os.listdir(os.path.join(data_path, "train", "Sat")) if is_image_file(image_name)] # ids_val = [image_name for image_name in os.listdir(os.path.join(data_path, "crossvali", "Sat")) if is_image_file(image_name)] # ids_test = [image_name for image_name in os.listdir(os.path.join(data_path, "offical_crossvali", "Sat")) if is_image_file(image_name)] device = torch.device("cuda" if torch.cuda.is_available() else "cpu") dataset_train = DeepGlobe(os.path.join(data_path), split='train', label=True, transform=True) dataloader_train = torch.utils.data.DataLoader(dataset=dataset_train, batch_size=batch_size, num_workers=0, collate_fn=collate, shuffle=True, pin_memory=True) dataset_val = DeepGlobe(os.path.join(data_path), split='crossvali', label=True) dataloader_val = torch.utils.data.DataLoader(dataset=dataset_val, batch_size=batch_size, num_workers=0, collate_fn=collate, shuffle=False, pin_memory=True) # dataset_test = DeepGlobe(os.path.join(data_path, "offical_crossvali"), ids_test, label=False)