Ë
    \;j+Ö  ã                   ó4  — d Z ddlmZmZmZ ddlZddlZddlm	Z
 ddlmZ ddlmZ d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd,d„Zd,d„Zd,d„Zd,d„Zd,d„Zd,d„Z	 d,d„Zd„ Zd„ Zd„ Zd„ Z d„ Z!d„ Z"d„ Z#d„ Z$d„ Z%d „ Z&d!„ Z'd"„ Z(d#„ Z)d$„ Z*d%„ Z+d&„ Z,d'„ Z-d(„ Z.d)„ Z/d,d*„Z0d+„ Z1y)-zJFunctions dealing with normalization of user input data to imgaug classes.é    )Úprint_functionÚdivisionÚabsolute_importNé   )Úimgaug)Údtypesé   )ÚIAugmentablec                 óö  — | €y t        j                  | «      rH| j                  dv s J d| j                  | j                  fz  «       ‚| D �cg c]  }|j                  ‘Œ c}S t	        | t
        «      sJ dt        | «      ›d�«       ‚g }| D ]h  }t	        |t        «      r|j                  |«       Œ%t        j                  |«      sJ dt        |«      ›d�«       ‚|j                  |j                  «       Œj |S c c}w )N)é   é   zZExpected array 'shapes' to be 3- or 4-dimensional, got %d dimensions and shape %s instead.z:Expected 'shapes' to be None or ndarray or list, got type ú	 instead.zRExpected each entry in list 'shapes' to be either a tuple or an ndarray, got type Ú.)	ÚiaÚis_np_arrayÚndimÚshapeÚ
isinstanceÚlistÚtypeÚtupleÚappend)ÚshapesÚimageÚresultÚshape_is       újG:\00. PROJECTS\API\Inventory\templateJSON\kerjaOCR\Lib\site-packages\imgaug/augmentables/normalization.pyÚ_preprocess_shapesr      s÷   € Ø€~ØÜ	‡~�~�fÔØ�{‰{˜fÑ$ð 	Nð/Ø28·+±+¸v¿|¹|Ð1LñMó	NÐ$ñ *0Ó0© �—“¨Ñ0Ð0ä�fœdÔ#ñ &ä˜6•lð	%ó&Ð#ð €FÛˆÜ�gœuÔ%Ø�M‰M˜'Õ"ä—>‘> 'Ô*ñ Hä7;¸Gµ}ðGóHÐ*ð �M‰M˜'Ÿ-™-Õ(ð ð €Mùò 1s   ÁC6c           	      ó|   — | €t        d|||fz  «      ‚t        | «      |k7  rt        d|||t        | «      fz  «      ‚y )Na   Tried to convert data of form '%s' to '%s'. This required %d corresponding image shapes, but argument 'shapes' was set to None. This can happen e.g. if no images were provided in a Batch, as these would usually be used to automatically derive image shapes.a÷  Tried to convert data of form '%s' to '%s'. This required exactly %d corresponding image shapes, but instead %d were provided. This can happen e.g. if more images were provided than corresponding augmentables, e.g. 10 images but only 5 segmentation maps. It can also happen if there was a misunderstanding about how an augmentable input would be parsed. E.g. if a list of N (x,y)-tuples was provided as keypoints and the expectation was that this would be parsed as one keypoint per image for N images, but instead it was parsed as N keypoints on 1 image (i.e. 'shapes' would have to contain 1 shape, but N would be provided). To avoid this, it is recommended to provide imgaug standard classes, e.g. KeypointsOnImage for keypoints instead of lists of tuples.)Ú
ValueErrorÚlen)r   ÚnÚ
from_ntypeÚto_ntypes       r   Ú_assert_exactly_n_shapesr%   $   sh   € Ø€~Üðð  *¨8°QÐ7ñ	8ó9ð 	9ô ˆ6ƒ{�aÒÜðð $ X¨q´#°f³+Ð>ñ?ó@ð 	@ð ó    c                 óZ   — | j                   |k7  rt        d|||| j                   fz  «      ‚y )NzƒTried to convert an array to list of %s. Expected that array to be of shape %s, i.e. %d-dimensional, but got %d dimensions instead.)r   r    )Úarrr   Ú	shape_strr$   s       r   Ú_assert_single_array_ndimr*   ?   s>   € Ø
‡x�x�4ÒÜð)ð ˜) T¨3¯8©8ð,6ñ6ó7ð 	7ð r&   c                 óò  — d}t        | «      dk(  rg }n5t        j                  | d   «      r| }nd}| D ��cg c]  }|D ]  }|‘Œ Œ }}}t        |D �cg c]  }|j                  |k7  ‘Œ c}«      rtt        d||||dj                  |D �cg c]  }t        |j                  «      ‘Œ c}«      dj                  |D �cg c]  }t        |j                  «      ‘Œ c}«      fz  «      ‚y c c}}w c c}w c c}w c c}w )NÚiterabler   úiterable of iterablez¥Tried to convert an %s of arrays to a list of %s. Expected each array to be of shape %s, i.e. to be %d-dimensional, but got dimensions %s instead (array shapes: %s).ú, )	r!   r   r   Úanyr   r    ÚjoinÚstrr   )Úarrsr   r)   r$   Úiterable_type_strÚ	arrs_flatÚarrs_sublistr(   s           r   Ú_assert_many_arrays_ndimr6   H   sø   € ð
 #ÐÜ
ˆ4ƒy�A‚~Ø‰	Ü	�‰˜˜Q™Ô	 Ø‰	à2ÐÙ-1ÔJ©T˜\»\°c’S¸\�S¨Tˆ	ÑJä
©	Ó2©	 ˆC�H‰H˜Ó¨	Ñ2Ô3Üð*ð " 8¨Y¸Ø—	‘	±IÓ>±I¨Sœ3˜sŸx™x�=°IÑ>Ó?Ø—	‘	±YÓ?±Y¨cœ3˜sŸy™y�>°YÑ?Ó@ð-BñBóCð 	Cð 4ùó Kùâ2ùò ?ùÚ?s   ¶C$ÁC*ÂC/Â9C4c           	      óŒ   — | j                   d   |k7  r2t        d||| j                   d   t        | j                   «      fz  «      ‚y )Néÿÿÿÿz…Tried to convert an array to a list of %s. Expected the array's last dimension to have size %d, but got %d instead (array shape: %s).)r   r    r1   )r(   Úsizer$   s      r   Ú%_assert_single_array_last_dim_exactlyr:   a   sP   € Ø
‡y�y��}˜ÒÜðð ˜$ §	¡	¨"¡¬s°3·9±9«~ð?ñ?ó@ð 	@ð r&   c                 óü  — d}t        | «      dk(  rg }n5t        j                  | d   «      r| }nd}| D ��cg c]  }|D ]  }|‘Œ Œ }}}t        |D �cg c]  }|j                  d   |k7  ‘Œ c}«      rvt        d|||dj                  |D �cg c]  }t        |j                  d   «      ‘Œ c}«      dj                  |D �cg c]  }t        |j                  «      ‘Œ c}«      fz  «      ‚y c c}}w c c}w c c}w c c}w )Nr,   r   r-   r8   z�Tried to convert an %s of array to a list of %s. Expected the arrays' last dimensions to have size %d, but got %s instead (array shapes: %s).r.   )r!   r   r   r/   r   r    r0   r1   )r2   r9   r$   r3   r4   r5   r(   s          r   Ú$_assert_many_arrays_last_dim_exactlyr<   j   s   € ð
 #ÐÜ
ˆ4ƒy�A‚~Ø‰	Ü	�‰˜˜Q™Ô	 Ø‰	à2ÐÙ-1ÔJ©T˜\»\°c’S¸\�S¨Tˆ	ÑJä
©YÓ7©Y cˆC�I‰I�b‰M˜TÓ!¨YÑ7Ô8Üð"ð " 8¨TØ—	‘	¹ÓC¹°#œ3˜sŸy™y¨™}Õ-¸ÑCÓDØ—	‘	±YÓ?±Y¨cœ3˜sŸy™y�>°YÑ?Ó@ð%BñBóCð 	Cð 9ùó Kùâ7ùò DùÚ?s   ¶C)ÁC/Â
C4Â>C9c                 ó$  — | €y t        j                  | «      rY| j                  dk(  r$| t        j                  dt        j                  f   S | j                  dk(  r| dt        j                  f   S | S t        j
                  | «      rsg }| D ]j  }|j                  dv sJ d|j                  fz  «       ‚|j                  dk(  r%|j                  |dt        j                  f   «       ŒZ|j                  |«       Œl |S t        dt        | «      ›d�«      ‚)Nr   .r   )r   r   zžGot a list of arrays as argument 'images'. Expected each array in that list to have 2 or 3 dimensions, i.e. shape (H,W) or (H,W,C). Got %d dimensions instead.zeExpected argument 'images' to be any of the following: None or array or iterable of array. Got type: r   )	r   r   r   ÚnpÚnewaxisÚis_iterabler   r    r   )Úimagesr   r   s      r   Únormalize_imagesrB   ‚   sý   € Ø€~ØÜ	‡~�~�fÔØ�;‰;˜!ÒØœ"Ÿ*™* c¬2¯:©:Ð5Ñ6Ð6Ø�;‰;˜!ÒØ˜#œrŸz™z˜/Ñ*Ð*ØˆÜ	‡~�~�fÔØˆÛˆEØ—:‘: Ñ'ð ,ðð $Ÿj™j˜]ñ+ó,Ð'ð �z‰z˜QŠØ—‘˜e C¬¯© OÑ4Õ5à—‘˜eÕ$ð ð ˆÝ
