
    =pj                         S SK JrJrJrJrJr  S SKrSSKJ	r	  SSK
JrJr  SSKJr  SSKJr  S	S
KJr  S	SKJr  \R*                   " S S\5      5       r\	" S5       " S S\5      5       rg)    )AnyDictListOptionalUnionN   )pipeline_requires_extra   )	HPIConfigPaddlePredictorOption)
TopkResult)	benchmark   )(AutoParallelImageSimpleInferencePipeline)BasePipelinec                      ^  \ rS rSrSrSSSSSSS.S\S\\   S\\   S	\\\\4      S
\\	   S\
S\\\\\4   \4      SS4U 4S jjjrS\\\\   \R                   \\R                      4   S\4S jrSrU =r$ )_ImageClassificationPipeline   zImage Classification PipelineNFdeviceengineengine_config	pp_optionuse_hpip
hpi_configconfigr   r   r   r   r   r   returnc          
         > [         TU ]  " SUUUUUUS.UD6  US   S   n	0 n
U	R                  SS5      =nb  SU0n
U R                  " U	40 U
D6U l        U	R                  SS5      U l        g)a  Initializes the image classification pipeline.

Args:
    config (Dict): Configuration dictionary containing model and other parameters.
    device (Optional[str], optional): The device to use for prediction. Defaults to `None`.
    engine (Optional[str], optional): Inference engine. Defaults to `None`.
    engine_config (Optional[Dict[str, Any]], optional): Engine-specific config. Defaults to `None`.
    pp_option (Optional[PaddlePredictorOption], optional): Paddle predictor options.
        Defaults to `None`.
    use_hpip (bool, optional): Whether to use HPIP. Defaults to `False`.
    hpi_config (Optional[Union[Dict[str, Any], HPIConfig]], optional):
        HPIP configuration. Defaults to `None`.
r   
SubModulesImageClassificationtopkN    )super__init__getcreate_modelimage_classification_modelr!   )selfr   r   r   r   r   r   r   kwargs!image_classification_model_configmodel_kwargsr!   	__class__s               u/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/paddlex/inference/pipelines/image_classification/pipeline.pyr%   %_ImageClassificationPipeline.__init__   s    2 	 	
'!	
 	
 -3<,@AV,W)599&$GGDT"D>L*.*;*;-+
1=+
' 699&!D	    inputc              +   v   #    UR                  SU R                  5      nU R                  XS9 Sh  vN   g N7f)a6  Predicts image classification results for the given input.

Args:
    input (Union[str, list[str], np.ndarray, list[np.ndarray]]): The input image(s) or path(s) to the images.
    **kwargs: Additional keyword arguments that can be passed to the function.

Returns:
    TopkResult: The predicted top k results.
r!   )r!   N)popr!   r(   )r)   r1   r*   r!   s       r.   predict$_ImageClassificationPipeline.predictK   s2      zz&$)),2252DDDs   /979)r(   r!   )__name__
__module____qualname____firstlineno____doc__r   r   strr   r   boolr   r   r%   r   npndarrayr   r4   __static_attributes____classcell__)r-   s   @r.   r   r      s    ' !% $2659AE*E*E 	*E
 *E  S#X/*E 12*E *E U4S>9#<=>*E 
*E *EXE3S	2::tBJJ7GGHE	E Er0   r   cvc                   .    \ rS rSrSr\S 5       rS rSrg)ImageClassificationPipeline\   image_classificationc                     [         $ )N)r   )r)   s    r.   _pipeline_cls)ImageClassificationPipeline._pipeline_cls`   s    ++r0   c                 2    US   S   R                  SS5      $ )Nr   r    
batch_size   )r&   )r)   r   s     r.   _get_batch_size+ImageClassificationPipeline._get_batch_sized   s     l#$9:>>|QOOr0   r#   N)	r6   r7   r8   r9   entitiespropertyrG   rL   r?   r#   r0   r.   rC   rC   \   s    %H, ,Pr0   rC   )typingr   r   r   r   r   numpyr=   
utils.depsr	   modelsr   r   "models.image_classification.resultr   utils.benchmarkr   	_parallelr   baser   time_methodsr   rC   r#   r0   r.   <module>rY      sk    4 3  2 6 < ( @  =E< =E =E@ P"J P Pr0   