torchgeo icon indicating copy to clipboard operation
torchgeo copied to clipboard

Eurosat No such file or directory: 'data/eurosat-train.txt'

Open robmarkcole opened this issue 8 months ago • 6 comments

Description

With download=True this should be downloaded..?

Steps to reproduce

from torchgeo.datasets import EuroSAT

>>> ds = EuroSAT(root="data", download=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/teamspace/studios/this_studio/torchgeo/torchgeo/datasets/eurosat.py", line 144, in __init__
    with open(os.path.join(self.root, self.split_filenames[split])) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'data/eurosat-train.txt'

Version

0.8.0.dev0

robmarkcole avatar Apr 23 '25 11:04 robmarkcole

It's possible you downloaded val/test before downloading train and it only downloaded eurosat-val.txt? Either way we should fix this.

adamjstewart avatar Apr 23 '25 11:04 adamjstewart

Right run this in a fresh studio and no issue, possibly the error arose since in my earlier studio I had already used EuroSAT100DataModule..?

robmarkcole avatar Apr 23 '25 12:04 robmarkcole

OK I can get a similar error with Eurosat100 if I first use regular eurosat:

FileNotFoundError: [Errno 2] No such file or directory: 'data/eurosat-100-train.txt'

robmarkcole avatar Apr 23 '25 12:04 robmarkcole

Ah, that would do it. You could use a unique path for your dataset, but we could also fix this to check for the split file download name.

adamjstewart avatar Apr 23 '25 12:04 adamjstewart

I would actually expect that with root="data" there would be a generated folder structure of something like data/eurosat100/files

robmarkcole avatar Apr 23 '25 12:04 robmarkcole

That's how torchvision works. That's explicitly not how TorchGeo works, because I didn't want people who use root='data/eurosat100' to find that nothing works correctly because they were too specific.

adamjstewart avatar Apr 23 '25 13:04 adamjstewart