
    =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)	UadResult)	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$ )_AnomalyDetectionPipeline   z'Image AnomalyDetectionPipeline PipelineNFdeviceengineengine_config	pp_optionuse_hpip
hpi_configconfigr   r   r   r   r   r   returnc          
      p   > [         T
U ]  " SUUUUUUS.UD6  US   S   n	U R                  U	5      U l        g)a  Initializes the image anomaly detection pipeline.

Args:
    config (Dict): Configuration dictionary containing various settings.
    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AnomalyDetectionN )super__init__create_modelanomaly_detetion_model)selfr   r   r   r   r   r   r   kwargsanomaly_detetion_model_config	__class__s             r/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/paddlex/inference/pipelines/anomaly_detection/pipeline.pyr#   "_AnomalyDetectionPipeline.__init__   sZ    2 	 	
'!	
 	
 )/|(<=O(P%&*&7&78U&V#    inputc              +   B   #    U R                  U5       Sh  vN   g N7f)a4  Predicts anomaly detection 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:
    UadResult: The predicted anomaly results.
Nr%   )r&   r-   r'   s      r*   predict!_AnomalyDetectionPipeline.predictE   s      ..u555s   r/   )__name__
__module____qualname____firstlineno____doc__r   r   strr   r   boolr   r   r#   r   npndarrayr   r0   __static_attributes____classcell__)r)   s   @r*   r   r      s    1 !% $2659AE$W$W 	$W
 $W  S#X/$W 12$W $W U4S>9#<=>$W 
$W $WL63S	2::tBJJ7GGH6	6 6r,   r   cvc                   .    \ rS rSrSr\S 5       rS rSrg)AnomalyDetectionPipelineT   anomaly_detectionc                     [         $ )N)r   )r&   s    r*   _pipeline_cls&AnomalyDetectionPipeline._pipeline_clsX   s    ((r,   c                 2    US   S   R                  SS5      $ )Nr   r    
batch_size   )get)r&   r   s     r*   _get_batch_size(AnomalyDetectionPipeline._get_batch_size\   s     l#$67;;L!LLr,   r!   N)	r2   r3   r4   r5   entitiespropertyrC   rI   r;   r!   r,   r*   r?   r?   T   s    "H) )Mr,   r?   )typingr   r   r   r   r   numpyr9   
utils.depsr	   modelsr   r   models.anomaly_detection.resultr   utils.benchmarkr   	_parallelr   baser   time_methodsr   r?   r!   r,   r*   <module>rV      sh    4 3  2 6 8 ( @  56 56 56p MG M Mr,   