+
     °³jÔR  ã                   ó4  € ^ RI t ^ RIt^ RIHtHt ^ RIHt ^ RIHt ^ RIH	t	H
t
HtHt ^ RIt^ RIt^ RIHt ^RIHtHt ^RIHt ^R	IHtHt ^R
IHt ]]P"                  ]P"                  ]]P:                  ,          ]]P:                  ,          3,          t]]P"                  ]P"                  ]]P:                  ,          3,          tRt  ! R R]]4      t! ! R R]!4      t" ! R R]!4      t# ! R R]!4      t$ ! R R]!4      t% ! R R]!4      t&R R lt'R R lt(R# )é    N)ÚABCÚabstractmethod)Úglob©ÚPath)ÚAnyÚCallableÚOptionalÚUnion)ÚImage)Ú
decode_pngÚ	read_file)Údefault_loader)Ú	_read_pfmÚverify_str_arg)ÚVisionDatasetÚ	KittiFlowÚSintelÚFlyingThings3DÚFlyingChairsÚHD1Kc                   ó®   a a€ ] tR t^t oRtR]3V3R lV 3R llltV3R lR lt]V3R lR l4       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# )ÚFlowDatasetFNc                ón   <€ V ^8„  d   QhRS[ S[S[3,          RS[S[,          RS[S[.S[3,          RR/# )é   ÚrootÚ
transformsÚloaderÚreturnN©r   Ústrr   r
   r	   r   )ÚformatÚ__classdict__s   "€Úc/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torchvision/datasets/_optical_flow.pyÚ__annotate__ÚFlowDataset.__annotate__$   sL   ø€ ÷ ñ á‘C™�IÕðñ ™XÕ&ðñ ™#˜¡˜Õ$ð	ð
 
ñó    c                ó\   <€ \         SV `  VR 7       W n        . V n        . V n        W0n        R# ))r   N)ÚsuperÚ__init__r   Ú
_flow_listÚ_image_listÚ_loader)Úselfr   r   r   Ú	__class__s   &&&&€r$   r*   ÚFlowDataset.__init__$   s.   ø€ ô 	‰Ñ˜dÐÔ#Ø$Œà%'ˆŒØ,.ˆÔØŽr'   c                ód   <€ V ^8„  d   QhRS[ RS[S[P                  S[P                  3,          /# ©r   Ú	file_namer   )r!   r   r   ÚtorchÚTensor)r"   r#   s   "€r$   r%   r&   2   s-   ø€ ÷ 'ñ '¡3ð '©5±·±¹e¿l¹lÐ1JÕ+Kñ 'r'   c                ó$   € V P                  V4      # ©N)r-   ©r.   r3   s   &&r$   Ú	_read_imgÚFlowDataset._read_img2   s   € Ø�|‰|˜IÓ&Ð&r'   c                ó    <€ V ^8„  d   QhRS[ /# )r   r3   )r!   )r"   r#   s   "€r$   r%   r&   6   s   ø€ ÷ ñ ¡Cñ r'   c                ó   € R # r7   © r8   s   &&r$   Ú
_read_flowÚFlowDataset._read_flow5   s   € ñ 	r'   c                ó<   <€ V ^8„  d   QhRS[ RS[S[S[3,          /# ©r   Úindexr   ©Úintr   ÚT1ÚT2)r"   r#   s   "€r$   r%   r&   :   s#   ø€ ÷ $ñ $¡ð $©©r±2¨v­ñ $r'   c                óÊ  € V P                  V P                  V,          ^ ,          4      pV P                  V P                  V,          ^,          4      pV P                  '       d=   V P                  V P                  V,          4      pV P                  '       d   Vw  rEMRpMR;rEV P
                  e   V P                  W#WE4      w  r#rEV P                  '       g   Ve   W#WE3# W#V3# )r   N)r9   r,   r+   r>   Ú_has_builtin_flow_maskr   )r.   rB   Úimg1Úimg2ÚflowÚvalid_flow_masks   &&    r$   Ú__getitem__ÚFlowDataset.__getitem__:   sÇ   € à�~‰~˜d×.Ñ.¨uÕ5°aÕ8Ó9ˆØ�~‰~˜d×.Ñ.¨uÕ5°aÕ8Ó9ˆà�?�?ˆ?Ø—?‘? 4§?¡?°5Õ#9Ó:ˆDØ×*×*Ð*Ø(,Ñ%��oà"&‘à%)Ð)ˆDà�?‰?Ò&Ø04·±ÀÈDÓ0bÑ-ˆD˜à×&×&Ð&¨/Ò*Eà˜tÐ4Ð4à˜tÐ#Ð#r'   c                ó    <€ V ^8„  d   QhRS[ /# )r   r   )rD   )r"   r#   s   "€r$   r%   r&   Q   s   ø€ ÷ %ñ %™ñ %r'   c                ó,   € \        V P                  4      # r7   )Úlenr,   )r.   s   &r$   Ú__len__ÚFlowDataset.__len__Q   s   € Ü�4×#Ñ#Ó$Ð$r'   c                ób   <€ V ^8„  d   QhRS[ RS[P                  P                  P                  /# )r   Úvr   )rD   r4   ÚutilsÚdataÚConcatDataset)r"   r#   s   "€r$   r%   r&   T   s+   ø€ ÷ :ñ :™#ð :¡%§+¡+×"2Ñ"2×"@Ñ"@ñ :r'   c                ód   € \         P                  P                  P                  V .V,          4      # r7   )r4   rV   rW   rX   )r.   rU   s   &&r$   Ú__rmul__ÚFlowDataset.__rmul__T   s#   € Ü�{‰{×Ñ×-Ñ-¨t¨f°q­jÓ9Ð9r'   )r+   r,   r-   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rH   r   r*   r9   r   r>   rM   rR   rZ   Ú__static_attributes__Ú__classdictcell__Ú__classcell__©r/   r#   s   @@r$   r   r      s`   ù‡ € ð #Ðð
 *.Ø'5÷	õ ÷'ð 'ð ÷ó ð÷$ð $÷.%ð %÷:÷ :ð :r'   r   c                   óx   a a€ ] tR t^Xt oRtRRR]3V3R lV 3R llltV3R lV 3R lltV3R	 lR
 ltRt	Vt
