
    Wpf                     <    d Z ddlZddlZd Zd ZdedefdZd ZdS )	z$Benchmark utils for MediaPipe Tasks.    Nc                 ,    t          j        | |          S )z4Calculate the nth percentile of the inference times.)np
percentile)inference_timesr   s     p/var/www/html/nettyfy-visnx/env/lib/python3.11/site-packages/mediapipe/tasks/python/benchmark/benchmark_utils.pynth_percentiler      s    	
	3	33    c                 *    t          j        |           S )z-Calculate the average of the inference times.)r   mean)r   s    r   averager      s    		!	!!r	   file_or_dirname_pathreturnc                     t          j        |           D ]I\  }}}||z   D ]=}t           j                            ||          }|                    |          r|c c S >Jt          d|d| d          )zDetermine the test data path.

  Args:
      test_srcdir: The path to the test source directory.
      file_or_dirname_path: The path to the file or directory.

  Returns:
      The full test data path.
  zNo z in test directory: .)oswalkpathjoinendswith
ValueError)test_srcdirr   	directorysubdirsfilesfr   s          r   get_test_data_pathr      s     $&7;#7#7  i%u_  W\\)Q''d	+	,	,  	
(<(<(<kkkJ	 	 r	   c                     | 3t           j                            |           rt          d|             | S | t          d|  d           t          d|            |S )a  Determine the model path based on the existence of the custom model.

  Args:
      custom_model: The path to the custom model provided by the user.
      default_model_path: The path to the default model.

  Returns:
      The path to the model to be used.
  NzUsing provided model: zWarning: Provided model 'z)' not found. Using default model instead.zUsing default model: )r   r   existsprint)custom_modeldefault_model_paths     r   get_model_pathr"   2   s     "'..">">	
1<
1
1222)l ) ) )   

6"4
6
6777r	   )	__doc__r   numpyr   r   r   strr   r"    r	   r   <module>r'      s{    + * 				    4 4 4
" " "
# #    (    r	   