From ec72bfe39b88d9c46d484e5dc5b9a1706923721d Mon Sep 17 00:00:00 2001 From: Ashwin Nair Date: Thu, 21 Jul 2022 22:38:38 +0400 Subject: [PATCH] Fix coordinate swap bug in IDTReeS (#683) * Fix coordinate swap * Test coverage --- torchgeo/datasets/idtrees.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/torchgeo/datasets/idtrees.py b/torchgeo/datasets/idtrees.py index ac16cc9b43d..1aa815e99a2 100644 --- a/torchgeo/datasets/idtrees.py +++ b/torchgeo/datasets/idtrees.py @@ -289,10 +289,10 @@ def _load_boxes(self, path: str) -> Tensor: with rasterio.open(path) as f: for geom in geoms: coords = [f.index(x, y) for x, y in geom] - xmin = min(coord[0] for coord in coords) - xmax = max(coord[0] for coord in coords) - ymin = min(coord[1] for coord in coords) - ymax = max(coord[1] for coord in coords) + xmin = min(coord[1] for coord in coords) + xmax = max(coord[1] for coord in coords) + ymin = min(coord[0] for coord in coords) + ymax = max(coord[0] for coord in coords) boxes.append([xmin, ymin, xmax, ymax]) tensor = torch.tensor(boxes)