Skip to content

Commit

Permalink
ETCI2021: fix file list when 'vv' in directory name (#2532)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart authored Jan 24, 2025
1 parent ada5122 commit 171b498
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions torchgeo/datasets/etci2021.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,15 @@ def _load_files(self, root: Path, split: str) -> list[dict[str, str]]:
folders = [os.path.join(folder, 'tiles') for folder in folders]
for folder in folders:
vvs = sorted(glob.glob(os.path.join(folder, 'vv', '*.png')))
vhs = [vv.replace('vv', 'vh') for vv in vvs]
water_masks = [
vv.replace('_vv.png', '.png').replace('vv', 'water_body_label')
for vv in vvs
]
vhs = sorted(glob.glob(os.path.join(folder, 'vh', '*.png')))
water_masks = sorted(
glob.glob(os.path.join(folder, 'water_body_label', '*.png'))
)

if split != 'test':
flood_masks = [
vv.replace('_vv.png', '.png').replace('vv', 'flood_label')
for vv in vvs
]
flood_masks = sorted(
glob.glob(os.path.join(folder, 'flood_label', '*.png'))
)

for vv, vh, flood_mask, water_mask in zip(
vvs, vhs, flood_masks, water_masks
Expand Down

0 comments on commit 171b498

Please sign in to comment.