ó
    Eñip"  ã                   óª  • S SK r 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  S SKJr  SSKJrJr  SS	KJr  S
SS\R.                  R1                  SS5      S.SSS\R.                  R1                  SSS5      S.SSS\R.                  R1                  SS5      S.SSS\R.                  R1                  SS5      S.SSS\R.                  R1                  SS5      S.S S!S"\R.                  R1                  SS#5      S.S$S%S&\R.                  R1                  SS#5      S.S'.r " S( S)\5      r " S* S+\5      r " S, S-\5      rg! \ a
    S SK	Jr   GN)f = f).é    N)ÚPath)ÚAnyÚCallableÚOptionalÚUnion)ÚElement)Úparse)ÚImageé   )Údownload_and_extract_archiveÚverify_str_arg)ÚVisionDatasetzJhttp://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tarzVOCtrainval_11-May-2012.tarÚ 6cd6e144f989b92b3379bac3b3de84fdÚ	VOCdevkitÚVOC2012)ÚurlÚfilenameÚmd5Úbase_dirzJhttp://host.robots.ox.ac.uk/pascal/VOC/voc2011/VOCtrainval_25-May-2011.tarzVOCtrainval_25-May-2011.tarÚ 6c3384ef61512963050cb5d687e5bf1eÚTrainValÚVOC2011zJhttp://host.robots.ox.ac.uk/pascal/VOC/voc2010/VOCtrainval_03-May-2010.tarzVOCtrainval_03-May-2010.tarÚ da459979d0c395079b5c75ee67908abbÚVOC2010zJhttp://host.robots.ox.ac.uk/pascal/VOC/voc2009/VOCtrainval_11-May-2009.tarzVOCtrainval_11-May-2009.tarÚ a3e00b113cfcfebf17e343f59da3caa1ÚVOC2009zJhttp://host.robots.ox.ac.uk/pascal/VOC/voc2008/VOCtrainval_14-Jul-2008.tarÚ 2629fa636546599198acfcfbfcf1904aÚVOC2008zJhttp://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tarzVOCtrainval_06-Nov-2007.tarÚ c52e279531787c972589f7e41ab4ae64ÚVOC2007zFhttp://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tarzVOCtest_06-Nov-2007.tarÚ b6e924de25625d8de591ea690078ad9f)Ú2012Ú2011Ú2010Ú2009Ú2008Ú2007ú	2007-testc                   ó¢   ^ • \ rS rSr% \\S'   \\S'   \\S'         SS\\\4   S\S\S\S	\	\
   S
\	\
   S\	\
   4U 4S jjjrS\4S jrSrU =r$ )Ú_VOCBaseé?   Ú_SPLITS_DIRÚ_TARGET_DIRÚ_TARGET_FILE_EXTÚrootÚyearÚ	image_setÚdownloadÚ	transformÚtarget_transformÚ
