Datasets:
train/test/val
How do i implement split functionality on a dataloader from this dataset
Hi Prateek,
All of the datasets in https://huggingface.co/datasets/torchgeo/ are intended for use with the TorchGeo library. You can use it like so:
from torchgeo.datasets import EuroSAT
train_dataset = EuroSAT('data', split='train', download=True)
val_dataset = EuroSAT('data', split='val', download=True)
test_dataset = EuroSAT('data', split='test', download=True)
See https://torchgeo.readthedocs.io/en/latest/api/datasets.html#eurosat for documentation.
Hello
@ajstewart
thank you for your response i have updated my dataloader but encountering a problem with this URL
https://datasets-server.huggingface.co/rows?dataset=torchgeo%2Feurosat&config=default&split=val&offset=0&length=100
Train and test URLS are working. Can you pls look into the issue
I don't know what this URL means, where you got it, or what it's supposed to do. It's possible this dataset does not conform to some standard expected by Hugging Face. This dataset was only ever intended for use with TorchGeo.
I got it from here https://huggingface.co/datasets/torchgeo/eurosat?viewer_api=true
actually i am trying to download the dataset in splits using these links in the dataloader in R.
download = function() {
if (file.exists(self$data_file)) {
message("Dataset already exists. Skipping download.")
return(invisible(NULL))
}
dir.create(self$root, recursive = TRUE, showWarnings = FALSE)
split_url <- sprintf(
"https://datasets-server.huggingface.co/rows?dataset=torchgeo%%2Feurosat&config=default&split=%s&offset=0&length=100",
self$split
)
utils::download.file(
split_url,
destfile = self$data_file,
mode = "wb"
)
}
Oh interesting. I'm not sure why "val" doesn't work, but it looks like "validation" does: https://datasets-server.huggingface.co/rows?dataset=torchgeo%2Feurosat&config=default&split=validation&offset=0&length=100
Refer to the API docs for more possible variants: https://huggingface.co/collections/datasets-examples/file-names-and-splits-655e28af4471bd95709eb135
Thanks a lot
@ajstewart
the dataloader is working now I can download all the splits . But i am facing one more issue , ERROR - The dataset API returned a value for row$image that is not a valid Base64-encoded string, and the decoding step failed. This issue likely arises from the structure or format of the dataset returned by the API
Because of this i can't access the image
ds <- eurosat_dataset(root = "./data/eurosat", split = "train", download = TRUE)
Dataset already exists. Skipping download.
sample <- ds[1]
Error in value[3L] :
Image decoding failed: I can only decode base64 strings
Called from: value[3L]
i think it due to the dataset being downloaded in the json format
i'll try to refer to the API doc you provided but it will be really helpful you can give me some insight on this issue.
Yes, I don't think JSON format makes sense for this dataset, you're better off actually downloading the data and loading the files yourself locally.