ô ��Lð	óð r&   c                 ó  — ddl m} t        |«      }t        | «      }t	        j
                  t        |d|¬«      }|dk(  ry |dk(  rGt        | ddd	«        |t        | «      ¬
«       t        | |«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S |d	k(  r| gS |dk(  ry |dk(  rGt        | ddd	«        |t        | «      ¬
«       t        | |«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S |dk(  sJ d|›d�«       ‚| S c c}}w c c}}w )Nr   )ÚHeatmapsOnImagezList[HeatmapsOnImage]©r#   r$   r   ÚNoneúarray[float]r   z	(N,H,W,C)rD   ©r"   ©r   úiterable[empty]úiterable-array[float]r   z(H,W,C)úiterable-HeatmapsOnImageú Got unknown normalization type 'ú'.)Úimgaug.augmentables.heatmapsrD   r   Úestimate_heatmaps_norm_typeÚ	functoolsÚpartialr%   r*   r!   Úzipr6   )Úinputsr   rD   ÚntypeÚ _assert_exactly_n_shapes_partialÚattr_ir   s          r   Únormalize_heatmapsrX   Ÿ   s4  € å<ä Ó'€FÜ'¨Ó/€EÜ'0×'8Ñ'8Ü ØÐ#:À6ô(KÐ$ð �‚ØØ�ÒÜ! &¨!¨[Ð:KÔLÙ(¬3¨v«;Õ7ä'*¨6°6Ô':ô<Ù':‘O�F˜Gñ   ¨gÖ6Ø':ò<ð 	<àÐ!Ò!ØˆxˆØÐ!Ò!ØØÐ'Ò'Ü  ¨¨IÐ7HÔIÙ(¬3¨v«;Õ7ä'*¨6°6Ô':ô<Ù':‘O�F˜Gñ   ¨gÖ6Ø':ò<ð 	<àÐ.Ò.ñ ;Ú27Ð9ó;Ð.à€Mùó<ùó<s   Á4C8ÃC>c                 óÌ  — ddl m} t        |«      }t        | «      }t	        j
                  t        |d|¬«      }|dk(  ry |dv rst        | ddd	«        |t        | «      ¬
«       |dk(  r't        | |«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S t        | |«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S |d	k(  r| gS |dk(  ry |dv rst        | ddd	«        |t        | «      ¬
«       |dk(  r't        | |«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S t        | |«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S |dk(  sJ d|›d�«       ‚| S c c}}w c c}}w c c}}w c c}}w )Nr   )ÚSegmentationMapsOnImagezList[SegmentationMapsOnImage]rE   rF   ©ú
array[int]úarray[uint]úarray[bool]r   z(N,H,W,#SegmapsPerImage)rZ   rH   r^   rI   rJ   ©úiterable-array[int]úiterable-array[uint]úiterable-array[bool]r   z(H,W,#SegmapsPerImage)rb   ú iterable-SegmentationMapsOnImagerM   rN   )Úimgaug.augmentables.segmapsrZ   r   Úestimate_segmaps_norm_typerQ   rR   r%   r*   r!   rS   r6   )rT   r   rZ   rU   rV   rW   r   s          r   Únormalize_segmentation_mapsrf   ¾   sÆ  € åCä Ó'€FÜ& vÓ.€EÜ'0×'8Ñ'8Ü ØÐ#BØô(Ð$ð
 �‚ØØÐ<Ñ<Ü! &¨!Ð-GØ";ô	=á(¬3¨v«;Õ7Ø�MÒ!ä),¨V°VÔ)<ô>Ù)<™˜ ñ ,¨F¸%Ö@Ø)<ò>ð >ô &)¨°Ô%8ô:Ù%8‘M�F˜Eñ (¨°eÖ<Ø%8ò:ð 	:àÐ)Ò)ØˆxˆØÐ!Ò!ØØð )ñ )ô 	! ¨Ð,DØ!:ô	<á(¬3¨v«;Õ7ØÐ*Ò*ä),¨V°VÔ)<ô>Ù)<™˜ ñ ,¨F¸%Ö@Ø)<ò>ð >ô &)¨°Ô%8ô:Ù%8‘M�F˜Eñ (¨°eÖ<Ø%8ò:ð 	:ð Ð6Ò6ñ ;Ú27Ð9ó;Ð6à€Mùó->ùó:ùó>ùó:s   Á8EÂEÃ=EÄ$E c           
      ó  — ddl m}m} t        |«      }t	        | «      }t        j                  t        |d|¬«      }|dk(  r| S |dv r]t        | ddd	«       t        | d
