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

Remove AugPipe #1978

Merged
merged 12 commits into from
Feb 8, 2025
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ repos:
- pillow>=10.4.0
- pytest>=6.1.2
- scikit-image>=0.22.0
- timm>=1.0.14
- torch>=2.6
- torchmetrics>=0.10
- torchvision>=0.18
Expand Down
1 change: 1 addition & 0 deletions docs/api/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ torchgeo.transforms
===================

.. automodule:: torchgeo.transforms
:exclude-members: AugmentationSequential
2 changes: 1 addition & 1 deletion tests/datamodules/test_fair1m.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_plot(self, datamodule: FAIR1MDataModule) -> None:
batch = next(iter(datamodule.val_dataloader()))
sample = {
'image': batch['image'][0],
'boxes': batch['boxes'][0],
'bbox_xyxy': batch['bbox_xyxy'][0],
'label': batch['label'][0],
}
datamodule.plot(sample)
Expand Down
6 changes: 3 additions & 3 deletions tests/datasets/test_fair1m.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def test_getitem(self, dataset: FAIR1M) -> None:
assert x['image'].shape[0] == 3

if dataset.split != 'test':
assert isinstance(x['boxes'], torch.Tensor)
assert isinstance(x['bbox_xyxy'], torch.Tensor)
assert isinstance(x['label'], torch.Tensor)
assert x['boxes'].shape[-2:] == (5, 2)
assert x['bbox_xyxy'].shape[-2:] == (5, 2)
assert x['label'].ndim == 1

def test_len(self, dataset: FAIR1M) -> None:
Expand Down Expand Up @@ -124,6 +124,6 @@ def test_plot(self, dataset: FAIR1M) -> None:
plt.close()

if dataset.split != 'test':
x['prediction_boxes'] = x['boxes'].clone()
x['prediction_bbox_xyxy'] = x['bbox_xyxy'].clone()
dataset.plot(x)
plt.close()
4 changes: 2 additions & 2 deletions tests/datasets/test_forestdamage.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_getitem(self, dataset: ForestDamage) -> None:
assert isinstance(x, dict)
assert isinstance(x['image'], torch.Tensor)
assert isinstance(x['label'], torch.Tensor)
assert isinstance(x['boxes'], torch.Tensor)
assert isinstance(x['bbox_xyxy'], torch.Tensor)
assert x['image'].shape[0] == 3
assert x['image'].ndim == 3

Expand Down Expand Up @@ -67,6 +67,6 @@ def test_plot(self, dataset: ForestDamage) -> None:

def test_plot_prediction(self, dataset: ForestDamage) -> None:
x = dataset[0].copy()
x['prediction_boxes'] = x['boxes'].clone()
x['prediction_bbox_xyxy'] = x['bbox_xyxy'].clone()
dataset.plot(x, suptitle='Prediction')
plt.close()
14 changes: 7 additions & 7 deletions tests/datasets/test_idtrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def test_getitem(self, dataset: IDTReeS) -> None:

if 'label' in x:
assert isinstance(x['label'], torch.Tensor)
if 'boxes' in x:
assert isinstance(x['boxes'], torch.Tensor)
if x['boxes'].ndim != 1:
assert x['boxes'].ndim == 2
assert x['boxes'].shape[-1] == 4
if 'bbox_xyxy' in x:
assert isinstance(x['bbox_xyxy'], torch.Tensor)
if x['bbox_xyxy'].ndim != 1:
assert x['bbox_xyxy'].ndim == 2
assert x['bbox_xyxy'].shape[-1] == 4

def test_len(self, dataset: IDTReeS) -> None:
assert len(dataset) == 3
Expand All @@ -87,8 +87,8 @@ def test_plot(self, dataset: IDTReeS) -> None:
dataset.plot(x, show_titles=False)
plt.close()

if 'boxes' in x:
x['prediction_boxes'] = x['boxes']
if 'bbox_xyxy' in x:
x['prediction_bbox_xyxy'] = x['bbox_xyxy']
dataset.plot(x, show_titles=True)
plt.close()
if 'label' in x:
Expand Down
6 changes: 3 additions & 3 deletions tests/datasets/test_nasa_marine_debris.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def test_getitem(self, dataset: NASAMarineDebris) -> None:
x = dataset[0]
assert isinstance(x, dict)
assert isinstance(x['image'], torch.Tensor)
assert isinstance(x['boxes'], torch.Tensor)
assert isinstance(x['bbox_xyxy'], torch.Tensor)
assert x['image'].shape[0] == 3
assert x['boxes'].shape[-1] == 4
assert x['bbox_xyxy'].shape[-1] == 4

