+
     °³jù  ã                   óv   € ^ RI t^ RIHt ^ RIHtHtHtHt ^ RI	H
t
 ^RIHt  ! R R]4      t ! R R	]4      tR# )
é    N)ÚPath)ÚAnyÚCallableÚOptionalÚUnion)ÚImage)ÚVisionDatasetc                   óŽ   a a€ ] tR t^
t oRtRV3R lV 3R llltV3R lR ltV3R lR ltV3R lR	 ltV3R
 lR lt	Rt
VtV ;t# )ÚCocoDetectiona8  `MS Coco Detection <https://cocodataset.org/#detection-2016>`_ Dataset.

It requires `pycocotools <https://github.com/ppwwyyxx/cocoapi>`_ to be installed,
which could be installed via ``pip install pycocotools`` or ``conda install conda-forge::pycocotools``.

Args:
    root (str or ``pathlib.Path``): Root directory where images are downloaded to.
    annFile (string): Path to json annotation file.
    transform (callable, optional): A function/transform that takes in a PIL image
        and returns a transformed version. E.g, ``transforms.PILToTensor``
    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.
c                ó‚   <€ V ^8„  d   QhRS[ S[S[3,          RS[RS[S[,          RS[S[,          RS[S[,          RR/# )é   ÚrootÚannFileÚ	transformÚtarget_transformÚ
transformsÚreturnN)r   Ústrr   r   r   )ÚformatÚ__classdict__s   "€ÚZ/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torchvision/datasets/coco.pyÚ__annotate__ÚCocoDetection.__annotate__   s_   ø€ ÷ 7ñ 7á‘C™�IÕð7ñ ð7ñ ™HÕ%ð	7ñ
 #¡8Õ,ð7ñ ™XÕ&ð7ð 
ñ7ó    c                óÄ   <€ \         SV `  WW44       ^ RIHp V! V4      V n        \        \        V P                  P                  P                  4       4      4      V n	        R# )r   )ÚCOCON)
ÚsuperÚ__init__Úpycocotools.cocor   ÚcocoÚlistÚsortedÚimgsÚkeysÚids)Úselfr   r   r   r   r   r   Ú	__class__s   &&&&&& €r   r   ÚCocoDetection.__init__   sD   ø€ ô 	‰Ñ˜¨9ÔGÝ)á˜“MˆŒ	Üœ˜tŸy™yŸ~™~×2Ñ2Ó4Ó5Ó6ˆŽr   c                ó:   <€ V ^8„  d   QhRS[ RS[P                  /# ©r   Úidr   )Úintr   )r   r   s   "€r   r   r   )   s#   ø€ ÷ Hñ H™cð H¡e§k¡kñ Hr   c                óî   € V P                   P                  V4      ^ ,          R,          p\        P                  ! \        P
                  P                  V P                  V4      4      P                  R4      # )r   Ú	file_nameÚRGB)	r    ÚloadImgsr   ÚopenÚosÚpathÚjoinr   Úconvert)r&   r+   r3   s   && r   Ú_load_imageÚCocoDetection._load_image)   sM   € Ø�y‰y×!Ñ! "Ó% aÕ(¨Õ5ˆÜ�zŠzœ"Ÿ'™'Ÿ,™, t§y¡y°$Ó7Ó8×@Ñ@ÀÓGÐGr   c                ó6   <€ V ^8„  d   QhRS[ RS[S[,          /# r*   )r,   r!   r   )r   r   s   "€r   r   r   -   s   ø€ ÷ ;ñ ;™sð ;¡t©C¥yñ ;r   c                ój   € V P                   P                  V P                   P                  V4      4      # ©N)r    ÚloadAnnsÚ	getAnnIds)r&   r+   s   &&r   Ú_load_targetÚCocoDetection._load_target-   s&   € Ø�y‰y×!Ñ! $§)¡)×"5Ñ"5°bÓ"9Ó:Ð:r   c                ó<   <€ V ^8„  d   QhRS[ RS[S[S[3,          /# )r   Úindexr   )r,   Útupler   )r   r   s   "€r   r   r   0   s#   ø€ ÷ ñ ¡ð ©©s±C¨x­ñ r   c                ó  € \        V\        4      '       g   \        R \        V4       R24      hV P                  V,          pV P                  V4      pV P                  V4      pV P                  e   V P                  W44      w  r4W43# )z#Index must be of type integer, got z	 instead.)Ú
isinstancer,   Ú
ValueErrorÚtyper%   r6   r=   r   )r&   r@   r+   ÚimageÚtargets   &&   r   Ú__getitem__ÚCocoDetection.__getitem__0   sw   € ä˜%¤×%Ò%ÜÐBÄ4ÈÃ;À-ÈyÐYÓZÐZà�X‰X�e�_ˆØ× Ñ  Ó$ˆØ×"Ñ" 2Ó&ˆà�?‰?Ò&Ø ŸO™O¨EÓ:‰MˆEàˆ}Ðr   c                ó    <€ V ^8„  d   QhRS[ /# )r   r   )r,   )r   r   s   "€r   r   r   >   s   ø€ ÷ ñ ™ñ r   c                ó,   € \        V P                  4      # r:   )Úlenr%   )r&   s   &r   Ú__len__ÚCocoDetection.__len__>   s   € Ü�4—8‘8‹}Ðr   )r    r%   )NNN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r6   r=   rH   rM   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r'   r   s   @@r   r   r   
   sC   ù‡ € ñ÷ 7õ 7÷Hð H÷;ð ;÷ð ÷÷ ð r   r   c                   óB   a a€ ] tR t^Bt oRtV3R lV 3R lltRtVtV ;t# )ÚCocoCaptionsaß  `MS Coco Captions <https://cocodataset.org/#captions-2015>`_ Dataset.

It requires `pycocotools <https://github.com/ppwwyyxx/cocoapi>`_ to be installed,
which could be installed via ``pip install pycocotools`` or ``conda install conda-forge::pycocotools``.

Args:
    root (str or ``pathlib.Path``): Root directory where images are downloaded to.
    annFile (string): Path to json annotation file.
    transform (callable, optional): A function/transform that  takes in a PIL image
        and returns a transformed version. E.g, ``transforms.PILToTensor``
    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.

Example:

    .. code:: python

        import torchvision.datasets as dset
        import torchvision.transforms as transforms
        cap = dset.CocoCaptions(root = 'dir where images are',
                                annFile = 'json annotation file',
                                transform=transforms.PILToTensor())

        print('Number of samples: ', len(cap))
        img, target = cap[3] # load 4th sample

        print("Image Size: ", img.size())
        print(target)

    Output: ::

        Number of samples: 82783
        Image Size: (3L, 427L, 640L)
        [u'A plane emitting smoke stream flying over a mountain.',
        u'A plane darts across a bright blue sky behind a mountain covered in snow',
        u'A plane leaves a contrail above the snowy mountain top.',
        u'A mountain that has a plane flying overheard in the distance.',
        u'A mountain view with a plume of smoke in the background']

c                ó6   <€ V ^8„  d   QhRS[ RS[S[,          /# r*   )r,   r!   r   )r   r   s   "€r   r   ÚCocoCaptions.__annotate__n   s#   ø€ ÷ Dñ D™sð D¡t©C¥yñ Dr   c                óX   <€ \         SV `  V4       Uu. uF  q"R ,          NK  	  up# u upi )Úcaption)r   r=   )r&   r+   Úannr'   s   && €r   r=   ÚCocoCaptions._load_targetn   s+   ø€ Ü*/©'Ñ*>¸rÔ*BÓCÑ*B 3�I—�Ñ*BÑCÐCùÒCs   “'© )	rO   rP   rQ   rR   rS   r=   rT   rU   rV   rW   s   @@r   rY   rY   B   s   ù‡ € ñ)÷VD÷ Dó Dr   rY   )Úos.pathr2   Úpathlibr   Útypingr   r   r   r   ÚPILr   Úvisionr	   r   rY   r`   r   r   Ú<module>rf      s2   ðÛ Ý ß 1Ó 1å å !ô5�Mô 5ôp-D�=ö -Dr   