d	«        |t        | «      ¬«       t        | |«      D ��cg c]  \  }}|j                  ||¬«      ‘Œ c}}S |dk(  r& |d¬«        | || d   | d   ¬«      g|d   ¬«      gS |dk(  r |d¬«        || g|d   ¬«      gS |d	k(  r| gS |dk(  ry |dv r]t        | d
dd	«       t        | d
d	«        |t        | «      ¬«       t        | |«      D ��cg c]  \  }}|j                  ||¬«      ‘Œ c}}S |dk(  r2 |d¬«        || D ��	cg c]  \  }}	 |||	¬«      ‘Œ c}	}|d   ¬«      gS |dk(  r |d¬«        || |d   ¬«      gS |dk(  r| S |dk(  ry |dk(  re |t        | «      ¬«       t        | |«      D ��cg c];  \  }}|j                  t        j                   |t        j"                  ¬«      |¬«      ‘Œ= c}}S |dk(  sJ d|›d�«       ‚ |t        | «      ¬«       t        | |«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S c c}}w c c}}w c c}	}w c c}}w c c}}w )Nr   )ÚKeypointÚKeypointsOnImagezList[KeypointsOnImage]rE   rF   ©rG   r\   r]   r   z(N,K,2)ri   r   rH   rI   útuple[number,size=2]r	   ©ÚxÚyrh   rJ   ©rK   r`   ra   z(K,2)úiterable-tuple[number,size=2]úiterable-Keypointúiterable-KeypointsOnImageúiterable-iterable[empty]ú&iterable-iterable-tuple[number,size=2]©Údtypeúiterable-iterable-KeypointrM   rN   )Úimgaug.augmentables.kpsrh   ri   r   Úestimate_keypoints_norm_typerQ   rR   r%   r*   r:   r!   rS   Úfrom_xy_arrayr6   r<   r>   ÚarrayÚfloat32)
rT   r   rh   ri   rU   rV   rW   r   rm   rn   s
             r   Únormalize_keypointsr}   é   s#  € çBä Ó'€FÜ(¨Ó0€EÜ'0×'8Ñ'8Ü ØÐ#;Øô(Ð$ð
 �‚ØˆØÐ=Ñ=Ü! &¨!¨YÐ8JÔKÜ-¨f°aÐ9KÔLÙ(¬3¨v«;Õ7ô �6˜6Ô"ô
ñ #ñ �˜ð ×*Ñ*¨6¸Ð*Õ?à"ò
ð 	
ð
 Ð&Ò&Ù(¨1Õ-Ù ¡(¨V°A©Y¸&À¹)Ô"DÐ!EØ'-¨a¡yô2ð 3ð 	3à�
ÒÙ(¨1Õ-Ù  & °¸±Ô;Ð<Ð<ØÐ"Ò"ØˆxˆØÐ!Ò!ØØð )ñ )ô 	! ¨¨GÐ5GÔHÜ,¨V°QÐ8JÔKÙ(¬3¨v«;Õ7ô �6˜6Ô"ô
ñ #ñ �˜ð ×*Ñ*¨6¸Ð*Õ?à"ò
ð 	
ð
 Ð/Ò/Ù(¨1Õ-Ù ÁÔ!HÁ¹¸¸A¡(¨Q°!Ö"4ÀÒ!HØ'-¨a¡yô2ð 3ð 	3àÐ#Ò#Ù(¨1Õ-Ù  ¨v°a©yÔ9Ð:Ð:ØÐ+Ò+ØˆØÐ*Ò*ØØÐ8Ò8Ù(¬3¨v«;Õ7ô �6˜6Ô"ô
ñ
 #ñ �˜ð ×*Ñ*Ü—‘˜¤r§z¡zÔ2Øð +õ ð #ò
ð 	
ð Ð0Ò0ñ ;Ú27Ð9ó;Ð0á$¤s¨6£{Õ3ô �6˜6Ô"ô$á"ñ �˜ñ ˜V¨5Ö1à"ò$ð $ùóg
ùó,
ùó "Iùó
ùó$s   ÂI.Ä:I4Å0I:
Ç!A J ÉJc                 ó:  — ddl m}m} t        |«      }t	        | «      }t        j                  t        |d|¬«      }|dk(  ry |dv r]t        | ddd	«       t        | d
d	«        |t        | «      ¬«       t        | |«      D ��cg c]  \  }}|j                  ||¬«      ‘Œ c}}S |dk(  r. |d¬«        | || d   | d   | d   | d   ¬«      g|d   ¬«      gS |dk(  r |d¬«        || g|d   ¬«      gS |d	k(  r| gS |dk(  ry |dv r]t        | ddd	«       t        | d
d	«        |t        | «      ¬«       t        | |«      D ��cg c]  \  }}|j                  ||¬«      ‘Œ c}}S |dk(  r: |d¬«        || D ��	�
�cg c]  \  }}	}
} |||	|
|¬«      ‘Œ c}}
}	}|d   ¬«      gS |dk(  r |d¬«        || |d   ¬«      gS |dk(  r| S |dk(  ry |dk(  re |t        | «      ¬«       t        | |«      D ��cg c];  \  }}|j                  t        j                   |t        j"                  ¬«      |¬«      ‘Œ= c}}S |dk(  sJ d|›d�«       ‚ |t        | «      ¬«       t        | |«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S c c}}w c c}}w c c}}
}	}w c c}}w c c}}w )Nr   )ÚBoundingBoxÚBoundingBoxesOnImagezList[BoundingBoxesOnImage]rE   rF   rj   r   z(N,B,4)r€   r   rH   rI   útuple[number,size=4]r	   r   )Úx1Úy1Úx2Úy2r   rJ   ro   z(B,4)úiterable-tuple[number,size=4]úiterable-BoundingBoxúiterable-BoundingBoxesOnImagers   ú&iterable-iterable-tuple[number,size=4]ru   úiterable-iterable-BoundingBoxrM   rN   )Úimgaug.augmentables.bbsr   r€   r   Ú!estimate_bounding_boxes_norm_typerQ   rR   r%   r*   r:   r!   rS   Úfrom_xyxy_arrayr6   r<   r>   r{   r|   )rT   r   r   r€   rU   rV   rW   r   r‚   rƒ   r„   r…   s               r   Únormalize_bounding_boxesrŽ   2  sN  € çIä Ó'€FÜ-¨fÓ5€EÜ'0×'8Ñ'8Ü ØÐ#?Øô(Ð$ð
 �‚ØØÐ=Ñ=Ü! &¨!¨YÐ8NÔOÜ-Ø�AÐ-ô	/á(¬3¨v«;Õ7ô �6˜6Ô"ô
ñ #ñ �˜ð !×0Ñ0°¸uÐ0ÕEà"ò
ð 	
ð
 Ð&Ò&Ù(¨1Õ-á ÙØ˜a‘y V¨A¡YØ˜a‘y V¨A¡Yô0ð 1ð ˜Q‘iô	!ð
ð 	
ð �ÒÙ(¨1Õ-Ù$ f X°V¸A±YÔ?Ð@Ð@ØÐ&Ò&ØˆxˆØÐ!Ò!ØØð )ñ )ô 	! ¨¨GÐ5KÔLÜ,¨V°QÐ8NÔOÙ(¬3¨v«;Õ7ô �6˜6Ô"ô
ñ #ñ �˜ð !×0Ñ0°¸uÐ0ÕEà"ò
ð 	
ð
 Ð/Ò/Ù(¨1Õ-á á'-ö/Ù'-‘^�R˜˜R ñ   r¨b°RÖ8Ø'-ô/à˜Q‘iô!ð
ð 	
ð Ð&Ò&Ù(¨1Õ-Ù$ V°6¸!±9Ô=Ð>Ð>ØÐ/Ò/ØˆØÐ*Ò*ØØÐ8Ò8Ù(¬3¨v«;Õ7ô �6˜6Ô"ô
ñ
 #ñ �˜ð !×0Ñ0Ü—‘˜¤r§z¡zÔ2Øð 1õ ð #ò
ð 	
ð Ð3Ò3ñ ;Ú27Ð9ó;Ð3á$¤s¨6£{Õ3ô �6˜6Ô"ô$á"ñ �˜ñ ! ¨uÖ5à"ò$ð $ùóy
ùó6
ùõ/ùó
ùó$s   ÂI=ÅJÅ9J	Ç0A JÉ%Jc                 ó@   — ddl m}m} t        ||ddgt        | |¬«      S )Nr   )ÚPolygonÚPolygonsOnImagez#polysú#points©Ú
cls_singleÚcls_oiÚ
axis_namesÚestimate_ntype_funcrT   r   )Úimgaug.augmentables.polysr�   r‘   Ú$_normalize_polygons_and_line_stringsÚestimate_polygons_norm_type)rT   r   r�   r‘   s       r   Únormalize_polygonsr›   …  s(   € çBä/ØØØ˜iÐ(Ü7Ø˜fôð r&   c                 ó@   — ddl m}m} t        ||ddgt        | |¬«      S )Nr   )Ú
LineStringÚLineStringsOnImagez#linesr’   r“   )Úimgaug.augmentables.linesr�   rž   r™   Úestimate_line_strings_norm_type)rT   r   r�   rž   s       r   Únormalize_line_stringsr¡   ’  s(   € çHä/ØØ!Ø˜iÐ(Ü;Ø˜fôð r&   c                 óR  — | j                   }|j                   }d|d   ›d|d   ›d�}d|d   ›d|d   ›d�}	d|d   ›d�}
t        |«      } ||«      }t        j                  t        |d|›d�|¬	«      }|d
k(  ry |dv rjt        |d||«       t        |d|«        |t        |«      ¬«       t        ||«      D ���cg c]#  \  }} ||D �cg c]
  } | |«      ‘Œ c}|¬«      ‘Œ% c}}}S ||k(  r |d¬«        ||g|d   ¬«      gS ||k(  r|gS |dk(  ry |dv rjt        |d|	|«       t        |d|«        |t        |«      ¬«       t        ||«      D ���cg c]#  \  }} ||D �cg c]
  } | |«      ‘Œ c}|¬«      ‘Œ% c}}}S |dk(  r |d¬«        | | |«      g|d   ¬«      gS |dk(  r |d¬«        | | |«      g|d   ¬«      gS |d|›�k(  r |d¬«        |||d   ¬«      gS |d|›�k(  r|S |dk(  ry |dv rjt        |d|
|«       t        |d|«        |t        |«      ¬«       t        ||«      D ���cg c]#  \  }} ||D �cg c]
  } | |«      ‘Œ c}|¬«      ‘Œ% c}}}S |dk(  r+ |d¬«        ||D �cg c]
  } | |«      ‘Œ c}|d   ¬«      gS |dk(  r+ |d¬«        ||D �cg c]
  } | |«      ‘Œ c}|d   ¬«      gS |d|›�k(  r9 |t        |«      ¬«       t        ||«      D ��cg c]  \  }} |||¬«      ‘Œ c}}S |dk(  ry |dv sJ d|›d�«       ‚ |t        |«      ¬«       t        ||«      D ���cg c]#  \  }} ||D �cg c]
  } | |«      ‘Œ c}|¬«      ‘Œ% c}}}S c c}w c c}}}w c c}w c c}}}w c c}w c c}}}w c c}w c c}w c c}}w c c}w c c}}}w )Nz(N,r   Ú,r	   z,2)Ú(zList[Ú]rE   rF   rj   r   r   rH   rI   rJ   ro   r   rp   rq   ú	iterable-rs   ©úiterable-iterable-array[float]úiterable-iterable-array[int]úiterable-iterable-array[uint]rt   rw   úiterable-iterable-ú!iterable-iterable-iterable[empty])ú/iterable-iterable-iterable-tuple[number,size=2]ú#iterable-iterable-iterable-KeypointrM   rN   )Ú__name__r   rQ   rR   r%   r*   r:   r!   rS   r6   r<   )r”   r•   r–   r—   rT   r   Úcls_single_nameÚcls_oi_nameÚaxis_names_4_strÚaxis_names_3_strÚaxis_names_2_strrU   rV   rW   r   Úpointss                   r   r™   r™   Ÿ  s¢  € ð !×)Ñ)€OØ—/‘/�KØ(2°1«°zÀ!³}ÐEÑØ&0°£m°ZÀ³]ÐCÑØ#-¨a£=Ð2Ðä Ó'€FÙ Ó'€EÜ'0×'8Ñ'8Ü Ù²+Ð$?Øô(Ð$ð
 �‚ØØÐ=Ñ=Ü! &¨!Ð-=Ø"-ô	/ä-¨f°a¸ÔEÙ(¬3¨v«;Õ7ô �6˜6Ô"õ
