
    =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)InstanceSegResult)	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S\\\\   \R                   \\R                      4   S\\S4   S\4S jjrSrU =r$ )_InstanceSegmentationPipeline   zInstance Segmentation 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	U R                  U	5      U l        U	S   U l        g)a  Initializes the instance segmentation 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InstanceSegmentation	thresholdN )super__init__create_modelinstance_segmentation_modelr!   )selfr   r   r   r   r   r   r   kwargs"instance_segmentation_model_config	__class__s             v/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/paddlex/inference/pipelines/instance_segmentation/pipeline.pyr$   &_InstanceSegmentationPipeline.__init__   sn    2 	 	
'!	
 	
 .4L-A".
* ,0+<+<.,
( <KH    inputr!   c              +   >   #    U R                  XS9 Sh  vN   g N7f)a  Predicts instance 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.
    threshold (Union[float, None]): The threshold value to filter out low-confidence predictions. Default is None.
    **kwargs: Additional keyword arguments that can be passed to the function.

Returns:
    InstanceSegResult: The predicted instance segmentation results.
)r!   N)r&   )r'   r.   r!   r(   s       r+   predict%_InstanceSegmentationPipeline.predictJ   s       33E3OOOs   )r&   r!   N)__name__
__module____qualname____firstlineno____doc__r   r   strr   r   boolr   r   r$   r   npndarrayfloatr   r0   __static_attributes____classcell__)r*   s   @r+   r   r      s   ( !% $2659AE)I)I 	)I
 )I  S#X/)I 12)I )I U4S>9#<=>)I 
)I )I\ )-PS$s)RZZbjj1AABP %P
 
P Pr-   r   cvc                   .    \ rS rSrSr\S 5       rS rSrg)InstanceSegmentationPipeline]   instance_segmentationc                     [         $ r2   )r   )r'   s    r+   _pipeline_cls*InstanceSegmentationPipeline._pipeline_clsa   s    ,,r-   c                 2    US   S   R                  SS5      $ )Nr   r    
batch_size   )get)r'   r   s     r+   _get_batch_size,InstanceSegmentationPipeline._get_batch_sizee   s     l#$:;??aPPr-   r"   N)	r3   r4   r5   r6   entitiespropertyrE   rK   r=   r"   r-   r+   rA   rA   ]   s    &H- -Qr-   rA   )typingr   r   r   r   r   numpyr:   
utils.depsr	   modelsr   r   #models.instance_segmentation.resultr   utils.benchmarkr   	_parallelr   baser   time_methodsr   rA   r"   r-   r+   <module>rX      sk    4 3  2 6 D ( @  >PL >P >PB Q#K Q Qr-   