Skip to content

Commit

Permalink
Add metadata dict
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Feb 19, 2025
1 parent b03aabe commit 441c3d4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions torchgeo/datasets/hyspecnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ def __getitem__(self, index: int) -> dict[str, Tensor]:
miny, maxy = src.bounds.bottom, src.bounds.top
sample = {
'image': torch.tensor(src.read(self.band_indices).astype('float32')),
'x': torch.tensor((minx + maxx) / 2),
'y': torch.tensor((miny + maxy) / 2),
't': torch.tensor((mint + maxt) / 2),
'wavelength': self.wavelengths,
'res': torch.tensor(30),
'metadata': {
'x': torch.tensor((minx + maxx) / 2),
'y': torch.tensor((miny + maxy) / 2),
't': torch.tensor((mint + maxt) / 2),
'wavelength': self.wavelengths,
'res': torch.tensor(30),
},
}

if self.transforms is not None:
Expand Down

0 comments on commit 441c3d4

Please sign in to comment.