ñ
 #ñ �˜ñ Ù28Ó9±&¨‘˜FÕ#°&Ñ9Øöð #ó
ð 	
ð �ÒÙ(¨1Õ-Ù˜�x v¨a¡yÔ1Ð2Ð2Ø�ÒØˆxˆØÐ!Ò!ØØð )ñ )ô 	! ¨Ð,<Ø!,ô	.ä,¨V°Q¸ÔDÙ(¬3¨v«;Õ7ô �6˜6Ô"õ
ñ #ñ �˜ñ ±VÓ<±V¨6‘J˜vÕ&°VÑ<ÀEÖJà"ó
ð 	
ð
 Ð/Ò/Ù(¨1Õ-Ù™
 6Ó*Ð+°6¸!±9Ô=Ð>Ð>ØÐ#Ò#Ù(¨1Õ-Ù™
 6Ó*Ð+°6¸!±9Ô=Ð>Ð>Ù¡/Ð3Ò4Ù(¨1Õ-Ù�v V¨A¡YÔ/Ð0Ð0Ù¡+Ð/Ò0ØˆØÐ*Ò*ØØð 2ñ 2ô 	! ¨Ð,<¸kÔJÜ,¨V°Q¸ÔDÙ(¬3¨v«;Õ7ô �6˜6Ô"õ
ñ
 #ñ �˜ñ Ù28Ó9±&¨‘˜FÕ#°&Ñ9Øöð #ó
ð 	
ð Ð8Ò8Ù(¨1Õ-á±VÓ<±V¨6‘J˜vÕ&°VÑ<Ø ™ô$ð
ð 	
ð Ð,Ò,Ù(¨1Õ-á±VÓ<±V¨6‘J˜vÕ&°VÑ<Ø ™ô$ð
ð 	
ñ ©?Ð<Ò=Ù(¬3¨v«;Õ7ô �6˜6Ô"ô
ñ #ñ �˜ñ �6 Ö'à"ò
ð 	
ð
 Ð3Ò3Øàð <ñ <ñ LâCHÐJóLð <ñ %¤s¨6£{Õ3ô ˆv�vÔõñ
 ñ ˆF�Eñ 	Ù.4Ó5©f F‰Z˜Õ¨fÑ5Øö	ð óð ùòY :ùô
ùò, =ùô
ùò4 :ùô
ùò =ùò =ùó

ùò 6ùôsr   Â;M.Ã	M)ÃM.ÅM:Å"M5Å1M:È7NÉNÉNÉ8NÊ(NË-NÌ<N"Í
NÍN"Í)M.Í5M:ÎNÎN"c                 óH  — |€| �J dt        | «      ›d�«       ‚y t        j                  |«      �rt        j                  | «      s1|j                  dk(  rt	        | |g«      S t	        | t        |«      «      S |j                  dk(  ro| j                  d   dk(  s#J d| j                  d   | j                  fz  «       ‚| j                  d   dk(  s#J d| j                  d   | j                  fz  «       ‚| d	   S |j                  dk(  r:| j                  d   dk(  s#J d
| j                  d   | j                  fz  «       ‚| d   S | S t        j                  |«      r¸g }t        | |«      D ]¥  \  }}|j                  dk(  rQ|j                  d   dk(  s#J d|j                  d   |j                  fz  «       ‚|j                  |d d …d d …df   «       Œf|j                  dk(  s J d|j                  |j                  fz  «       ‚|j                  |«       Œ§ |S t        dt        |«      ›d�«      ‚)NzbExpected (normalized) 'images' to be None due to (unnormalized) 'images_old' being None. Got type r   r   r   r	   z�Expected normalized images of shape (N,H,W,C) to have N=1 due to the unnormalized images being a single 2D image. Got instead N=%d and shape %s.r   z�Expected normalized images of shape (N,H,W,C) to have C=1 due to the unnormalized images being a single 2D image. Got instead C=%d and shape %s.)r   .r   z‹Expected normalized images of shape (N,H,W,C) to have C=1 due to unnormalized images being a single 3D image. Got instead C=%d and shape %s).r   z�Expected each image of shape (H,W,C) to have C=1 due to the corresponding unnormalized image being a 2D image. Got instead C=%d and shape %s.zMExpected 'image_old' to be three-dimensional, got %d dimensions and shape %s.ziExpected argument 'images_old' to be any of the following: None or array or iterable of array. Got type: r   )r   r   r   r   Úinvert_normalize_imagesr   r   r@   rS   r   r    )rA   Ú
images_oldr   r   Ú	image_olds        r   r·   r·     s[  € ØÐØˆ~ñ 	Oä?CÀF½|ðNó	Oˆ~ð Ü	‡~�~�jÕ!Ü�~‰~˜fÔ%ð �‰ !Ò#ô /¨v¸
°|ÓDÐDÜ*¨6´4¸
Ó3CÓDÐDà�?‰?˜aÒØ—<‘< ‘? aÒ'ð 4ð8ð —L‘L ‘O V§\¡\ð;3ñ3ó4Ð'ð
 —<‘< ‘? aÒ'ð 4ð8ð —L‘L ‘O V§\¡\ð;3ñ3ó4Ð'ð
 ˜)Ñ$Ð$Ø�?‰?˜aÒØ—<‘< ‘? aÒ'ð 4ð0ð —L‘L ‘O V§\¡\ð33ñ3ó4Ð'ð
 ˜&‘>Ð!ØˆÜ	‡~�~�jÔ!ØˆÜ # F¨JÖ 7ÑˆE�9Ø�~‰~ Ò"Ø—{‘{ 1‘~¨Ò*ð 6ð5ð Ÿ™ A™¨¯©ð85ñ5ó6Ð*ð
 —‘˜e¢A¢q¨! G™nÕ-à —~‘~¨Ò*ð :ð/à!Ÿ™¨	¯©ð29ñ9ó:Ð*ð —‘˜eÕ$ð !8ð ˆÝ
ô �Õð	ó ð  r&   c                 óŠ  — t        |«      }|dk(  r| �J dt        | «      ›d�«       ‚| S |dk(  rmt        | «      |j                  d   k(  s"J dt        | «      |j                  d   fz  «       ‚|j                  }t        | D �cg c]  }|j                  ‘Œ c}|«      S |dk(  r(t        | «      dk(  sJ dt        | «      dfz  «       ‚| d   S |d	k(  r| �J d
t        | «      ›d�«       ‚g S |dk(  r?t        |«      \  }}}|j                  }| D �cg c]  }t        |j                  |«      ‘Œ c}S |dk(  sJ d|›d�«       ‚| S c c}w c c}w )NrF   zcExpected (normalized) 'heatmaps' to be None due (unnormalized) 'heatmaps_old' being None. Got type r   rG   r   zfExpected as many heatmaps after normalization as before normalization. Got %d (after) and %d (before).rD   r	   rJ   z}Expected heatmaps after normalization to be None, due to the heatmaps before normalization being an empty iterable. Got type rK   rL   rM   rN   )rP   r   r!   r   rv   Úrestore_dtype_and_mergeÚarr_0to1Úfind_first_nonempty)ÚheatmapsÚheatmaps_oldrU   Úinput_dtypeÚhm_iÚnonemptyÚ_s          r   Úinvert_normalize_heatmapsrÄ   M  s²  € Ü'¨Ó5€EØ�‚ØÐñ 	"ô �X•ð!ó	"Ðð ˆØ�ÒÜ�8‹} × 2Ñ 2°1Ñ 5Ò5ð 	7ð=ä�H“˜|×1Ñ1°!Ñ4ð@6ñ6ó	7Ð5ð #×(Ñ(ˆÜ&Ù'/Ó0¡x˜tˆT�]‹] xÑ0Øóð 	ð Ð!Ò!Ü�8‹} Ò!ð 	#ð=ä�H“˜qð@"ñ"ó	#Ð!ð ˜‰{ÐØÐ!Ò!ØÐñ 	8ô '+¨8¥nð7ó	8Ðð ˆ	ØÐ'Ò'Ü,¨\Ó:‰ˆ�!�QØ—n‘nˆá$ó&Ù$�Dô (¨¯©°{ÕCØ$ñ&ð 	&ð Ð.Ò.ñ ;Ú27Ð9ó;Ð.à€Oùò- 1ùò"&s   Â D;Ä	E c                 ó–  — t        |«      }|dk(  r| �J dt        | «      ›d�«       ‚| S |dv rqt        | «      |j                  d   k(  s"J dt        | «      |j                  d   fz  «       ‚|j                  }t        | D �cg c]  }|j                  «       ‘Œ c}|«      S |dk(  r(t        | «      dk(  sJ dt        | «      dfz  «       ‚| d   S |d	k(  r| �J d
t        | «      ›d�«       ‚g S |dv rCt        |«      \  }}}|j                  }| D �cg c]  }t        |j                  «       |«      ‘Œ c}S |dk(  sJ d|›d�«       ‚| S c c}w c c}w )NrF   zuExpected (normalized) 'segmentation_maps' to be None due (unnormalized) 'segmentation_maps_old' being None. Got type r   r[   r   zoExpected as many segmentation maps after normalization as before normalization. Got %d (after) and %d (before).rZ   r	   rJ   z�Expected segmentation maps after normalization to be None, due to the segmentation maps before normalization being an empty iterable. Got type r_   rc   rM   rN   )re   r   r!   r   rv   r»   Úget_arrr½   )Úsegmentation_mapsÚsegmentation_maps_oldrU   rÀ   Úsegmap_irÂ   rÃ   s          r   Ú"invert_normalize_segmentation_mapsrÊ   u  sà  € ä&Ð'<Ó=€EØ�‚Ø Ð(ñ 	5ô Ð0Õ1ð4ó	5Ð(ð !Ð ØÐ<Ñ<ÜÐ$Ó%Ð)>×)DÑ)DÀQÑ)GÒGð 	Ið=äÐ%Ó&Ð(=×(CÑ(CÀAÑ(Fð@HñHó	IÐGð ,×1Ñ1ˆÜ&Ù0AÓBÑ0A HˆX×ÑÕÐ0AÑBØóð 	ð Ð)Ò)ÜÐ$Ó%¨Ò*ð 	,ð=äÐ%Ó&¨ð@+ñ+ó	,Ð*ð ! Ñ#Ð#ØÐ!Ò!Ø Ð(ñ 	Kô 15Ð5FÕ0GðJó	KÐ(ð ˆ	Øð )ñ )ô -Ð-BÓC‰ˆ�!�QØ—n‘nˆá 1ó3Ù 1�Hô (¨×(8Ñ(8Ó(:¸KÕHØ 1ñ3ð 	3ð Ð6Ò6ñ ;Ú27Ð9ó;Ð6àÐùò1 Cùò&3s   Á?EÄ!Ec           	      óÒ  — t        |«      }|dk(  r| �J dt        | «      ›d�«       ‚| S |dv rVt        | «      dk(  sJ dt        | «      fz  «       ‚|j                  }t	        | D �cg c]  }|j                  «       ‘Œ c}|«      S |dk(  r•t        | «      dk(  sJ dt        | «      fz  «       ‚t        | d	   j                  «      dk(  s J d
t        | d	   j                  «      z  «       ‚| d	   j                  d	   j                  | d	   j                  d	   j                  fS |dk(  rot        | «      dk(  sJ dt        | «      fz  «       ‚t        | d	   j                  «      dk(  s J dt        | d	   j                  «      z  «       ‚| d	   j                  d	   S |dk(  r't        | «      dk(  sJ dt        | «      fz  «       ‚| d	   S |dk(  r| �J dt        | «      ›d�«       ‚g S |dv rCt        |«      \  }}}|j                  }| D �cg c]  }t	        |j                  «       |«      ‘Œ c}S |dk(  rUt        | «      dk(  sJ dt        | «      fz  «       ‚| d	   j                  D �cg c]  }|j                  |j                  f‘Œ c}S |dk(  r1t        | «      dk(  sJ dt        | «      fz  «       ‚| d	   j                  S |dk(  r| S |dk(  r| �J dt        | «      ›d�«       ‚|d d  S |dk(  r@| D ��cg c]2  }|j                  D �cg c]  }|j                  |j                  f‘Œ c}‘Œ4 c}}S |dk(  sJ d|›d�«       ‚| D �cg c]  }|j                  d d  ‘Œ c}S c c}w c c}w c c}w c c}w c c}}w c c}w )NrF   zeExpected (normalized) 'keypoints' to be None due (unnormalized) 'keypoints_old' being None. Got type r   rj   r	   z�Expected a single KeypointsOnImage instance after normalization due to getting a single ndarray before normalization. Got %d instances instead.rk   z“Expected a single KeypointsOnImage instance after normalization due to getting a single (x,y) tuple before normalization. Got %d instances instead.r   z©Expected a KeypointsOnImage instance containing a single Keypoint after normalization due to getting a single (x,y) tuple before normalization. Got %d keypoints instead.rh   z�Expected a single KeypointsOnImage instance after normalization due to getting a single Keypoint before normalization. Got %d instances instead.z¦Expected a KeypointsOnImage instance containing a single Keypoint after normalization due to getting a single Keypoint before normalization. Got %d keypoints instead.ri   z˜Expected a single KeypointsOnImage instance after normalization due to getting a single KeypointsOnImage before normalization. Got %d instances instead.rJ   zExpected keypoints after normalization to be None, due to the keypoints before normalization being an empty iterable. Got type ro   rp   zšExpected a single KeypointsOnImage instance after normalization due to getting an iterable of (x,y) tuples before normalization. Got %d instances instead.rq   z–Expected a single KeypointsOnImage instance after normalization due to getting an iterable of Keypoint before normalization. Got %d instances instead.rr   rs   zŒExpected keypoints after normalization to be None, due to the keypoints before normalization being an empty iterable of iterables. Got type rt   rw   rM   rN   )
ry   r   r!   rv   r»   Úto_xy_arrayÚ	keypointsrm   rn   r½   )	rÍ   Úkeypoints_oldrU   rÀ   ÚkpsoirÂ   rÃ   Úkps_iÚkps	            r   Úinvert_normalize_keypointsrÒ      sm  € Ü(¨Ó7€EØ�‚ØÐ ñ 	#ô �Y•ð"ó	#Ð ð ÐØÐ=Ñ=Ü�9‹~ Ò"ð 	=ð(ä+.¨y«>Ð*;ñ<ó	=Ð"ð $×)Ñ)ˆÜ&Ù.7Ó8©i UˆU×ÑÕ ¨iÑ8Øóð 	ð Ð&Ò&Ü�9‹~ Ò"ð 	=ð(ä+.¨y«>Ð*;ñ<ó	=Ð"ô �9˜Q‘<×)Ñ)Ó*¨aÒ/ð 	ð>ô �I˜a‘L×*Ñ*Ó+ñó	Ð/ð ˜!‘×&Ñ& qÑ)×+Ñ+Ø˜!‘×&Ñ& qÑ)×+Ñ+ð-ð 	-à�
ÒÜ�9‹~ Ò"ð 	=ð(ä+.¨y«>Ð*;ñ<ó	=Ð"ô �9˜Q‘<×)Ñ)Ó*¨aÒ/ð 	ð>ô �I˜a‘L×*Ñ*Ó+ñó	Ð/ð ˜‰|×%Ñ% aÑ(Ð(ØÐ"Ò"Ü�9‹~ Ò"ð 	=ð(ä+.¨y«>Ð*;ñ<ó	=Ð"ð ˜‰|ÐØÐ!Ò!ØÐ ñ 	Cô 15°YµðBó	CÐ ð ˆ	Øð )ñ )ô -¨]Ó;‰ˆ�!�QØ—n‘nˆñ #ó$á"�ô $ E×$5Ñ$5Ó$7¸ÕEØ"ñ$ð 	$ð Ð/Ò/Ü�9‹~ Ò"ð 	Lð7ä:=¸i».Ð9JñKó	LÐ"ð
 $-¨Q¡<×#9Ò#9ó;Ù#9˜RˆR�T‰T�2—4‘4ŠLÐ#9ñ;ð 	;àÐ#Ò#Ü�9‹~ Ò"ð 	Lð7ä:=¸i».Ð9JñKó	LÐ"ð ˜‰|×%Ñ%Ð%ØÐ+Ò+ØÐØÐ*Ò*ØÐ ñ 	Pô >BÀ)½_ðOó	PÐ ð ™QÐÐØÐ8Ò8ñ #ô$á"�ð %*§O¢OÓ4¡O˜bˆb�d‰d�B—D‘DŠ\ OÓ4Ø"ò$ð 	$ð Ð0Ò0ñ ;Ú27Ð9ó;Ð0á,5Ó6©I 5ˆE�O‰O™AÒ¨IÑ6Ð6ùòW 9ùòX$ùò;ùò$ 5ùó$ùò 7s0   Á$M
Ç=!MÉMË"MË5MÌMÌ1M$ÍMc                 ó:  — t        |«      }|dk(  r| �J dt        | «      ›d�«       ‚| S |dv rVt        | «      dk(  sJ dt        | «      fz  «       ‚|j                  }t	        | D �cg c]  }|j                  «       ‘Œ c}|«      S |dk(  r�t        | «      dk(  sJ dt        | «      fz  «       ‚t        | d	   j                  «      dk(  s J d
t        | d	   j                  «      z  «       ‚| d	   j                  d	   }|j                  |j                  |j                  |j                  fS |dk(  rot        | «      dk(  sJ dt        | «      fz  «       ‚t        | d	   j                  «      dk(  s J dt        | d	   j                  «      z  «       ‚| d	   j                  d	   S |dk(  r't        | «      dk(  sJ dt        | «      fz  «       ‚| d	   S |dk(  r| �J dt        | «      ›d�«       ‚g S |dv rCt        |«      \  }}}|j                  }| D �cg c]  }t	        |j                  «       |«      ‘Œ c}S |dk(  rkt        | «      dk(  sJ dt        | «      fz  «       ‚| d	   j                  D �cg c]0  }|j                  |j                  |j                  |j                  f‘Œ2 c}S |dk(  r1t        | «      dk(  sJ dt        | «      fz  «       ‚| d	   j                  S |dk(  r| S |dk(  r| �J dt        | «      ›d�«       ‚|d d  S |dk(  rV| D ��cg c]H  }|j                  D �cg c]0  }|j                  |j                  |j                  |j                  f‘Œ2 c}‘ŒJ c}}S |dk(  sJ d|›d�«       ‚| D �cg c]  }|j                  d d  ‘Œ c}S c c}w c c}w c c}w c c}w c c}}w c c}w )NrF   zoExpected (normalized) 'bounding_boxes' to be None due (unnormalized) 'bounding_boxes_old' being None. Got type r   rj   r	   z“Expected a single BoundingBoxesOnImage instance after normalization due to getting a single ndarray before normalization. Got %d instances instead.r�   zŸExpected a single BoundingBoxesOnImage instance after normalization due to getting a single (x1,y1,x2,y2) tuple before normalization. Got %d instances instead.r   z½Expected a BoundingBoxesOnImage instance containing a single BoundingBox after normalization due to getting a single (x1,y1,x2,y2) tuple before normalization. Got %d bounding boxes instead.r   z—Expected a single BoundingBoxesOnImage instance after normalization due to getting a single BoundingBox before normalization. Got %d instances instead.zµExpected a BoundingBoxesOnImage instance containing a single BoundingBox after normalization due to getting a single BoundingBox before normalization. Got %d bounding boxes instead.r€   z Expected a single BoundingBoxesOnImage instance after normalization due to getting a single BoundingBoxesOnImage before normalization. Got %d instances instead.rJ   z‰Expected bounding boxes after normalization to be None, due to the bounding boxes before normalization being an empty iterable. Got type ro   r†   z¨Expected a single BoundingBoxesOnImage instance after normalization due to getting a an iterable of (x1,y1,x2,y2) tuples before normalization. Got %d instances instead.r‡   z�Expected a single BoundingBoxesOnImage instance after normalization due to getting an iterable of BoundingBox before normalization. Got %d instances instead.rˆ   rs   z–Expected bounding boxes after normalization to be None, due to the bounding boxes before normalization being an empty iterable of iterables. Got type r‰   rŠ   rM   rN   )Úestimate_normalization_typer   r!   rv   r»   Úto_xyxy_arrayÚbounding_boxesr‚   rƒ   r„   r…   r½   )rÖ   Úbounding_boxes_oldrU   rÀ   ÚbbsoiÚbbrÂ   rÃ   s           r   Úinvert_normalize_bounding_boxesrÚ   ý  sÃ  € Ü'Ð(:Ó;€EØ�‚ØÐ%ñ 	2ô ˜~Õ.ð1ó	2Ð%ð ÐØÐ=Ñ=Ü�>Ó" aÒ'ð 	'ð7ô �NÓ#ð:&ñ&ó	'Ð'ð
 )×.Ñ.ˆÜ&Ù/=ó(
Ù/= eˆE×ÑÕ!¨~ñ(
àóð 	ð Ð&Ò&Ü�>Ó" aÒ'ð 	'ð7ô �NÓ#ð:&ñ&ó	'Ð'ô
 �> !Ñ$×3Ñ3Ó4¸Ò9ð 	Bðô ˜n¨QÑ/×>Ñ>Ó?ñAó	BÐ9ð
 ˜AÑ×-Ñ-¨aÑ0ˆØ�u‰u�b—e‘e˜RŸU™U B§E¡EÐ)Ð)Ø�ÒÜ�>Ó" aÒ'ð 	'ð7ô �NÓ#ð:&ñ&ó	'Ð'ô
 �> !Ñ$×3Ñ3Ó4¸Ò9ð 	Bðô ˜n¨QÑ/×>Ñ>Ó?ñAó	BÐ9ð
 ˜aÑ ×/Ñ/°Ñ2Ð2ØÐ&Ò&Ü�>Ó" aÒ'ð 	'ð>ô �NÓ#ðA&ñ&ó	'Ð'ð
 ˜aÑ Ð ØÐ!Ò!ØÐ%ñ 	Hô 15°^Õ0DðGó	HÐ%ð ˆ	Øð )ñ )ô -Ð-?Ó@‰ˆ�!�QØ—n‘nˆñ (ó)á'�ô $ E×$7Ñ$7Ó$9¸;ÕGØ'ñ)ð 	)ð Ð/Ò/Ü�>Ó" aÒ'ð 	'ðEô �NÓ#ðH&ñ&ó	'Ð'ð % QÑ'×6Ò6ó8á6�ð �U‰U�B—E‘E˜2Ÿ5™5 "§%¡%Ò(Ø6ñ8ð 	8ð Ð&Ò&Ü�>Ó" aÒ'ð 	'ð7ô �NÓ#ð:&ñ&ó	'Ð'ð
 ˜aÑ ×/Ñ/Ð/ØÐ/Ò/ØÐØÐ*Ò*ØÐ%ñ 	(ô �^Õ$ð'ó	(Ð%ð
 "¡!Ð$Ð$ØÐ8Ò8ñ (ô)á'�ð 5:×4HÒ4HÓIÑ4H¨bˆb�e‰e�R—U‘U˜BŸE™E 2§5¡5Ò)Ð4HÓIØ'ò)ð 	)ð Ð3Ò3ñ ;Ú27Ð9ó;Ð3á1?Ó@±¨ˆE× Ñ ¡Ò#°Ñ@Ð@ùòc(
ùò\)ùò8ùò* Jùó)ùò As0   Á$M>È!NÉ!5NÌ NÌ5NÍNÍ%NÎNc           	      ó0   — t        | |t        ddd„ d„ «      S )Nr�   r‘   c                 ó   — | j                   S ©N©Úpolygons)Úpsois    r   Ú<lambda>z+invert_normalize_polygons.<locals>.<lambda>e  ó   € �T—]’]r&   c                 ó   — | j                   S rÝ   )Úexterior)Úpolys    r   rá   z+invert_normalize_polygons.<locals>.<lambda>f  râ   r&   )Ú+_invert_normalize_polygons_and_line_stringsrš   )rß   Úpolygons_olds     r   Úinvert_normalize_polygonsrè   `  s#   € Ü6Ø�,Ô ;ØØÙ"Ù"ó$ð $r&   c           	      ó0   — t        | |t        ddd„ d„ «      S )Nr�   rž   c                 ó   — | j                   S rÝ   ©Úline_strings)Úlsois    r   rá   z/invert_normalize_line_strings.<locals>.<lambda>n  s
   € �T×&Ò&r&   c                 ó   — | j                   S rÝ   )Úcoords)Úlss    r   rá   z/invert_normalize_line_strings.<locals>.<lambda>o  s   € �2—9’9r&   )ræ   r    )rì   Úline_strings_olds     r   Úinvert_normalize_line_stringsrò   i  s$   € Ü6ØÐ&Ô(GØØÙ&Ùóð r&   c                 óè
  — ddl m}  ||«      }|dk(  r| �J dt        | «      ›d�«       ‚| S |dv rB|j                  }	t	        | D �
�cg c]  }
 ||
«      D �cg c]
  } ||«      ‘Œ c}‘Œ  c}}
|	«      S ||k(  rit        | «      dk(  sJ d||t        | «      fz  «       ‚t         || d   «      «      dk(  s J d	|||t         || d   «      «      fz  «       ‚ || d   «      d   S ||k(  r)t        | «      dk(  sJ d||t        | «      fz  «       ‚| d   S |d
k(  r| �J dt        | «      ›d�«       ‚g S |dv rQt        |«      \  }}}|j                  }	| D �
�cg c](  }
t	         ||
«      D �cg c]
  } ||«      ‘Œ c}|	«      ‘Œ* c}}
S |dk(  r|t        | «      dk(  sJ d|t        | «      fz  «       ‚t         || d   «      «      dk(  sJ d||||t        | «      fz  «       ‚ | || d   «      d   «      D �cg c]  }|d   |d   f‘Œ c}S |dk(  r‚t        | «      dk(  sJ d|t        | «      fz  «       ‚t         || d   «      «      dk(  sJ d||||t        | «      fz  «       ‚ | || d   «      d   «      D �cg c]  } ||d   |d   ¬«      ‘Œ c}S |d|›�k(  rht        | «      dk(  sJ d||t        | «      fz  «       ‚t         || d   «      «      t        |«      k(  sJ d|||||t        | «      fz  «       ‚ || d   «      S |d|›�k(  r| S |dk(  r| �J dt        | «      ›d�«       ‚|d d  S |dv rQt        |«      \  }}}|j                  }	| D �
�cg c](  }
 ||
«      D �cg c]  }t	         ||«      |	«      ‘Œ c}‘Œ* c}}
S |dk(  rZt        | «      dk(  sJ d|t        | «      fz  «       ‚ || d   «      D ��cg c]   } ||«      D �cg c]  }|d   |d   f‘Œ c}‘Œ" c}}S |dk(  r`t        | «      dk(  sJ d|t        | «      fz  «       ‚ || d   «      D ��cg c]&  } ||«      D �cg c]  } ||d   |d   ¬«      ‘Œ c}‘Œ( c}}S |d|›�k(  r| D �
cg c]
  }
 ||
