
    Yh
                     j    d dl Z d dlmZ d dlmZmZmZmZ ddlm	Z	m
Z
 ddlmZ  G d de
          ZdS )	    N)Path)AnyCallableOptionalUnion   )default_loaderImageFolder)download_and_extract_archivec                        e Zd ZdZdddefdeeef         dee	         dee	         de
de	egef         d	df fd
Zd	efdZd	e
fdZddZ xZS )EuroSATal  RGB version of the `EuroSAT <https://github.com/phelber/eurosat>`_ Dataset.

    For the MS version of the dataset, see
    `TorchGeo <https://torchgeo.readthedocs.io/en/stable/api/datasets.html#eurosat>`__.

    Args:
        root (str or ``pathlib.Path``): Root directory of dataset where ``root/eurosat`` exists.
        transform (callable, optional): A function/transform that takes in a PIL image or torch.Tensor, depends on the given loader,
            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.
        loader (callable, optional): A function to load an image given its path.
            By default, it uses PIL as its image loader, but users could also pass in
            ``torchvision.io.decode_image`` for decoding image data into tensors directly.
    NFroot	transformtarget_transformdownloadloaderreturnc                    t           j                            |          | _        t           j                            | j        d          | _        t           j                            | j        d          | _        |r|                                  |                                 st          d          t                                          | j        |||           t           j                            |          | _        d S )Neurosat2750z;Dataset not found. You can use download=True to download it)r   r   r   )ospath
expanduserr   join_base_folder_data_folderr   _check_existsRuntimeErrorsuper__init__)selfr   r   r   r   r   	__class__s         n/var/www/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/torchvision/datasets/eurosat.pyr    zEuroSAT.__init__   s     G&&t,,	GLLI>>GLL):FCC 	MMOOO!!## 	^\]]]-	 	 	
 	
 	
 G&&t,,			    c                 *    t          | j                  S N)lensamplesr!   s    r#   __len__zEuroSAT.__len__7   s    4<   r$   c                 J    t           j                            | j                  S r&   )r   r   existsr   r)   s    r#   r   zEuroSAT._check_exists:   s    w~~d/000r$   c                     |                                  rd S t          j        | j        d           t	          d| j        d           d S )NT)exist_okzmhttps://huggingface.co/datasets/torchgeo/eurosat/resolve/c877bcd43f099cd0196738f714544e355477f3fd/EuroSAT.zip c8fa014336c82ac7804f0398fcb19387)download_rootmd5)r   r   makedirsr   r   r)   s    r#   r   zEuroSAT.download=   s`     	F
D%5555${+2	
 	
 	
 	
 	
 	
r$   )r   N)__name__
__module____qualname____doc__r	   r   strr   r   r   boolr   r    intr*   r   r   __classcell__)r"   s   @r#   r   r   	   s         , )-/3'5- -CI- H%- #8,	-
 - #$- 
- - - - - -4! ! ! ! !1t 1 1 1 1

 

 

 

 

 

 

 

r$   r   )r   pathlibr   typingr   r   r   r   folderr	   r
   utilsr   r    r$   r#   <module>r@      s    				       1 1 1 1 1 1 1 1 1 1 1 1 / / / / / / / / / / / / / />
 >
 >
 >
 >
k >
 >
 >
 >
 >
r$   