
    9i                         S SK JrJr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  \R0                   " S S\5      5       r\" S5       " S S\5      5       rg)    )AnyDictListLiteralOptionalTupleUnionN   )pipeline_requires_extra   )	SegResult)	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S\
\\\   \R                   \\R                      4   S\
\S   S\\\   4   S	\4S jjrSrU =r$ )_SemanticSegmentationPipeline   zSemantic Segmentation PipelineNconfigdevice	pp_optionuse_hpip
hpi_configreturnc                 r   > [         TU ]  X#XES9  US   S   nU R                  U5      U l        US   U l        g)ah  
Initializes the class with given configurations and options.

Args:
    config (Dict): Configuration dictionary containing model and other parameters.
    device (str): The device to run the prediction on. Default is None.
    pp_option (PaddlePredictorOption): Options for PaddlePaddle predictor. Default is 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SemanticSegmentationtarget_sizeN)super__init__create_modelsemantic_segmentation_modelr    )selfr   r   r   r   r   "semantic_segmentation_model_config	__class__s          z/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddlex/inference/pipelines/semantic_segmentation/pipeline.pyr"   &_SemanticSegmentationPipeline.__init__    sX    * 	 	 	
 .4L-A".
* ,0+<+<.,
( >mL    inputr    c              +   >   #    U R                  XS9 Sh  vN   g N7f)a  Predicts semantic segmentation results for the given input.

Args:
    input (str | list[str] | np.ndarray | list[np.ndarray]): The input image(s) or path(s) to the images.
    target_size (Literal[-1] | None | int | tuple[int]): The Image size model used to do prediction. Default is None.
        If it's set to -1, the original image size will be used.
        If it's set to None, the previous level's setting will be used.
        If it's set to an integer value, the image will be rescaled to the size of (value, value).
        If it's set to a tuple of two integers, the image will be rescaled to the size of (height, width).
    **kwargs: Additional keyword arguments that can be passed to the function.

Returns:
    SegResult: The predicted segmentation results.
)r    N)r$   )r%   r+   r    kwargss       r(   predict%_SemanticSegmentationPipeline.predictA   s     ( 33E3SSSs   )r$   r    )NNFNN)__name__
__module____qualname____firstlineno____doc__r   strr   boolr   r	   r   r   r"   r   npndarrayr   intr   r   r/   __static_attributes____classcell__)r'   s   @r(   r   r      s    (
 +/AEMM M )	M
 M U4S>9#<=>M 
M MH BFTS$s)RZZbjj1AABT 72;c5:=>T
 
T Tr*   r   cvc                   .    \ rS rSrSr\S 5       rS rSrg)SemanticSegmentationPipelineX   semantic_segmentationc                     [         $ r1   )r   )r%   s    r(   _pipeline_cls*SemanticSegmentationPipeline._pipeline_cls\   s    ,,r*   c                 2    US   S   R                  SS5      $ )Nr   r   
batch_size   )get)r%   r   s     r(   _get_batch_size,SemanticSegmentationPipeline._get_batch_size`   s     l#$:;??aPPr*    N)	r2   r3   r4   r5   entitiespropertyrD   rJ   r<   rL   r*   r(   r@   r@   X   s    &H- -Qr*   r@   )typingr   r   r   r   r   r   r	   numpyr9   
utils.depsr   #models.semantic_segmentation.resultr   utils.benchmarkr   	utils.hpir   utils.pp_optionr   	_parallelr   baser   time_methodsr   r@   rL   r*   r(   <module>rY      sr    D C C  2 < ( " 4 @  8TL 8T 8Tv Q#K Q Qr*   