Datasets:

Modalities:
Image
Formats:
parquet
Languages:
English
ArXiv:
Libraries:
Datasets
pandas
eurosat / eurosat.py
tanganke's picture
Upload folder using huggingface_hub
6ed8dec verified
raw
history blame
1.84 kB
import datasets
from datasets.data_files import DataFilesDict
from datasets.packaged_modules.imagefolder.imagefolder import ImageFolder, ImageFolderConfig
logger = datasets.logging.get_logger(__name__)
class EuroSAT(ImageFolder):
R"""
EuroSAT dataset for image classification.
"""
BUILDER_CONFIG_CLASS = ImageFolderConfig
BUILDER_CONFIGS = [
ImageFolderConfig(
name="default",
features=("images", "labels"),
data_files=DataFilesDict(
{
split: f"data/{split}.zip"
for split in ["train", "test"]
+ ["contrast", "gaussian_noise", "impulse_noise", "jpeg_compression", "motion_blur", "pixelate", "spatter"]
}
),
)
]
classnames = [
"annual crop land",
"forest",
"brushland or shrubland",
"highway or road",
"industrial buildings or commercial buildings",
"pasture land",
"permanent crop land",
"residential buildings or homes or apartments",
"river",
"lake or sea",
]
clip_templates = [
lambda c: f"a centered satellite photo of {c}.",
lambda c: f"a centered satellite photo of a {c}.",
lambda c: f"a centered satellite photo of the {c}.",
]
def _info(self):
return datasets.DatasetInfo(
description="EuroSAT dataset for image classification.",
features=datasets.Features(
{
"image": datasets.Image(),
"label": datasets.ClassLabel(names=self.classnames),
}
),
supervised_keys=("image", "label"),
task_templates=[datasets.ImageClassification(image_column="image", label_column="label")],
)