«      ‘Œ c}
S |dk(  r|d d  S |d k(  rF| D �
��cg c]6  }
 ||
«      D ��cg c]   } ||«      D �cg c]  }|d   |d   f‘Œ c}‘Œ" c}}‘Œ8 c}}}
S |d!k(  sJ d"|›d#�«       ‚| D �
��cg c]<  }
 ||
«      D ��cg c]&  } ||«      D �cg c]  } ||d   |d   ¬«      ‘Œ c}‘Œ( c}}‘Œ> c}}}
S c c}w c c}}
w c c}w c c}}
w c c}w c c}w c c}w c c}}
w c c}w c c}}w c c}w c c}}w c c}
w c c}w c c}}w c c}}}
w c c}w c c}}w c c}}}
w )$Nr   )rh   rF   zuExpected (normalized) polygons/line strings to be None due (unnormalized) polygons/line strings being None. Got type r   rj   r	   z|Expected a single %s instance after normalization due to getting a single %s before normalization. Got %d instances instead.zŒExpected a %s instance containing a single %s after normalization due to getting a single %s before normalization. Got %d instances instead.rJ   z—Expected polygons/line strings after normalization to be None, due to the polygons/line strings before normalization being an empty iterable. Got type ro   rp   zŒExpected a single %s instance after normalization due to getting an iterable of (x,y) tuples before normalization. Got %d instances instead.z²Expected a %s instance after normalization containing a single %s instance due to getting an iterable of (x,y) tuples before normalization. Got a %s with %d %s instances instead.rq   zˆExpected a single %s instance after normalization due to getting an iterable of Keypoint before normalization. Got %d instances instead.z®Expected a %s instance after normalization containing a single %s instance due to getting an iterable of Keypoint before normalization. Got a %s with %d %s instances instead.rl   r¦   z‚Expected a single %s instance after normalization due to getting an iterable of %s before normalization. Got %d instances instead.z¨Expected a %s instance after normalization containing a single %s instance due to getting an iterable of %s before normalization. Got a %s with %d %s instances instead.rs   z¤Expected polygons/line strings after normalization to be None, due to the polygons/line strings before normalization being an empty iterable of iterables. Got type r§   rt   z™Expected a single %s instance after normalization due to getting an iterable of iterables of (x,y) tuples before normalization. Got %d instances instead.rw   z•Expected a single %s instance after normalization due to getting an iterable of iterables of Keypoint before normalization. Got %d instances instead.r«   r¬   r­   r®   rM   rN   )rx   rh   r   rv   r»   r!   r½   )rT   Ú
inputs_oldr—   r°   r±   Úget_entities_funcÚget_points_funcrh   rU   rÀ   ÚoiÚentityrÂ   rÃ   Úpoints                  r   ræ   ræ   r  sì  € õ 1á 
Ó+€EØ�‚Øˆ~ñ 	*ô ˜v�,ð)ó	*ˆ~ð ˆØÐ=Ñ=Ø ×&Ñ&ˆÜ&áô(
á�ñ 4EÀRÔ3HÓIÑ3H¨‰_˜VÕ$Ð3HÓIØò(
ð óð 	ð �ÒÜ�6‹{˜aÒð 	=ð(ð ˜_¬c°&«kð+<ñ<ó	=Ðô
 Ñ$ V¨A¡YÓ/Ó0°AÒ5ð 	4ð>ð ˜_¨oÜÑ% f¨Q¡iÓ0Ó1ðA3ñ3ó	4Ð5ñ ! ¨¡Ó+¨AÑ.Ð.Ø�ÒÜ�6‹{˜aÒð 	9ð(ð ˜[¬#¨f«+ð+8ñ8ó	9Ðð
 �a‰yÐØÐ!Ò!Øˆ~ñ 	Fô 7;¸6µlðEó	Fˆ~ð ˆ	Øð )ñ )ô -¨ZÓ8‰ˆ�!�QØ—n‘nˆñ
 ô	
ñ �ô $Ù7HÈÔ7LÓMÑ7L¨V‘ Õ(Ð7LÑMØõð ò	
ð 	
ð Ð/Ò/Ü�6‹{˜aÒð 	,ð7ð œS ›[ð:+ñ+ó	,Ðô
 Ñ$ V¨A¡YÓ/Ó0°AÒ5ð 	ð5ð ˜_¨k¸?Ü�F“ð8ñó	Ð5ñ -Ñ->¸vÀa¹yÓ-IÈ!Ñ-LÔMóOÙM�Eð �q‘˜5 ™8Ò$ØMñOð 	OàÐ#Ò#Ü�6‹{˜aÒð 	,ð7ð œS ›[ð:+ñ+ó	,Ðô
 Ñ$ V¨A¡YÓ/Ó0°AÒ5ð 	ð5ð ˜_¨k¸?Ü�F“ð8ñó	Ð5ñ -Ñ->¸vÀa¹yÓ-IÈ!Ñ-LÔMóOÙM�Eñ ˜5 ™8 u¨Q¡xÖ0ØMñOð 	Oá¡/Ð3Ò4Ü�6‹{˜aÒð 	=ð7ð ˜_¬c°&«kð:<ñ<ó	=Ðô
 Ñ$ V¨A¡YÓ/Ó0´C¸
³OÒCð 	0ð5ð ˜_¨o¸{Ø¤ V£ð8/ñ/ó	0ÐCñ ! ¨¡Ó+Ð+Ù¡+Ð/Ò0ØˆØÐ*Ò*Øˆ~ñ 	 ô �V•ðó	 ˆ~ð
 ™!ˆ}ÐØð 2ñ 2ô -¨ZÓ8‰ˆ�!�QØ—n‘nˆñ ô
ñ �ñ -¨RÔ0ó2Ù0�ô %¡_°VÓ%<¸kÕJØ0ó2àò
ð 	
ð
 Ð8Ò8Ü�6‹{˜aÒð 	,ð7ð œS ›[ð:+ñ+ó	,Ðñ ,¨F°1©IÔ6ô8á6�ñ 0?¸vÔ/FÓGÑ/F eˆe�A‰h˜˜a™Ò!Ð/FÓGØ6ò8ð 	8ð Ð,Ò,Ü�6‹{˜aÒð 	,ð7ð œS ›[ð:+ñ+ó	,Ðñ ,¨F°1©IÔ6ô8ñ 7�ñ *¨&Ô1ó3Ù1�ñ ˜˜a™ E¨!¡HÖ-Ø1ó3à6ò8ð 	8ñ ©?Ð<Ò=Ù06Ó7±¨"Ñ! "Õ%°Ñ7Ð7ØÐ3Ò3Ø™!ˆ}ÐØÐAÒAñ õñ �ñ 0°Ô3ôñ
 4�Fñ "1°Ô!8óá!8˜ð ˜1‘X˜u Q™xÒ(Ø!8óð 4ôð óð 	ð Ð9Ò9ñ ;Ú27Ð9ó;Ð9ñ õñ ˆBñ ,¨BÔ/ô	
ñ
 0�ñ -¨VÔ4óá4�Eñ ˜5 ™8 u¨Q¡xÖ0Ø4óð 0ô	
ð óð ùòW Jùó(
ùòJ Nùó
ùò&OùòOùò>2ùó
ùò Hùó8ùò3ùó8ùò
 8ùòùóùôùòùó	
ùôsÞ   ÁT
ÁT
Á$T
ÅTÅ#TÅ2
TÇ-T É.T%ÍT/ÍT*Í.T/Î-T:Î<T5ÏT:ÐUÐU Ð2UÑUÑ.UÑ>UÒUÒUÒ#UÓU-ÓU'Ó#U"Ó:U'Ó?U-Ô
T
ÔTÔ*T/Ô5T:Õ UÕUÕUÕ"U'Õ'U-c                 óL   — | |v s J d|›ddj                  |«      ›d| ›d�«       ‚y )Nz&Got an unknown datatype for argument 'z'. Expected datatypes were: r.   z. Got: r   )r0   )Útype_strÚvalid_type_strsÚarg_names      r   Ú_assert_is_of_norm_typerþ     s.   € Ø�Ñ&ñ =ò �d—i‘i Õ0²(ð	<ó=Ñ&r&   c                 ó>   — t        | «      }g d¢}t        ||d«       |S )N)rF   rG   rD   rJ   rK   rL   r¾   ©rÔ   rþ   )r¾   rû   rü   s      r   rP   rP   "  s&   € Ü*¨8Ó4€Hò€Oô ˜H o°zÔBØ€Or&   c                 ó>   — t        | «      }g d¢}t        ||d«       |S )N)
rF   r\   r]   r^   rZ   rJ   r`   ra   rb   rc   rÇ   r   )rÇ   rû   rü   s      r   re   re   0  s+   € Ü*Ð+<Ó=€Hò€Oô Ø�/Ð#6ô8à€Or&   c                 ó>   — t        | «      }g d¢}t        ||d«       |S )N)rF   rG   r\   r]   rk   rh   ri   rJ   rK   r`   ra   rp   rq   rr   rs   rt   rw   rÍ   r   )rÍ   rû   rü   s      r   ry   ry   C  s&   € Ü*¨9Ó5€Hò€Oô& ˜H o°{ÔCØ€Or&   c                 ó>   — t        | «      }g d¢}t        ||d«       |S )N)rF   rG   r\   r]   r�   r   r€   rJ   rK   r`   ra   r†   r‡   rˆ   rs   r‰   rŠ   rÖ   r   )rÖ   rû   rü   s      r   rŒ   rŒ   \  s*   € Ü*¨>Ó:€Hò€Oô& Ø�/Ð#3ô5à€Or&   c                 ó   — t        | ddd«      S )Nr�   r‘   rß   ©Ú._estimate_polygons_and_line_segments_norm_typerÞ   s    r   rš   rš   v  s   € Ü9Ø�)Ð.°
ó<ð <r&   c                 ó   — t        | ddd«      S )Nr�   rž   rì   r  rë   s    r   r    r    {  s   € Ü9Ø�lÐ$8¸.óJð Jr&   c                 ó|   — t        | «      }dddd||ddddd	d
d|›�d|›�ddddddd|›�dddg}t        |||«       |S )NrF   rG   r\   r]   rJ   rK   r`   ra   rp   rq   r¦   rs   r¨   r©   rª   rt   rw   r«   r¬   r­   r®   r   )rT   r°   r±   Úaugmentable_namerû   rü   s         r   r  r  €  sz   € ô +¨6Ó2€HàØØØØØØØØØØ'ÙÙ(Ñ*Ù$Ð&Ø"Ø(Ø&Ø'Ø0Ù$Ù"1Ð3Ø+Ø9Ø-ð1€Oô4 ˜H oÐ7GÔHØ€Or&   c                 ó>   — t        | «      \  }}}t        |||«      }|S rÝ   )r½   Ú_nonempty_info_to_type_str)rT   rÂ   ÚsuccessÚparentsrû   s        r   rÔ   rÔ   ¢  s&   € Ü!4°VÓ!<Ñ€Hˆg�wÜ)¨(°G¸WÓE€HØ€Or&   c                 óL  — t        | t        «      r^| D �cg c]  }t        ||«      ‘Œ } }| D �cg c]  }|j                  ‘Œ }}t	        t        |«      «      dk(  rt        j                  | «      } t        j                  | «      rt        j                  | |«      } | S c c}w c c}w )Nr	   )r   r   r»   r   r!   Úsetr>   r{   r   r   ÚiadtÚrestore_dtypes_)r(   rÀ   Úarr_ir   s       r   r»   r»   ¨  s”   € Ü�#”tÔáó!Ù�5ô ' u¨kÕ:Øð 	ð !á+.Ó/©3 %�%—+“+¨3ˆÐ/ÜŒs�6‹{Ó˜qÒ Ü—(‘(˜3“-ˆCä	‡~�~�cÔÜ×"Ñ" 3¨Ó4ˆØ€Jùò!ùâ/s
   •B®B!c                 ó    — t        j                  | «      xr8 t        | t        «       xr% t	        | d«       xr t        j
                  | «       S )Nrï   )r   r@   r   r
   ÚhasattrÚ	is_string)Úobjs    r   Ú_is_iterabler  µ  sM   € ä
