
    9i                         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  SSK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   )	UadResult)	benchmark)	HPIConfig)PaddlePredictorOption   )(AutoParallelImageSimpleInferencePipeline)BasePipelinec                      ^  \ rS rSrSr    SS\S\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 PipelineNconfigdevice	pp_optionuse_hpip
hpi_configreturnc                 ^   > [         TU ]  X#XES9  US   S   nU R                  U5      U l        g)aZ  Initializes the image anomaly detection pipeline.

Args:
    config (Dict): Configuration dictionary containing various settings.
    device (str, optional): Device to run the predictions on. Defaults to None.
    pp_option (PaddlePredictorOption, optional): PaddlePredictor options. Defaults to None.
    use_hpip (bool, optional): Whether to use the high-performance
        inference plugin (HPIP) by default. Defaults to False.
    hpi_config (Optional[Union[Dict[str, Any], HPIConfig]], optional):
        The default high-performance inference configuration dictionary.
        Defaults to None.
)r   r   r   r   
SubModulesAnomalyDetectionN)super__init__create_modelanomaly_detetion_model)selfr   r   r   r   r   anomaly_detetion_model_config	__class__s          v/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddlex/inference/pipelines/anomaly_detection/pipeline.pyr   "_AnomalyDetectionPipeline.__init__    sC    * 	 	 	
 )/|(<=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(   kwargss      r%   predict!_AnomalyDetectionPipeline.predict<   s      ..u555s   r*   )NNFN)__name__
__module____qualname____firstlineno____doc__r   strr   boolr   r   r   r   r   r   npndarrayr   r,   __static_attributes____classcell__)r$   s   @r%   r   r      s    1
 +/AEWW W )	W
 W U4S>9#<=>W 
W W8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)AnomalyDetectionPipelineK   anomaly_detectionc                     [         $ )N)r   )r"   s    r%   _pipeline_cls&AnomalyDetectionPipeline._pipeline_clsO   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_sizeS   s     l#$67;;L!LLr'    N)	r.   r/   r0   r1   entitiespropertyr?   rE   r7   rG   r'   r%   r;   r;   K   s    "H) )Mr'   r;   )typingr   r   r   r   r   numpyr5   
utils.depsr	   models.anomaly_detection.resultr   utils.benchmarkr   	utils.hpir   utils.pp_optionr   	_parallelr   baser   time_methodsr   r;   rG   r'   r%   <module>rT      sk    4 3  2 8 ( " 4 @  +6 +6 +6\ MG M Mr'   