o
    ôj„	  ã                   @   sP   d dl mZ d dlmZmZmZ ddlmZ ddlm	Z	m
Z
 G dd„ deƒZdS )	é    )ÚPath)ÚCallableÚOptionalÚUnioné   )ÚImageFolder)Údownload_and_extract_archiveÚverify_str_argc                       st   e Zd ZdZdZdZ				ddeeef ded	e	e
 d
e	e
 deddf‡ fdd„Zdefdd„Zddd„Z‡  ZS )Ú
Country211a  `The Country211 Data Set <https://github.com/openai/CLIP/blob/main/data/country211.md>`_ from OpenAI.

    This dataset was built by filtering the images from the YFCC100m dataset
    that have GPS coordinate corresponding to a ISO-3166 country code. The
    dataset is balanced by sampling 150 train images, 50 validation images, and
    100 test images for each country.

    Args:
        root (str or ``pathlib.Path``): Root directory of the dataset.
        split (string, optional): The dataset split, supports ``"train"`` (default), ``"valid"`` and ``"test"``.
        transform (callable, optional): A function/transform that takes in a 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 into
            ``root/country211/``. If dataset is already downloaded, it is not downloaded again.
    z;https://openaipublic.azureedge.net/clip/data/country211.tgzZ 84988d7644798601126c29e9877aab6aÚtrainNFÚrootÚsplitÚ	transformÚtarget_transformÚdownloadÚreturnc                    sv   t |ddƒ| _t|ƒ ¡ }t|ƒ| _|d | _|r|  ¡  |  ¡ s%t	dƒ‚t
ƒ jt| j| j ƒ||d� t|ƒ| _d S )Nr   )r   ÚvalidÚtestÚ
country211z;Dataset not found. You can use download=True to download it)r   r   )r	   Ú_splitr   Ú
expanduserÚstrr   Ú_base_folderÚ	_downloadÚ_check_existsÚRuntimeErrorÚsuperÚ__init__)Úselfr   r   r   r   r   ©Ú	__class__© úp/var/www/html/academy/tools/voices/clone/sv-venv/lib/python3.10/site-packages/torchvision/datasets/country211.pyr      s   

zCountry211.__init__c                 C   s   | j  ¡ o	| j  ¡ S )N)r   ÚexistsÚis_dir©r   r!   r!   r"   r   4   s   zCountry211._check_existsc                 C   s$   |   ¡ rd S t| j| j| jd� d S )N)Údownload_rootÚmd5)r   r   Ú_URLr   Ú_MD5r%   r!   r!   r"   r   7   s   zCountry211._download)r   NNF)r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r(   r)   r   r   r   r   r   Úboolr   r   r   Ú__classcell__r!   r!   r   r"   r
      s.    ú
þýüûúùr
   N)Úpathlibr   Útypingr   r   r   Úfolderr   Úutilsr   r	   r
   r!   r!   r!   r"   Ú<module>   s
    