
    bIgE6                    N    d dl mZ d dlZd dlZd dlmZ d dlmZ  G d de      Z	y)    )annotationsN)Base)expectc                      e Zd Zedd       Zedd       Zedd       Zedd       Zedd       Zedd       Z	edd       Z
edd       Zedd	       Zy
)NonMaxSuppressionc            	        t         j                  j                  dg ddg      } t        j                  g dg dg dg dg d	g d
gg      j                  t        j                        }t        j                  g dgg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  g dg dg dg      j                  t        j                        }t        | |||||g|gd       y )Nr   boxesscoresmax_output_boxes_per_classiou_thresholdscore_thresholdselected_indicesinputsoutputs        r         ?r   r   g?r   g?r   皙r   ?r   g      $@r   g      &@r   333333$@r   333333&@r         Y@r        @Y@r   g      ?333333?gffffff?      ?g333333?   r#   r   r   r   r$   r   r   r   r   r      &test_nonmaxsuppression_suppress_by_IOUr   r   name	onnxhelper	make_nodenparrayastypefloat32int64r   noder
   r   r   r   r   r   s          j/var/www/html/answerous/venv/lib/python3.12/site-packages/onnx/backend/test/case/node/nonmaxsuppression.py(export_nonmaxsuppression_suppress_by_IOUz:NonMaxSuppression.export_nonmaxsuppression_suppress_by_IOU   s<   {{$$ (( % 

  )()**,	
 &
 	 <=>?FFrzzR%'XXqc]%9%9"((%C"#..rzz:((C5/00<88Y	9$EFMMbhhW* &&9	
    c            	        t         j                  j                  dg ddg      } t        j                  g dg dg dg dg d	g d
gg      j                  t        j                        }t        j                  g dgg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  g dg dg      j                  t        j                        }t        | |||||g|gd       y )Nr   r	   r   r   r   r   r   r   r   r   r!   r$   r#   皙?r%   r&   1test_nonmaxsuppression_suppress_by_IOU_and_scoresr*   r,   r5   s          r7   3export_nonmaxsuppression_suppress_by_IOU_and_scoreszENonMaxSuppression.export_nonmaxsuppression_suppress_by_IOU_and_scores:   s:   {{$$ (( % 

  )()**,	
 &
 	 <=>?FFrzzR%'XXqc]%9%9"((%C"#..rzz:((C5/00<88Y	$:;BB288L* &&D	
r9   c            	        t         j                  j                  dg ddg      } t        j                  g dg dg dg dg d	g d
gg      j                  t        j                        }t        j                  g dgg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  g dg dg dg      j                  t        j                        }t        | |||||g|gd       y )Nr   r	   r   r   )r   r   r   r   r   )r   r   r   r   r   )r   r   r   r   )r   r    r   r   r!   r$   r#   r   r%   r&   r'   *test_nonmaxsuppression_flipped_coordinatesr*   r,   r5   s          r7   ,export_nonmaxsuppression_flipped_coordinatesz>NonMaxSuppression.export_nonmaxsuppression_flipped_coordinatesf   s<   {{$$ (( % 

  )()**,	
 &
 	 <=>?FFrzzR%'XXqc]%9%9"((%C"#..rzz:((C5/00<88Y	9$EFMMbhhW* &&=	
r9   c            	        t         j                  j                  dg ddg      } t        j                  g dg dg dg dg d	g d
gg      j                  t        j                        }t        j                  g dgg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  g dg dg      j                  t        j                        }t        | |||||g|gd       y )Nr   r	   r   r   r   r   r   r   r   r   r!      r#   r   r%   r&   (test_nonmaxsuppression_limit_output_sizer*   r,   r5   s          r7   *export_nonmaxsuppression_limit_output_sizez<NonMaxSuppression.export_nonmaxsuppression_limit_output_size   s:   {{$$ (( % 

  )()**,	
 &
 	 <=>?FFrzzR%'XXqc]%9%9"((%C"#..rzz:((C5/00<88Y	$:;BB288L* &&;	