def test_len(self, dataset: NASAMarineDebris) -> None:
assert len(dataset) == 5
Expand All @@ -50,6 +50,6 @@ def test_plot(self, dataset: NASAMarineDebris) -> None:
plt.close()
dataset.plot(x, show_titles=False)
plt.close()
x['prediction_boxes'] = x['boxes'].clone()
x['prediction_bbox_xyxy'] = x['bbox_xyxy'].clone()
dataset.plot(x)
plt.close()
2 changes: 1 addition & 1 deletion tests/datasets/test_pastis.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_getitem_instance(self, dataset: PASTIS) -> None:
assert isinstance(x, dict)
assert isinstance(x['image'], torch.Tensor)
assert isinstance(x['mask'], torch.Tensor)
assert isinstance(x['boxes'], torch.Tensor)
assert isinstance(x['bbox_xyxy'], torch.Tensor)
assert isinstance(x['label'], torch.Tensor)

def test_len(self, dataset: PASTIS) -> None:
Expand Down
6 changes: 3 additions & 3 deletions tests/datasets/test_reforestree.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def test_getitem(self, dataset: ReforesTree) -> None:
assert isinstance(x, dict)
assert isinstance(x['image'], torch.Tensor)
assert isinstance(x['label'], torch.Tensor)
assert isinstance(x['boxes'], torch.Tensor)
assert isinstance(x['bbox_xyxy'], torch.Tensor)
assert isinstance(x['agb'], torch.Tensor)
assert x['image'].shape[0] == 3
assert x['image'].ndim == 3
assert len(x['boxes']) == 2
assert len(x['bbox_xyxy']) == 2

def test_len(self, dataset: ReforesTree) -> None:
assert len(dataset) == 2
Expand All @@ -67,6 +67,6 @@ def test_plot(self, dataset: ReforesTree) -> None:

def test_plot_prediction(self, dataset: ReforesTree) -> None:
x = dataset[0].copy()
x['prediction_boxes'] = x['boxes'].clone()
x['prediction_bbox_xyxy'] = x['bbox_xyxy'].clone()
dataset.plot(x, suptitle='Prediction')
plt.close()
16 changes: 8 additions & 8 deletions tests/datasets/test_vhr10.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def test_getitem(self, dataset: VHR10) -> None:
assert isinstance(x, dict)
assert isinstance(x['image'], torch.Tensor)
if dataset.split == 'positive':
assert isinstance(x['labels'], torch.Tensor)
assert isinstance(x['boxes'], torch.Tensor)
if 'masks' in x:
assert isinstance(x['masks'], torch.Tensor)
assert isinstance(x['label'], torch.Tensor)
assert isinstance(x['bbox_xyxy'], torch.Tensor)
if 'mask' in x:
assert isinstance(x['mask'], torch.Tensor)

def test_len(self, dataset: VHR10) -> None:
if dataset.split == 'positive':
Expand Down Expand Up @@ -82,10 +82,10 @@ def test_plot(self, dataset: VHR10) -> None:
scores = [0.7, 0.3, 0.7]
for i in range(3):
x = dataset[i]
x['prediction_labels'] = x['labels']
x['prediction_boxes'] = x['boxes']
x['prediction_labels'] = x['label']
x['prediction_bbox_xyxy'] = x['bbox_xyxy']
x['prediction_scores'] = torch.Tensor([scores[i]])
if 'masks' in x:
x['prediction_masks'] = x['masks']
if 'mask' in x:
x['prediction_masks'] = x['mask']
dataset.plot(x, show_feats='masks')
plt.close()
6 changes: 3 additions & 3 deletions tests/datasets/test_zuericrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_getitem(self, dataset: ZueriCrop) -> None:
assert isinstance(x, dict)
assert isinstance(x['image'], torch.Tensor)
assert isinstance(x['mask'], torch.Tensor)
assert isinstance(x['boxes'], torch.Tensor)
assert isinstance(x['bbox_xyxy'], torch.Tensor)
assert isinstance(x['label'], torch.Tensor)

# Image tests
Expand All @@ -40,8 +40,8 @@ def test_getitem(self, dataset: ZueriCrop) -> None:
assert x['mask'].shape[-2:] == x['image'].shape[-2:]

# Bboxes tests
assert x['boxes'].ndim == 2
assert x['boxes'].shape[1] == 4
assert x['bbox_xyxy'].ndim == 2
assert x['bbox_xyxy'].shape[1] == 4

# Labels tests
assert x['label'].ndim == 1
Expand Down
Loading