[docs]classEuroSAT(ImageFolder):"""RGB version of the `EuroSAT <https://github.com/phelber/eurosat>`_ Dataset. Args: root (string): Root directory of dataset where ``root/eurosat`` exists. transform (callable, optional): A function/transform that takes in an PIL image and returns a transformed version. E.g, ``transforms.RandomCrop`` target_transform (callable, optional): A function/transform that takes in the target and transforms it. download (bool, optional): If True, downloads the dataset from the internet and puts it in root directory. If dataset is already downloaded, it is not downloaded again. Default is False. """def__init__(self,root:str,transform:Optional[Callable]=None,target_transform:Optional[Callable]=None,download:bool=False,)->None:self.root=os.path.expanduser(root)self._base_folder=os.path.join(self.root,"eurosat")self._data_folder=os.path.join(self._base_folder,"2750")ifdownload:self.download()ifnotself._check_exists():raiseRuntimeError("Dataset not found. You can use download=True to download it")super().__init__(self._data_folder,transform=transform,target_transform=target_transform)self.root=os.path.expanduser(root)def__len__(self)->int:returnlen(self.samples)def_check_exists(self)->bool:returnos.path.exists(self._data_folder)defdownload(self)->None:ifself._check_exists():returnos.makedirs(self._base_folder,exist_ok=True)download_and_extract_archive("https://madm.dfki.de/files/sentinel/EuroSAT.zip",download_root=self._base_folder,md5="c8fa014336c82ac7804f0398fcb19387",)
Docs
Access comprehensive developer documentation for PyTorch
To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.