V ;t# )r   a:  `Sintel <http://sintel.is.tue.mpg.de/>`_ Dataset for optical flow.

The dataset is expected to have the following structure: ::

    root
        Sintel
            testing
                clean
                    scene_1
                    scene_2
                    ...
                final
                    scene_1
                    scene_2
                    ...
            training
                clean
                    scene_1
                    scene_2
                    ...
                final
                    scene_1
                    scene_2
                    ...
                flow
                    scene_1
                    scene_2
                    ...

Args:
    root (str or ``pathlib.Path``): Root directory of the Sintel Dataset.
    split (string, optional): The dataset split, either "train" (default) or "test"
    pass_name (string, optional): The pass to use, either "clean" (default), "final", or "both". See link above for
        details on the different passes.
    transforms (callable, optional): A function/transform that takes in
        ``img1, img2, flow, valid_flow_mask`` and returns a transformed version.
        ``valid_flow_mask`` is expected for consistency with other datasets which
        return a built-in valid mask, such as :class:`~torchvision.datasets.KittiFlow`.
    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.
ÚtrainÚcleanNc                óz   <€ V ^8„  d   QhRS[ S[S[3,          RS[RS[RS[S[,          RS[S[.S[3,          RR/# )r   r   ÚsplitÚ	pass_namer   r   r   Nr    )r"   r#   s   "€r$   r%   ÚSintel.__annotate__„   sh   ø€ ÷ Vñ Vá‘C™�IÕðVñ ðVñ ð	Vñ
 ™XÕ&ðVñ ™#˜¡˜Õ$ðVð 
ñVr'   c                óÐ  <€ \         SV `  WVR 7       \        VRRR7       \        VRRR7       VR8X  d   RR.MV.p\        V4      R,          pVR	,          R
,          pV EF   pVR8X  d   R	MTpW,          V,          p	\        P
                  ! V	4       FÈ  p
\        \        \        Wš,          R,          4      4      4      p\        \        V4      ^,
          4       F2  pV ;P                  W¼,          W¼^,           ,          ..,          un        K4  	  VR8X  g   K‡  V ;P                  \        \        \        Wz,          R,          4      4      4      ,          un        KÊ  	  EK  	  R# )©r   r   r   rh   re   ©Úvalid_valuesri   rf   ÚfinalÚbothr   ÚtrainingrK   ú*.pngú*.floN©re   Útest©rf   ro   rp   )r)   r*   r   r   ÚosÚlistdirÚsortedr   r!   ÚrangerQ   r,   r+   )r.   r   rh   ri   r   r   ÚpassesÚ	flow_rootÚ	split_dirÚ
image_rootÚsceneÚ
image_listÚir/   s   &&&&&&       €r$   r*   ÚSintel.__init__„   s   ø€ ô 	‰Ñ˜dÀ&ÐÔIä�u˜gÐ4EÕFÜ�y +Ð<VÕWØ'0°FÔ':�'˜7Ñ#ÀÀˆä�D‹z˜HÕ$ˆØ˜:Õ%¨Õ.ˆ	äˆIØ&+¨wÔ&6™
¸EˆIØÕ)¨IÕ5ˆJÜŸš JÖ/�Ü#¤D¬¨ZÕ-?À'Õ-IÓ)JÓ$KÓL�
Üœs :›°Õ2Ö3�AØ×$Ò$¨*­-¸ÈÅEÕ9JÐ)KÐ(LÕL×$ñ 4ð ˜GÖ#Ø—O’O¤v¬d´3°yÕ7HÈ7Õ7RÓ3SÓ.TÓ'UÕU—Oô 0ó  r'   c                ó<   <€ V ^8„  d   QhRS[ RS[S[S[3,          /# rA   rC   )r"   r#   s   "€r$   r%   rj       ó#   ø€ ÷ *ñ *¡ð *©©r±2¨v­ñ *r'   c                ó"   <€ \         SV `  V4      # ©a¤  Return example at given index.

Args:
    index(int): The index of the example to retrieve

Returns:
    tuple: A 3-tuple with ``(img1, img2, flow)``.
    The flow is a numpy array of shape (2, H, W) and the images are PIL images.
    ``flow`` is None if ``split="test"``.
    If a valid flow mask is generated within the ``transforms`` parameter,
    a 4-tuple with ``(img1, img2, flow, valid_flow_mask)`` is returned.
©r)   rM   ©r.   rB   r/   s   &&€r$   rM   ÚSintel.__getitem__    ó   ø€ ô ‰wÑ" 5Ó)Ð)r'   c                ó:   <€ V ^8„  d   QhRS[ RS[P                  /# r2   ©r!   ÚnpÚndarray)r"   r#   s   "€r$   r%   rj   ¯   ó   ø€ ÷ $ñ $¡Cð $©B¯J©Jñ $r'   c                ó   € \        V4      # r7   ©Ú	_read_flor8   s   &&r$   r>   ÚSintel._read_flow¯   ó   € Ü˜Ó#Ð#r'   r=   ©r\   r]   r^   r_   Ú__doc__r   r*   rM   r>   r`   ra   rb   rc   s   @@r$   r   r   X   s>   ù‡ € ñ)ð\ Ø Ø)-Ø'5÷Võ V÷8*ó *÷$÷ $ð $r'   c                   óz   a a€ ] tR t^³t oRtRtRR]3V3R lV 3R llltV3R lV 3R lltV3R	 lR
 lt	Rt
VtV ;t# )r   aw  `KITTI <http://www.cvlibs.net/datasets/kitti/eval_scene_flow.php?benchmark=flow>`__ dataset for optical flow (2015).

The dataset is expected to have the following structure: ::

    root
        KittiFlow
            testing
                image_2
            training
                image_2
                flow_occ

Args:
    root (str or ``pathlib.Path``): Root directory of the KittiFlow Dataset.
    split (string, optional): The dataset split, either "train" (default) or "test"
    transforms (callable, optional): A function/transform that takes in
        ``img1, img2, flow, valid_flow_mask`` and returns a transformed version.
    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.
Tre   Nc          
      ót   <€ V ^8„  d   QhRS[ S[S[3,          RS[RS[S[,          RS[S[.S[3,          RR/# ©r   r   rh   r   r   r   Nr    )r"   r#   s   "€r$   r%   ÚKittiFlow.__annotate__Ì   s]   ø€ ÷ Pñ Pá‘C™�IÕðPñ ðPñ ™XÕ&ð	Pñ
 ™#˜¡˜Õ$ðPð 
ñPr'   c                ó8  <€ \         S	V `  WVR 7       \        VRRR7       \        V4      R,          VR,           ,          p\	        \        \        VR,          R,          4      4      4      p\	        \        \        VR,          R,          4      4      4      pV'       d	   V'       g   \        R	4      h\        WV4       F   w  rxV ;P                  Wx..,          un	        K"  	  VR8X  d3   \	        \        \        VR
,          R,          4      4      4      V n
        R# R# )rl   rh   re   rm   r   ÚingÚimage_2z*_10.pngz*_11.pngzZCould not find the Kitti flow images. Please make sure the directory structure is correct.Úflow_occNrt   )r)   r*   r   r   ry   r   r!   ÚFileNotFoundErrorÚzipr,   r+   )
r.   r   rh   r   r   Úimages1Úimages2rI   rJ   r/   s
   &&&&&    €r$   r*   ÚKittiFlow.__init__Ì   sã   ø€ ô 	‰Ñ˜dÀ&ÐÔIä�u˜gÐ4EÕFä�D‹z˜KÕ'¨5°5­=Õ9ˆÜœœc $¨Õ"2°ZÕ"?Ó@ÓAÓBˆÜœœc $¨Õ"2°ZÕ"?Ó@ÓAÓBˆçŸgÜ#Ølóð ô ˜gÖ/‰JˆDØ×Ò $  Õ.×ñ 0ð �GÔÜ$¤T¬#¨d°ZÕ.?À*Õ.LÓ*MÓ%NÓOˆDŽOñ r'   c                ó<   <€ V ^8„  d   QhRS[ RS[S[S[3,          /# rA   rC   )r"   r#   s   "€r$   r%   rš   æ   r„   r'   c                ó"   <€ \         SV `  V4      # )a¬  Return example at given index.

Args:
    index(int): The index of the example to retrieve

Returns:
    tuple: A 4-tuple with ``(img1, img2, flow, valid_flow_mask)``
    where ``valid_flow_mask`` is a numpy boolean mask of shape (H, W)
    indicating which flow values are valid. The flow is a numpy array of
    shape (2, H, W) and the images are PIL images. ``flow`` and ``valid_flow_mask`` are None if
    ``split="test"``.
r‡   rˆ   s   &&€r$   rM   ÚKittiFlow.__getitem__æ   rŠ   r'   c                ód   <€ V ^8„  d   QhRS[ RS[S[P                  S[P                  3,          /# r2   ©r!   Útupler�   rŽ   )r"   r#   s   "€r$   r%   rš   õ   ó1   ø€ ÷ Dñ D¡Cð D©E±"·*±*¹b¿j¹jÐ2HÕ,Iñ Dr'   c                ó   € \        V4      # r7   ©Ú)_read_16bits_png_with_flow_and_valid_maskr8   s   &&r$   r>   ÚKittiFlow._read_flowõ   ó   € Ü8¸ÓCÐCr'   )r+   )r\   r]   r^   r_   r–   rH   r   r*   rM   r>   r`   ra   rb   rc   s   @@r$   r   r   ³   sE   ù‡ € ñð, "Ðð
 Ø)-Ø'5÷Põ P÷4*ó *÷D÷ Dð Dr'   c                   óp   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V 3R lltV3R lR ltRtVt	V ;t
# )
r   aÖ  `FlyingChairs <https://lmb.informatik.uni-freiburg.de/resources/datasets/FlyingChairs.en.html#flyingchairs>`_ Dataset for optical flow.

You will also need to download the FlyingChairs_train_val.txt file from the dataset page.

The dataset is expected to have the following structure: ::

    root
        FlyingChairs
            data
                00001_flow.flo
                00001_img1.ppm
                00001_img2.ppm
                ...
            FlyingChairs_train_val.txt


Args:
    root (str or ``pathlib.Path``): Root directory of the FlyingChairs Dataset.
    split (string, optional): The dataset split, either "train" (default) or "val"
    transforms (callable, optional): A function/transform that takes in
        ``img1, img2, flow, valid_flow_mask`` and returns a transformed version.
        ``valid_flow_mask`` is expected for consistency with other datasets which
        return a built-in valid mask, such as :class:`~torchvision.datasets.KittiFlow`.
c                óV   <€ V ^8„  d   QhRS[ S[S[3,          RS[RS[S[,          RR/# )r   r   rh   r   r   N)r   r!   r   r
   r	   )r"   r#   s   "€r$   r%   ÚFlyingChairs.__annotate__  s@   ø€ ÷ Iñ I™U¡3© 9Õ-ð I±cð IÑQYÑZbÕQcð IÐosñ Ir'   c                ó2  <€ \         S
V `  WR 7       \        VRRR7       \        V4      R,          p\	        \        \        VR,          R,          4      4      4      p\	        \        \        VR,          R,          4      4      4      pR	p\        P                  P                  W,          4      '       g   \        R
4      h\        P                  ! \        W,          4      \        P                  R7      p\        \        V4      4       FŠ  pWx,          p	VR8X  d   V	^8X  g   VR8X  g   K"  V	^8X  g   K+  V ;P                   WX,          .,          un        V ;P"                  V^V,          ,          V^V,          ^,           ,          ..,          un        KŒ  	  R# ))r   r   rh   re   Úvalrm   r   rW   z*.ppmrs   zFlyingChairs_train_val.txtzmThe FlyingChairs_train_val.txt file was not found - please download it from the dataset page (see docstring).)ÚdtypeN)re   r´   )r)   r*   r   r   ry   r   r!   rw   ÚpathÚexistsrŸ   r�   ÚloadtxtÚint32rz   rQ   r+   r,   )r.   r   rh   r   ÚimagesÚflowsÚsplit_file_nameÚ
split_listr�   Úsplit_idr/   s   &&&&      €r$   r*   ÚFlyingChairs.__init__  s&  ø€ Ü‰Ñ˜dÐÔ:ä�u˜gÐ4DÕEä�D‹z˜NÕ*ˆÜœœS ¨¥°Õ!8Ó9Ó:Ó;ˆÜ”tœC  v¥°Õ 7Ó8Ó9Ó:ˆà6ˆä�w‰w�~‰~˜dÕ4×5Ò5Ü#Øóð ô —Z’Z¤ DÕ$:Ó ;Ä2Ç8Á8ÔLˆ
Ü”s˜5“zÖ"ˆAØ!•}ˆHØ˜Ô  X°¤]¸À¾È8ÐWXÎ=Ø—’ E¥H :Õ-•Ø× Ò  f¨Q°­U¥m°V¸AÀ½EÀA½IÕ5FÐ%GÐ$HÕH× ó	 #r'   c                ó<   <€ V ^8„  d   QhRS[ RS[S[S[3,          /# rA   rC   )r"   r#   s   "€r$   r%   r²   *  r„   r'   c                ó"   <€ \         SV `  V4      # )a£  Return example at given index.

Args:
    index(int): The index of the example to retrieve

Returns:
    tuple: A 3-tuple with ``(img1, img2, flow)``.
    The flow is a numpy array of shape (2, H, W) and the images are PIL images.
    ``flow`` is None if ``split="val"``.
    If a valid flow mask is generated within the ``transforms`` parameter,
    a 4-tuple with ``(img1, img2, flow, valid_flow_mask)`` is returned.
r‡   rˆ   s   &&€r$   rM   ÚFlyingChairs.__getitem__*  rŠ   r'   c                ó:   <€ V ^8„  d   QhRS[ RS[P                  /# r2   rŒ   )r"   r#   s   "€r$   r%   r²   9  r�   r'   c                ó   € \        V4      # r7   r‘   r8   s   &&r$   r>   ÚFlyingChairs._read_flow9  r”   r'   r=   )re   N)r\   r]   r^   r_   r–   r*   rM   r>   r`   ra   rb   rc   s   @@r$   r   r   ù   s/   ù‡ € ñ÷2Iõ I÷.*ó *÷$÷ $ð $r'   c                   óz   a a€ ] tR tRt oRtRRRR]3V3R lV 3R llltV3R	 lV 3R
 lltV3R lR ltRt	Vt
V ;t# )r   i=  a¶  `FlyingThings3D <https://lmb.informatik.uni-freiburg.de/resources/datasets/SceneFlowDatasets.en.html>`_ dataset for optical flow.

The dataset is expected to have the following structure: ::

    root
        FlyingThings3D
            frames_cleanpass
                TEST
                TRAIN
            frames_finalpass
                TEST
                TRAIN
            optical_flow
                TEST
                TRAIN

Args:
    root (str or ``pathlib.Path``): Root directory of the intel FlyingThings3D Dataset.
    split (string, optional): The dataset split, either "train" (default) or "test"
    pass_name (string, optional): The pass to use, either "clean" (default) or "final" or "both". See link above for
        details on the different passes.
    camera (string, optional): Which camera to return images from. Can be either "left" (default) or "right" or "both".
    transforms (callable, optional): A function/transform that takes in
        ``img1, img2, flow, valid_flow_mask`` and returns a transformed version.
        ``valid_flow_mask`` is expected for consistency with other datasets which
        return a built-in valid mask, such as :class:`~torchvision.datasets.KittiFlow`.
    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.
re   rf   ÚleftNc                ó€   <€ V ^8„  d   QhRS[ S[S[3,          RS[RS[RS[RS[S[,          RS[S[.S[3,          RR/# )	r   r   rh   ri   Úcamerar   r   r   Nr    )r"   r#   s   "€r$   r%   ÚFlyingThings3D.__annotate__]  sj   ø€ ÷ 1:ñ 1:á‘C™�IÕð1:ñ ð1:ñ ð	1:ñ
 ð1:ñ ™XÕ&ð1:ñ ™#˜¡˜Õ$ð1:ð 
ñ1:r'   c           
     ó   <aa€ \         SV `  WVR 7       \        VRRR7       VP                  4       p\        VRRR7       RR.RR.RRR./V,          p\        SR	RR7       SR8X  d   R
R.MS.p\	        V4      R,          pRp	\
        P                  ! WxV	4       EFî  w  poo\        \        \        W,          V,          R,          4      4      4      p
\        V3R lV
 4       4      p
\        \        \        VR,          V,          R,          4      4      4      p\        VV3R lV 4       4      pV
'       d	   V'       g   \        R4      h\        W«4       EF-  w  rÍ\        \        \        VR,          4      4      4      p\        \        \        VR,          4      4      4      p\        \        V4      ^,
          4       FÀ  pSR8X  dU   V ;P                  VV,          VV^,           ,          ..,          un        V ;P                  VV,          .,          un        K^  SR8X  g   Kg  V ;P                  VV^,           ,          VV,          ..,          un        V ;P                  VV^,           ,          .,          un        KÂ  	  EK0  	  EKñ  	  R# )rl   rh   rm   ri   rf   ro   rp   Úframes_cleanpassÚframes_finalpassrÉ   rÇ   Úrightr   Úinto_futureÚ	into_pastz*/*c              3   óH   <"  € T F  p\        V4      S,          x € K  	  R # 5ir7   r   )Ú.0Ú	image_dirrÉ   s   & €r$   Ú	<genexpr>Ú*FlyingThings3D.__init__.<locals>.<genexpr>z  s   øé € ÐUÉ*¸Y¤ Y£°&× 8Ò 8Ë*ùs   ƒ"Úoptical_flowc              3   óV   <"  € T F  p\        V4      S,          S,          x € K   	  R # 5ir7   r   )rÒ   Úflow_dirrÉ   Ú	directions   & €€r$   rÔ   rÕ   }  s$   øé € Ð]ÑS\Àxœt H›~°	Õ9¸F×BÒBÓS\ùs   ƒ&)zcCould not find the FlyingThings3D flow images. Please make sure the directory structure is correct.rr   z*.pfmNrt   rv   )rÇ   rÎ   rp   )rÏ   rÐ   )r)   r*   r   Úupperr   Ú	itertoolsÚproductry   r   r!   rŸ   r    rz   rQ   r,   r+   )r.   r   rh   ri   rÉ   r   r   r{   ÚcamerasÚ
directionsÚ
image_dirsÚ	flow_dirsrÓ   rØ   rº   r»   r�   rÙ   r/   s   &&&&f&&          @€r$   r*   ÚFlyingThings3D.__init__]  s#  ú€ ô 	‰Ñ˜dÀ&ÐÔIä�u˜gÐ4EÕFØ—‘“ˆä�y +Ð<VÕWàÐ(Ð)ØÐ(Ð)ØÐ'Ð);Ð<ð
ð õ	ˆô 	�v˜xÐ6OÕPØ'-°Ô'7�6˜7Ñ#¸f¸Xˆä�D‹zÐ,Õ,ˆà1ˆ
Ü,5×,=Ò,=¸fÈz×,ZÑ(ˆI�v˜yÜ¤¤S¨Õ)9¸EÕ)AÀEÕ)IÓ%JÓ KÓLˆJÜÔUÉ*ÓUÓUˆJäœt¤C¨¨~Õ(=ÀÕ(EÈÕ(MÓ$NÓOÓPˆIÜÕ]ÑS\Ó]Ó]ˆIç§YÜ'ðKóð ô
 (+¨:×'AÑ#�	Ü¤¤S¨°WÕ)<Ó%=Ó >Ó?�Üœt¤C¨°7Õ(:Ó$;Ó<Ó=�Üœs 5›z¨A�~Ö.�AØ  MÔ1Ø×(Ò(¨f°Q­i¸ÀÀAÅ½Ð-GÐ,HÕHÕ(ØŸš¨E°!­H¨:Õ5ŸØ" kÖ1Ø×(Ò(¨f°Q¸µU­m¸VÀA½YÐ-GÐ,HÕHÕ(ØŸš¨E°!°aµ%­L¨>Õ9Ÿô /ô (Bó -[r'   c                ó<   <€ V ^8„  d   QhRS[ RS[S[S[3,          /# rA   rC   )r"   r#   s   "€r$   r%   rÊ   �  r„   r'   c                ó"   <€ \         SV `  V4      # r†   r‡   rˆ   s   &&€r$   rM   ÚFlyingThings3D.__getitem__�  rŠ   r'   c                ó:   <€ V ^8„  d   QhRS[ RS[P                  /# r2   rŒ   )r"   r#   s   "€r$   r%   rÊ   Ÿ  r�   r'   c                ó   € \        V4      # r7   )r   r8   s   &&r$   r>   ÚFlyingThings3D._read_flowŸ  r”   r'   r=   r•   rc   s   @@r$   r   r   =  s@   ù‡ € ñðD Ø ØØ)-Ø'5÷1:õ 1:÷f*ó *÷$÷ $ð $r'   c                   óz   a a€ ] tR tRt oRtRtRR]3V3R lV 3R llltV3R lR	 ltV3R
 lV 3R llt	Rt
VtV ;t# )r   i£  ak  `HD1K <http://hci-benchmark.iwr.uni-heidelberg.de/>`__ dataset for optical flow.

The dataset is expected to have the following structure: ::

    root
        hd1k
            hd1k_challenge
                image_2
            hd1k_flow_gt
                flow_occ
            hd1k_input
                image_2

Args:
    root (str or ``pathlib.Path``): Root directory of the HD1K Dataset.
    split (string, optional): The dataset split, either "train" (default) or "test"
    transforms (callable, optional): A function/transform that takes in
        ``img1, img2, flow, valid_flow_mask`` and returns a transformed version.
    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.
Tre   Nc          
      ót   <€ V ^8„  d   QhRS[ S[S[3,          RS[RS[S[,          RS[S[.S[3,          RR/# r™   r    )r"   r#   s   "€r$   r%   ÚHD1K.__annotate__½  sV   ø€ ÷ ñ á‘C™�IÕðñ ðñ ™XÕ&ð	ñ
 ™#˜¡˜Õ$ðð 
ñr'   c           
     ó¸  <€ \         SV `  WVR 7       \        VRRR7       \        V4      R,          pVR8X  dñ   \	        ^$4       Fà  p\        \        \        VR,          R,          VR R2,          4      4      4      p\        \        \        VR	,          R
,          VR R2,          4      4      4      p\	        \        V4      ^,
          4       FR  pV ;P                  Wh,          .,          un	        V ;P                  Wx,          Wx^,           ,          ..,          un
        KT  	  Kâ  	  M“\        \        \        VR,          R
,          R,          4      4      4      p	\        \        \        VR,          R
,          R,          4      4      4      p
\        Wš4       F   w  r¼V ;P                  W¼..,          un
        K"  	  V P                  '       g   \        R4      hR# )rl   rh   re   rm   Úhd1kÚhd1k_flow_gtrž   Ú06dz_*.pngÚ
hd1k_inputr�   Úhd1k_challengez*10.pngz*11.pngzTCould not find the HD1K images. Please make sure the directory structure is correct.Nrt   )r)   r*   r   r   rz   ry   r   r!   rQ   r+   r,   r    rŸ   )r.   r   rh   r   r   Úseq_idxr»   rº   r�   r¡   r¢   Úimage1Úimage2r/   s   &&&&&        €r$   r*   ÚHD1K.__init__½  s„  ø€ ô 	‰Ñ˜dÀ&ÐÔIä�u˜gÐ4EÕFä�D‹z˜FÕ"ˆØ�GÔä  ž9�Üœt¤C¨¨~Õ(=À
Õ(JÐPWÐX[È}Ð\bÐMcÕ(cÓ$dÓeÓf�Ü¤¤S¨°Õ)<¸yÕ)HÈgÐVYÈ]ÐZ`ÐKaÕ)aÓ%bÓ cÓd�Üœs 5›z¨A�~Ö.�AØ—O’O¨­ zÕ1•OØ×$Ò$¨&­)°VÀ½Eµ]Ð)CÐ(DÕD×$ó /ò %ô œT¤# dÐ-=Õ&=À	Õ&IÈIÕ&UÓ"VÓWÓXˆGÜœT¤# dÐ-=Õ&=À	Õ&IÈIÕ&UÓ"VÓWÓXˆGÜ"% gÖ"7‘�Ø× Ò  fÐ%5Ð$6Õ6× ñ #8ð ××ÐÜ#Øfóð ñ  r'   c                ód   <€ V ^8„  d   QhRS[ RS[S[P                  S[P                  3,          /# r2   r¨   )r"   r#   s   "€r$   r%   rê   Ü  rª   r'   c                ó   € \        V4      # r7   r¬   r8   s   &&r$   r>   ÚHD1K._read_flowÜ  r¯   r'   c                ó<   <€ V ^8„  d   QhRS[ RS[S[S[3,          /# rA   rC   )r"   r#   s   "€r$   r%   rê   ß  r„   r'   c                ó"   <€ \         SV `  V4      # )a¬  Return example at given index.

Args:
    index(int): The index of the example to retrieve

Returns:
    tuple: A 4-tuple with ``(img1, img2, flow, valid_flow_mask)`` where ``valid_flow_mask``
    is a numpy boolean mask of shape (H, W)
    indicating which flow values are valid. The flow is a numpy array of
    shape (2, H, W) and the images are PIL images. ``flow`` and ``valid_flow_mask`` are None if
    ``split="test"``.
r‡   rˆ   s   &&€r$   rM   ÚHD1K.__getitem__ß  rŠ   r'   r=   )r\   r]   r^   r_   r–   rH   r   r*   r>   rM   r`   ra   rb   rc   s   @@r$   r   r   £  sB   ù‡ € ñð. "Ðð
 Ø)-Ø'5÷õ ÷>Dð D÷*÷ *ó *r'   c                óD   € V ^8„  d   QhR\         R\        P                  /# r2   rŒ   )r"   s   "r$   r%   r%   ï  s   € ÷ 8ñ 8œð 8¤§¡ñ 8r'   c                ó
  € \        V R4      ;_uu_ 4       p\        P                  ! VR^R7      P                  4       pVR8w  d   \	        R4      h\        P                  ! VR^R7      P                  4       p\        P                  ! VR^R7      P                  4       p\        P                  ! VR^V,          V,          R7      pVP                  WC^4      P                  ^^ ^4      uuRRR4       #   + '       g   i     R# ; i)	z#Read .flo file in Middlebury formatÚrbÚc)Úcounts   PIEHz)Magic number incorrect. Invalid .flo filez<i4z<f4N)Úopenr�   ÚfromfileÚtobytesÚ
ValueErrorÚitemÚreshapeÚ	transpose)r3   ÚfÚmagicÚwÚhrW   s   &     r$   r’   r’   ï  s¾   € ô 
ˆi˜×	Ô	 !Ü—’˜A˜s¨!Ô,×4Ñ4Ó6ˆØ�GÔÜÐHÓIÐIä�KŠK˜˜5¨Ô*×/Ñ/Ó1ˆÜ�KŠK˜˜5¨Ô*×/Ñ/Ó1ˆÜ�{Š{˜1˜e¨1¨q­5°1­9Ô5ˆØ�|‰|˜A !Ó$×.Ñ.¨q°!°QÓ7÷ 
×	×	Ó	ús   •CC1Ã1D	c                óz   € V ^8„  d   QhR\         R\        \        P                  \        P                  3,          /# r2   r¨   )r"   s   "r$   r%   r%      s/   € ÷ 1ñ 1¼ð 1ÄÄrÇzÁzÔSU×S]ÑS]ÐG]ÕA^ñ 1r'   c                 ó  € \        \        V 4      4      P                  \        P                  4      pVR,          VR,          r2VR,
          ^@,          pVP                  4       pVP                  4       VP                  4       3# )ºNr   N)r  ºNNNr  )r   r  r  i €  )r   r   Útor4   Úfloat32ÚboolÚnumpy)r3   Úflow_and_validrK   rL   s   &   r$   r­   r­      si   € ä¤	¨)Ó 4Ó5×8Ñ8¼¿¹ÓG€NØ*¨8Õ4°nÀWÕ6Mˆ/Ø�5�L˜BÕ€DØ%×*Ñ*Ó,€Oð �:‰:‹<˜×.Ñ.Ó0Ð0Ð0r'   )r   r   r   r   r   ))rÛ   rw   Úabcr   r   r   Úpathlibr   Útypingr   r	   r
   r   r  r�   r4   ÚPILr   Úio.imager   r   Úfolderr   rV   r   r   Úvisionr   r©   rŽ   rE   rF   Ú__all__r   r   r   r   r   r   r’   r­   r=   r'   r$   Ú<module>r     së   ðÛ Û 	ß #Ý Ý ß 1Ó 1ã Û Ý ç ,Ý "ß ,Ý !à
ˆ5�;‰;˜Ÿ™ X¨b¯j©jÕ%9¸8ÀBÇJÁJÕ;OÐOÕP€Ø
ˆ5�;‰;˜Ÿ™ X¨b¯j©jÕ%9Ð9Õ:€ð€ô7:�#�}ô 7:ôtX$ˆ[ô X$ôvCD�ô CDôLA$�;ô A$ôHc$�[ô c$ôLI*ˆ;ô I*õX8÷"1r'   