jakartaresearch / earth-vision

Jakarta Research Earth Observatory - Library
https://jakartaresearch.github.io/earth-vision
MIT License
41 stars 11 forks source link

Suggestion for datasets `__getitem__` image dimensions #90

Open otivedani opened 3 years ago

otivedani commented 3 years ago

Description

the dataset are returning dimensions of (W, H, C) by default, for example on AerialCactus:

from earthvision.datasets import AerialCactus
aci_dataset = AerialCactus('./')
print (aci_dataset[0][0].shape)  # torch.Size([40, 40, 3])

aci_dloader = DataLoader(aci_dataset, batch_size=1)
conv0 = Conv2d(3,128,3)

for i, dl in enumerate(aci_dloader):
  conv0(dl[0])
  if i>=0: break

this raises errors when forwarded to layer since the in_dimension of conv2d did not match : image

Expected behavior

the dataset __getitem__ are returning tensor with shape (C, W, H)

print (aci_dataset[0][0].shape)  # torch.Size([3, 40, 40])

this does not raise error.

Environment

Google Colab Notebook

Additional context

while it could be fixed by passing transforms.ToTensor() as the last transform, may I know if this was intentional?