Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename bbox -> bounds #2199

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/datamodules/test_geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(

def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
image = torch.arange(3 * 2 * 2).view(3, 2, 2)
return {'image': image, 'crs': CRS.from_epsg(4326), 'bbox': query}
return {'image': image, 'crs': CRS.from_epsg(4326), 'bounds': query}

def plot(self, *args: Any, **kwargs: Any) -> Figure:
return plt.figure()
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datamodules/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def transfer_batch_to_device(
"""
# Non-Tensor values cannot be moved to a device
del batch['crs']
del batch['bbox']
del batch['bounds']

batch = super().transfer_batch_to_device(batch, device, dataloader_idx)
return batch
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datasets/agrifieldnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:

sample = {
'crs': self.crs,
'bbox': query,
'bounds': query,
'image': image.float(),
'mask': mask.long(),
}
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datasets/chesapeake.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
hits = self.index.intersection(tuple(query), objects=True)
filepaths = cast(list[dict[str, str]], [hit.object for hit in hits])

sample = {'image': [], 'mask': [], 'crs': self.crs, 'bbox': query}
sample = {'image': [], 'mask': [], 'crs': self.crs, 'bounds': query}

if len(filepaths) == 0:
raise IndexError(
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datasets/eddmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
f'query: {query} not found in index with bounds: {self.bounds}'
)

sample = {'crs': self.crs, 'bbox': bboxes}
sample = {'crs': self.crs, 'bounds': bboxes}

return sample
2 changes: 1 addition & 1 deletion torchgeo/datasets/enviroatlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
hits = self.index.intersection(tuple(query), objects=True)
filepaths = cast(list[dict[str, str]], [hit.object for hit in hits])

sample = {'image': [], 'mask': [], 'crs': self.crs, 'bbox': query}
sample = {'image': [], 'mask': [], 'crs': self.crs, 'bounds': query}

if len(filepaths) == 0:
raise IndexError(
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datasets/gbif.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
f'query: {query} not found in index with bounds: {self.bounds}'
)

sample = {'crs': self.crs, 'bbox': bboxes}
sample = {'crs': self.crs, 'bounds': bboxes}

return sample
4 changes: 2 additions & 2 deletions torchgeo/datasets/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
else:
data = self._merge_files(filepaths, query, self.band_indexes)

sample = {'crs': self.crs, 'bbox': query}
sample = {'crs': self.crs, 'bounds': query}

data = data.to(self.dtype)
if self.is_image:
Expand Down Expand Up @@ -776,7 +776,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
masks = array_to_tensor(masks)

masks = masks.to(self.dtype)
sample = {'mask': masks, 'crs': self.crs, 'bbox': query}
sample = {'mask': masks, 'crs': self.crs, 'bounds': query}

if self.transforms is not None:
sample = self.transforms(sample)
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datasets/globbiomass.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:

mask = torch.cat((mask, std_err_mask), dim=0)

sample = {'mask': mask, 'crs': self.crs, 'bbox': query}
sample = {'mask': mask, 'crs': self.crs, 'bounds': query}

if self.transforms is not None:
sample = self.transforms(sample)
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datasets/inaturalist.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
f'query: {query} not found in index with bounds: {self.bounds}'
)

sample = {'crs': self.crs, 'bbox': bboxes}
sample = {'crs': self.crs, 'bounds': bboxes}

return sample
2 changes: 1 addition & 1 deletion torchgeo/datasets/landcoverai.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
mask = self._merge_files(mask_filepaths, query, self.band_indexes)
sample = {
'crs': self.crs,
'bbox': query,
'bounds': query,
'image': img.float(),
'mask': mask.long(),
}
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datasets/openbuildings.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:
else:
masks = torch.zeros(size=(1, round(height), round(width)))

sample = {'mask': masks, 'crs': self.crs, 'bbox': query}
sample = {'mask': masks, 'crs': self.crs, 'bounds': query}

if self.transforms is not None:
sample = self.transforms(sample)
Expand Down
2 changes: 1 addition & 1 deletion torchgeo/datasets/south_africa_crop_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def __getitem__(self, query: BoundingBox) -> dict[str, Any]:

sample = {
'crs': self.crs,
'bbox': query,
'bounds': query,
'image': image.float(),
'mask': mask.long(),
}
Expand Down
Loading