transformsc           
      ó0  >• [         TU ]  XXV5        [        US[        SS5       Vs/ s H  n[	        U5      PM     snS9U l        / SQn	US:X  a  U	R                  S5        [        USU	5      U l        US:X  a  US:X  a  S	OUn
[        U
   nUS
   U l	        US   U l
        US   U l        US   n[        R                  R                  U R                  U5      nU(       a4  [!        U R                  U R                  U R                  U R                  S9  [        R                  R#                  U5      (       d  [%        S5      e[        R                  R                  USU R&                  5      n[        R                  R                  XãR)                  S5      S-   5      n[+        [        R                  R                  U5      5       nUR-                  5        Vs/ s H  nUR/                  5       PM     nnS S S 5        [        R                  R                  US5      nW Vs/ s H&  n[        R                  R                  UUS-   5      PM(     snU l        [        R                  R                  XÐR2                  5      nU Vs/ s H0  n[        R                  R                  UUU R4                  -   5      PM2     snU l        [9        U R0                  5      [9        U R6                  5      :X  d   eg s  snf s  snf ! , (       d  f       GN= fs  snf s  snf )Nr0   i×  iÝ  )Úvalid_values)ÚtrainÚtrainvalÚvalr'   Útestr1   r(   r   r   r   r   )r   r   zHDataset not found or corrupted. You can use download=True to download itÚ	ImageSetsÚ
z.txtÚ
JPEGImagesz.jpg)ÚsuperÚ__init__r   ÚrangeÚstrr0   Úappendr1   ÚDATASET_YEAR_DICTr   r   r   ÚosÚpathÚjoinr/   r   ÚisdirÚRuntimeErrorr,   ÚrstripÚopenÚ	readlinesÚstripÚimagesr-   r.   ÚtargetsÚlen)Úselfr/   r0   r1   r2   r3   r4   r5   ÚyrÚvalid_image_setsÚkeyÚdataset_year_dictr   Úvoc_rootÚ
splits_dirÚsplit_fÚfÚxÚ
file_namesÚ	image_dirÚ
target_dirÚ	__class__s                        €ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torchvision/datasets/voc.pyr@   Ú_VOCBase.__init__D   s[  ø€ ô 	‰Ñ˜¨9ÔGä" 4¨ÔQVÐW[Ð]aÔQbÓ>cÒQbÈ2¼sÀ2¾wÑQbÑ>cÑdˆŒ	â7ÐØ�6‹>Ø×#Ñ# FÔ+Ü'¨	°;Ð@PÓQˆŒà! V›^°	¸VÓ0C‰kÈˆÜ-¨cÑ2Ðà$ UÑ+ˆŒØ)¨*Ñ5ˆŒØ$ UÑ+ˆŒà$ ZÑ0ˆÜ—7‘7—<‘< §	¡	¨8Ó4ˆæÜ(¨¯©°4·9±9ÀtÇ}Á}ÐZ^×ZbÑZbÒcä�w‰w�}‰}˜X×&Ñ&ÜÐiÓjÐjä—W‘W—\‘\ (¨K¸×9IÑ9IÓJˆ
Ü—'‘'—,‘,˜z×+;Ñ+;¸DÓ+AÀFÑ+JÓKˆÜ”"—'‘'—,‘,˜wÓ'Ô(¨AØ-.¯[©[¬]Ó;ª]¨˜!Ÿ'™'ž)©]ˆJÐ;÷ )ô —G‘G—L‘L ¨<Ó8ˆ	ÙDNÓOÂJ¸q”r—w‘w—|‘| I¨q°6©zÖ:ÁJÑOˆŒä—W‘W—\‘\ (×,<Ñ,<Ó=ˆ
ÙU_Ó`ÒU_ÐPQœŸ™Ÿ™ Z°°T×5JÑ5JÑ1JÖKÑU_Ñ`ˆŒä�4—;‘;Ó¤3 t§|¡|Ó#4Ó4Ð4Ñ4ùòE ?dùò4 <÷ )Ö(üò Pùò as/   §K2ÇK<ÇK7Ç4K<È"-LÊ7LË7K<Ë<
LÚreturnc                 ó,   • [        U R                  5      $ ©N)rP   rN   ©rQ   s    r_   Ú__len__Ú_VOCBase.__len__t   s   € Ü�4—;‘;ÓÐó    )r   r1   rN   r   rO   r   r0   )r"   r8   FNNN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rB   Ú__annotations__r   r   Úboolr   r   r@   Úintre   Ú__static_attributes__Ú__classcell__)r^   s   @r_   r*   r*   ?   s¡   ø‡ ØÓØÓØÓð
 Ø ØØ(,Ø/3Ø)-ñ.5à�C˜�IÑð.5ð ð.5ð ð	.5ð
 ð.5ð ˜HÑ%ð.5ð # 8Ñ,ð.5ð ˜XÑ&÷.5ð .5ð` ˜÷  ò  rg   r*   c                   ó^   • \ rS rSrSrSrSrSr\S\	\
   4S j5       rS\S\\\4   4S	 jrS
rg)ÚVOCSegmentationéx   aö  `Pascal VOC <http://host.robots.ox.ac.uk/pascal/VOC/>`_ Segmentation Dataset.

Args:
    root (str or ``pathlib.Path``): Root directory of the VOC Dataset.
    year (string, optional): The dataset year, supports years ``"2007"`` to ``"2012"``.
    image_set (string, optional): Select the image_set to use, ``"train"``, ``"trainval"`` or ``"val"``. If
        ``year=="2007"``, can also be ``"test"``.
    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.
    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.
    transforms (callable, optional): A function/transform that takes input sample and its target as entry
        and returns a transformed version.
ÚSegmentationÚSegmentationClassz.pngra   c                 ó   • U R                   $ rc   ©rO   rd   s    r_   ÚmasksÚVOCSegmentation.masks�   ó   € à�|‰|Ðrg   Úindexc                 óò   • [         R                  " U R                  U   5      R                  S5      n[         R                  " U R                  U   5      nU R
                  b  U R                  X#5      u  p#X#4$ )zk
Args:
    index (int): Index

Returns:
    tuple: (image, target) where target is the image segmentation.
ÚRGB)r
   rK   rN   Úconvertrx   r5   ©rQ   r{   ÚimgÚtargets       r_   Ú__getitem__ÚVOCSegmentation.__getitem__“   s_   € ô �jŠj˜Ÿ™ UÑ+Ó,×4Ñ4°UÓ;ˆÜ—’˜DŸJ™J uÑ-Ó.ˆà�?‰?Ñ&ØŸ/™/¨#Ó6‰KˆCàˆ{Ðrg   © N)rh   ri   rj   rk   Ú__doc__r,   r-   r.   ÚpropertyÚlistrB   rx   rn   Útupler   r‚   ro   r„   rg   r_   rr   rr   x   sQ   † ñð$ !€KØ%€KØÐàð�t˜C‘yó ó ðð ð ¨¨s°C¨x©÷ rg   rr   c                   ó„   • \ rS rSrSrSrSrSr\S\	\
   4S j5       rS\S\\\4   4S	 jr\S
\S\\
\4   4S j5       rSrg)ÚVOCDetectioné¤   a.  `Pascal VOC <http://host.robots.ox.ac.uk/pascal/VOC/>`_ Detection Dataset.

Args:
    root (str or ``pathlib.Path``): Root directory of the VOC Dataset.
    year (string, optional): The dataset year, supports years ``"2007"`` to ``"2012"``.
    image_set (string, optional): Select the image_set to use, ``"train"``, ``"trainval"`` or ``"val"``. If
        ``year=="2007"``, can also be ``"test"``.
    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: alphabetic indexing of VOC's 20 classes).
    transform (callable, optional): A function/transform that takes in a PIL image
        and returns a transformed version. E.g, ``transforms.RandomCrop``
    target_transform (callable, required): A function/transform that takes in the
        target and transforms it.
    transforms (callable, optional): A function/transform that takes input sample and its target as entry
        and returns a transformed version.
ÚMainÚAnnotationsz.xmlra   c                 ó   • U R                   $ rc   rw   rd   s    r_   ÚannotationsÚVOCDetection.annotations¼   rz   rg   r{   c                 ó  • [         R                  " U R                  U   5      R                  S5      nU R	                  [        U R                  U   5      R                  5       5      nU R                  b  U R                  X#5      u  p#X#4$ )zq
Args:
    index (int): Index

Returns:
    tuple: (image, target) where target is a dictionary of the XML tree.
r}   )	r
   rK   rN   r~   Úparse_voc_xmlÚET_parser�   Úgetrootr5   r   s       r_   r‚   ÚVOCDetection.__getitem__À   sq   € ô �jŠj˜Ÿ™ UÑ+Ó,×4Ñ4°UÓ;ˆØ×#Ñ#¤H¨T×-=Ñ-=¸eÑ-DÓ$E×$MÑ$MÓ$OÓPˆà�?‰?Ñ&ØŸ/™/¨#Ó6‰KˆCàˆ{Ðrg   Únodec           	      óF  • 0 n[        U 5      nU(       aÆ  [        R                  " [         5      n[        [        R
                  U5       H/  nUR                  5        H  u  pVX5   R                  U5        M     M1     U R                  S:X  a	  US   /US'   U R                  UR                  5        VVs0 s H  u  pVU[        U5      S:X  a  US   OU_M     snn0nU R                  (       a/  U R                  R                  5       nU(       d  XqU R                  '   U$ s  snnf )NÚ
annotationÚobjectr   r   )r‡   ÚcollectionsÚdefaultdictÚmaprŠ   r’   ÚitemsrC   ÚtagrP   ÚtextrM   )r–   Úvoc_dictÚchildrenÚdef_dicÚdcÚindÚvrŸ   s           r_   r’   ÚVOCDetection.parse_voc_xmlÐ   sî   € à#%ˆÜ˜“:ˆÞÜ&1×&=Ò&=¼dÓ&CˆGÜœ,×4Ñ4°hÖ?�Ø Ÿh™hžj‘F�CØ‘L×'Ñ'¨Ö*ó )ñ @ð �x‰x˜<Ó'Ø%,¨XÑ%6Ð$7�˜Ñ!ØŸ™ÐQX×Q^ÑQ^ÔQ`Ô"aÒQ`ÁvÀs 3´°A³¸!³¨¨!ªÀÒ#BÑQ`Ò"aÐbˆHØ�9�9Ø—9‘9—?‘?Ó$ˆDÞØ%)˜Ÿ™Ñ"Øˆùó #bs   Â3#Dr„   N)rh   ri   rj   rk   r…   r,   r-   r.   r†   r‡   rB   r�   rn   rˆ   r   r‚   ÚstaticmethodÚ
ET_ElementÚdictr’   ro   r„   rg   r_   rŠ   rŠ   ¤   s{   † ñð& €KØ€KØÐàð˜T #™Yó ó ðð ð ¨¨s°C¨x©ô ð  ð˜Jð ¨4°°S°©>ó ó órg   rŠ   )rš   rE   Úpathlibr   Útypingr   r   r   r   Úxml.etree.ElementTreer   r¨   Údefusedxml.ElementTreer	   r“   ÚImportErrorÚPILr
   Úutilsr   r   Úvisionr   rF   rG   rD   r*   rr   rŠ   r„   rg   r_   Ú<module>r²      si  ðÛ Û 	Ý ß 1Ó 1Ý 7ð8Ý8õ ç ?Ý !ð \Ø1Ø1Ø—G‘G—L‘L ¨iÓ8ñ	ð \Ø1Ø1Ø—G‘G—L‘L ¨[¸)ÓDñ	ð \Ø1Ø1Ø—G‘G—L‘L ¨iÓ8ñ	ð \Ø1Ø1Ø—G‘G—L‘L ¨iÓ8ñ	ð \Ø1Ø1Ø—G‘G—L‘L ¨iÓ8ñ	ð \Ø1Ø1Ø—G‘G—L‘L ¨iÓ8ñ	ð XØ-Ø1Ø—G‘G—L‘L ¨iÓ8ñ	ñK+Ð ô\6 ˆ}ô 6 ôr)�hô )ôX<�8õ <øðw ó 8ß7Ð7ð8ús   ¢E ÅEÅE