ó
    Eñi1  ã                   ón   • S SK r S SKJr  S SKJrJrJrJr  SSKJ	r	  SSK
JrJr  SSKJr   " S S	\5      rg)
é    N)ÚPath)ÚAnyÚCallableÚOptionalÚUnioné   )Údefault_loader)Údownload_and_extract_archiveÚverify_str_arg)ÚVisionDatasetc                   óÞ   ^ • \ rS rSrSrSrSrSSSS\4S\\	\
4   S	\	S
\\   S\\   S\S\\\	\
4   /\4   SS4U 4S jjjrS\4S jrS\S\\\4   4S jrS\	4S jrS\4S jrSS jrSrU =r$ )ÚFood101é   a£  `The Food-101 Data Set <https://data.vision.ee.ethz.ch/cvl/datasets_extra/food-101/>`_.

The Food-101 is a challenging data set of 101 food categories with 101,000 images.
For each class, 250 manually reviewed test images are provided as well as 750 training images.
On purpose, the training images were not cleaned, and thus still contain some amount of noise.
This comes mostly in the form of intense colors and sometimes wrong labels. All images were
rescaled to have a maximum side length of 512 pixels.


Args:
    root (str or ``pathlib.Path``): Root directory of the dataset.
    split (string, optional): The dataset split, supports ``"train"`` (default) and ``"test"``.
    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.
z1http://data.vision.ee.ethz.ch/cvl/food-101.tar.gzÚ 85eeb15f3717b99a5da872d97d918f87ÚtrainNFÚrootÚsplitÚ	transformÚtarget_transformÚdownloadÚloaderÚreturnc                 ó  >• [         TU ]  XUS9  [        USS5      U l        [	        U R
                  5      S-  U l        U R                  S-  U l        U R                  S-  U l        U(       a  U R                  5         U R                  5       (       d  [        S5      e/ U l        / U l        [        U R                  U S3-  5       n[        R                   " UR#                  5       5      nS S S 5        [%        WR'                  5       5      U l        [+        [-        U R(                  [/        [1        U R(                  5      5      5      5      U l        UR5                  5        H‚  u  pšU =R                  U R2                  U	   /[1        U
5      -  -  sl        U =R                  U
 Vs/ s H-  o°R                  R6                  " U S	3R9                  S
5      6 PM/     sn-  sl        M„     X`l        g ! , (       d  f       GN
= fs  snf )N)r   r   r   )r   Útestzfood-101ÚmetaÚimagesz;Dataset not found. You can use download=True to download itz.jsonz.jpgÚ/)ÚsuperÚ__init__r   Ú_splitr   r   Ú_base_folderÚ_meta_folderÚ_images_folderÚ	_downloadÚ_check_existsÚRuntimeErrorÚ_labelsÚ_image_filesÚopenÚjsonÚloadsÚreadÚsortedÚkeysÚclassesÚdictÚzipÚrangeÚlenÚclass_to_idxÚitemsÚjoinpathr   r   )Úselfr   r   r   r   r   r   ÚfÚmetadataÚclass_labelÚim_rel_pathsÚim_rel_pathÚ	__class__s               €ÚY/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torchvision/datasets/food101.pyr   ÚFood101.__init__&   s¢  ø€ ô 	‰Ñ˜ÐEUÐÑVÜ$ U¨GÐ5FÓGˆŒÜ  §¡›O¨jÑ8ˆÔØ ×-Ñ-°Ñ6ˆÔØ"×/Ñ/°(Ñ:ˆÔæØ�N‰NÔà×!Ñ!×#Ñ#ÜÐ\Ó]Ð]àˆŒØˆÔÜ�$×#Ñ#¨¨¨u oÑ5Ô6¸!Ü—z’z !§&¡&£(Ó+ˆH÷ 7ô ˜hŸm™m›oÓ.ˆŒÜ ¤ T§\¡\´5¼¸T¿\¹\Ó9JÓ3KÓ!LÓMˆÔà)1¯©Ö)9Ñ%ˆKØ�LŠL˜T×.Ñ.¨{Ñ;Ð<¼sÀ<Ó?PÑPÑP�LØ×ÒÙbnó"ÚbnÐS^×#Ñ#×,Ò,°°¸TÐ.B×.HÑ.HÈÓ.MÓNÑbnñ"ñ ×ñ *:ð
 �÷ 7Ö6üò"s   Ã%G/Æ&4H
Ç/
G>c                 ó,   • [        U R                  5      $ ©N)r3   r(   ©r7   s    r>   Ú__len__ÚFood101.__len__J   s   € Ü�4×$Ñ$Ó%Ð%ó    Úidxc                 óì   • U R                   U   U R                  U   p2U R                  U5      nU R                  (       a  U R                  U5      nU R                  (       a  U R	                  U5      nXC4$ rA   )r(   r'   r   r   r   )r7   rF   Ú
image_fileÚlabelÚimages        r>   Ú__getitem__ÚFood101.__getitem__M   sa   € Ø ×-Ñ-¨cÑ2°D·L±LÀÑ4E�EØ—‘˜JÓ'ˆà�>�>Ø—N‘N 5Ó)ˆEà× × Ø×)Ñ)¨%Ó0ˆEàˆ|ÐrE   c                 ó    • SU R                    3$ )Nzsplit=)r    rB   s    r>   Ú
extra_reprÚFood101.extra_reprY   s   € Ø˜Ÿ™�}Ð%Ð%rE   c                 óR   • [        S U R                  U R                  4 5       5      $ )Nc              3   ón   #   • U  H+  oR                  5       =(       a    UR                  5       v •  M-     g 7frA   )ÚexistsÚis_dir)Ú.0Úfolders     r>   Ú	<genexpr>Ú(Food101._check_exists.<locals>.<genexpr>]   s$   é € ÐnÒEm¸6—=‘=“?×6 v§}¡}£Ô6ÒEmùs   ‚35)Úallr"   r#   rB   s    r>   r%   ÚFood101._check_exists\   s%   € ÜÑnÀd×FWÑFWÐY]×YlÑYlÑEmÓnÓnÐnrE   c                 ó‚   • U R                  5       (       a  g [        U R                  U R                  U R                  S9  g )N)Údownload_rootÚmd5)r%   r
   Ú_URLr   Ú_MD5rB   s    r>   r$   ÚFood101._download_   s,   € Ø×Ñ×ÑØÜ$ T§Y¡Y¸d¿i¹iÈTÏYÉYÓWrE   )	r!   r(   r#   r'   r"   r    r4   r/   r   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r]   r^   r	   r   Ústrr   r   r   Úboolr   r   ÚintrC   ÚtuplerK   rN   r%   r$   Ú__static_attributes__Ú__classcell__)r=   s   @r>   r   r      sê   ø† ñð. ?€DØ-€Dð
 Ø(,Ø/3ØØ4Bñ"à�C˜�IÑð"ð ð"ð ˜HÑ%ð	"ð
 # 8Ñ,ð"ð ð"ð ˜%  T 	Ñ*Ð+¨SÐ0Ñ1ð"ð 
÷"ð "ðH&˜ô &ð
˜sð 
 u¨S°#¨X¡ô 
ð&˜Cô &ðo˜tô o÷Xò XrE   r   )r*   Úpathlibr   Útypingr   r   r   r   rU   r	   Úutilsr
   r   Úvisionr   r   © rE   r>   Ú<module>rp      s*   ðÛ Ý ß 1Ó 1å "ç ?Ý !ôWXˆmõ WXrE   