r9   c                    t         j                  j                  dg ddg      } t        j                  g dgg      j                  t        j                        }t        j                  dggg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  d	g      j                  t        j                        }t        j                  g d
g      j                  t        j                        }t        | |||||g|gd       y )Nr   r	   r   r   r   r   r$   r#   r   r&   !test_nonmaxsuppression_single_boxr*   r,   r5   s          r7   #export_nonmaxsuppression_single_boxz5NonMaxSuppression.export_nonmaxsuppression_single_box   s   {{$$ (( % 

 /01299"**ESE7)$++BJJ7%'XXqc]%9%9"((%C"#..rzz:((C5/00<88YK077A* &&4	
r9   c                 "   t         j                  j                  dg ddg      } t        j                  g dg dg dg dg dg dg dg dg dg dg
g      j                  t        j                        }t        j                  g dgg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  d	g      j                  t        j                        }t        j                  g d
g      j                  t        j                        }t        | |||||g|gd       y )Nr   r	   r   r   r   )
r   r   r   r   r   r   r   r   r   r   r$   r#   r   r&   &test_nonmaxsuppression_identical_boxesr*   r,   r5   s          r7   (export_nonmaxsuppression_identical_boxesz:NonMaxSuppression.export_nonmaxsuppression_identical_boxes   sI   {{$$ (( % 

  )(((((((((
 &
 	  @AB

&
 	 &(XXqc]%9%9"((%C"#..rzz:((C5/00<88YK077A* &&9	
r9   c            	        t         j                  j                  dg ddgd      } t        j                  g dg dg dg d	g d
g dgg      j                  t        j                        }t        j                  g dgg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  g dg dg dg      j                  t        j                        }t        | |||||g|gd       y )Nr   r	   r      )r   r   center_point_box)r#   r#   r   r   )r#   r"   r   r   )r#   r;   r   r   )r#   g      %@r   r   )r#   g333333%@r   r   )r#   g      Y@r   r   r!   r$   r#   r   r%   r&   r'   .test_nonmaxsuppression_center_point_box_formatr*   r,   r5   s          r7   0export_nonmaxsuppression_center_point_box_formatzBNonMaxSuppression.export_nonmaxsuppression_center_point_box_format  s?   {{$$ (( % 
  )(())*	
 &
 	 <=>?FFrzzR%'XXqc]%9%9"((%C"#..rzz:((C5/00<88Y	9$EFMMbhhW* &&A	
r9   c            	     "   t         j                  j                  dg ddg      } t        j                  g dg dg dg dg d	g d
gg      j                  t        j                        }t        j                  g dg dgg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  g dg dg dg dg      j                  t        j                        }t        | |||||g|gd       y )Nr   r	   r   r   r   r   r   r   r   r   r!   rB   r#   r   r%   r&   )r   rL   r$   )r   rL   r   "test_nonmaxsuppression_two_classesr*   r,   r5   s          r7   $export_nonmaxsuppression_two_classesz6NonMaxSuppression.export_nonmaxsuppression_two_classes>  sM   {{$$ (( % 

  )()**,	
 &
 	 .0PQR

&
 	 &(XXqc]%9%9"((%C"#..rzz:((C5/00<88	9i8

&
 	 	* &&5	
r9   c            
     J   t         j                  j                  dg ddg      } t        j                  g dg dg dg dg d	g d
gg dg dg dg dg d	g d
gg      j                  t        j                        }t        j                  g dgg dgg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  dg      j                  t        j                        }t        j                  g dg dg dg dg      j                  t        j                        }t        | |||||g|gd       y )Nr   r	   r   r   r   r   r   r   r   r   r!   rB   r#   r   r%   r&   )rL   r   r$   )rL   r   r   "test_nonmaxsuppression_two_batchesr*   r,   r5   s          r7   $export_nonmaxsuppression_two_batchesz6NonMaxSuppression.export_nonmaxsuppression_two_batchesn  si   {{$$ (( % 

  )()**, )()**,
& &
' 	( ./2R1ST

&
 	 &(XXqc]%9%9"((%C"#..rzz:((C5/00<88	9i8

&
 	 	* &&5	
r9   N)returnNone)__name__
__module____qualname__staticmethodr8   r=   r@   rD   rG   rJ   rO   rR   rU    r9   r7   r   r      s    )
 )
V )
 )
V )
 )
V )
 )
V 
 
@ /
 /
b *
 *
X -
 -
^ 5
 5
r9   r   )

__future__r   numpyr0   r-   onnx.backend.test.case.baser   onnx.backend.test.case.noder   r   r\   r9   r7   <module>ra      s$    #   , .W
 W
r9   