�‰�sÓò 	"Ü˜3¤Ó-Ð-ò	"ä˜˜XÓ&Ð&ò	"ô —‘˜SÓ!Ð!ð	r&   c                 ó<  — |€g }| �t        j                  | «      r| d|fS t        | «      rmt        | «      dk(  rd d|fS | d   | u r| d|fS d }d}|}| D ]>  }t	        ||| gz   ¬«      \  }}}|r|||fc S t        |«      t        |«      kD  sŒ9|}|}|}Œ@ |||fS | d|fS )NTr   F)r  )r   r   r  r!   r½   )	Úattrr  Únonempty_deepestÚsuccess_deepestÚparents_deepestrW   rÂ   r  Úparents_founds	            r   r½   r½   ¾  sí   € Ø€Øˆà€|”r—~‘~ dÔ+Ø�T˜7Ð"Ð"ô �DÔÜˆt‹9˜Š>Ø˜ Ð'Ð'ð
 �‰7�d‰?Ø˜˜wÐ&Ð&ð  ÐØˆØ!ˆÛˆFÜ/BØ ¨¨¡ô00Ñ,ˆH�g˜}áð   ¨-Ð7Ò7Ü�=Ó!¤C¨Ó$8Ó8Ø#+Ð Ø")�Ø"/‘ð ð   °/ÐAÐAà��wÐÐr&   c                 óJ  — t        |«      dk  sJ dt        |«      fz  «       ‚d}t        |«      dkD  r!dj                  dgt        |«      z  «      ›d�}|s|›d�S t        |«      dk\  xr t        |d	   t        «      }|r™t        |d	   «      dkD  xr/ t	        |d	   D �cg c]  }t        j                  |«      ‘Œ c}«      }|rUdj                  dgt        |«      dz
  z  «      }d
