diff --git a/torchgeo/datasets/xview.py b/torchgeo/datasets/xview.py index 55eaa6735c8..82bacc2be19 100644 --- a/torchgeo/datasets/xview.py +++ b/torchgeo/datasets/xview.py @@ -148,7 +148,7 @@ def _load_files(self, root: str, split: str) -> list[dict[str, str]]: images = glob.glob(os.path.join(image_root, "*.png")) basenames = [os.path.basename(f) for f in images] basenames = ["_".join(f.split("_")[:-2]) for f in basenames] - for name in set(basenames): + for name in sorted(set(basenames)): image1 = os.path.join(image_root, f"{name}_pre_disaster.png") image2 = os.path.join(image_root, f"{name}_post_disaster.png") mask1 = os.path.join(mask_root, f"{name}_pre_disaster_target.png")