t        |d	   «      fz  }dj                  ||g«      j                  d«      S | €yt        j                  | «      r1| j                  j                  }dddddœ}	|›d||	v r|	|   ›d�S |›d�S t        | t        «      sJ dt        | «      ›d�«       ‚|›| j                  j                  ›�S c c}w )Nr   z%Expected 'parents' to be <=4, got %d.Ú r   Ú-r,   rJ   r	   r8   ztuple[number,size=%d]rF   ÚfloatÚuintÚintÚbool)ÚfÚuÚiÚbzarray[r¥   z.Expected 'nonempty' to be an object, got type r   )r!   r0   r   r   Úallr   Úis_single_numberÚlstripr   rv   ÚkindÚobjectr   Ú	__class__r¯   )
rÂ   r  r  Úparent_itersÚis_parent_tupleÚvalÚis_only_numbers_in_tupleÚtpl_namer,  Úkind_maps
             r   r  r  é  sÔ  € Üˆw‹<˜1Òð ÐEÜˆG‹ðIñ ó Ðà€LÜ
ˆ7ƒ|�aÒØ #§¡¨*¨¼¸G»Ñ)DÕ EÐGˆáÚ&2Ð4Ð4ô 	ˆG‹˜Ñò 	+Ü�w˜r‘{¤EÓ*ð ñ
 ä�˜‘Ó˜qÑ ò GÜ¸ÀºÓE¹°#”R×(Ñ(¨Õ-¸ÑEÓFð 	!ñ
 $ØŸ8™8 Z L´C¸³LÀ±NÑ$CÓDˆLØ.´#°g¸b±kÓ2BÐ1DÑDˆHØ—8‘8˜\¨8Ð4Ó5×<Ñ<¸SÓAÐAàÐØÜ	‡~�~�hÔØ�~‰~×"Ñ"ˆØ  v°EÀÑGˆâ¨D°HÑ,<˜( 4™.ÑFðHð 	HØBFÑFðHð 	Hô
 �h¤Ô'ñ ä��Nð	óÐ'ñ " 8×#5Ñ#5×#>Ò#>Ð?Ð?ùò+ Fs   ÂF rÝ   )2Ú__doc__Ú
__future__r   r   r   rQ   Únumpyr>   r  r   r   r   r  Úbaser
   r   r%   r*   r6   r:   r<   rB   rX   rf   r}   rŽ   r›   r¡   r™   r·   rÄ   rÊ   rÒ   rÚ   rè   rò   ræ   rþ   rP   re   ry   rŒ   rš   r    r  rÔ   r»   r  r½   r  © r&   r   Ú<module>r:     sê   ðÙ Pß @Ñ @Û ã å Ý Ý òò0@ò67òCò2@òCò0ó:ó>(óVF$óRP$óf
ó
ð 9=ókò\= ò@%òP(òVZ7òz`AòF$òòfòR=òòò&ò2ò4<ò
Jò
òDò
òó(óV'@r&   