
    9i~                     x   S SK r S SKrS SKrS SKJr  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  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&J'r'  SSK(J)r)J*r*J+r+J,r,J-r-J.r.J/r/  / SQr0\Rb                   " S S\ 5      5       r2\" S5       " S S\5      5       r3g)    N)chain)AnyDictOptionalTupleUnion)Image   )logging)pipeline_requires_extra   )ImageBatchSampler)	ReadImage)	benchmark)	HPIConfig)PaddlePredictorOption   )(AutoParallelImageSimpleInferencePipeline)BasePipeline)CropByBoxes)gather_imgs   )PaddleOCRVLBlockPaddleOCRVLResult)convert_otsl_to_htmlcrop_marginfilter_overlap_boxesmerge_blockstokenize_figure_of_tabletruncate_repetitive_contentuntokenize_figure_of_table)imageheader_imagefooter_imagesealc            +         ^  \ 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 S)S\
\	S4   S\
\	S4   S\
\	S4   S\
\	S4   S\
\	S4   S\
\	S4   S\\\      S	\4S jjrS\S	\	4S jr   S*S jr                   S+S\
\\\   \R*                  \\R*                     4   S\
\	S4   S\
\	S4   S\
\	S4   S\
\	S4   S\\
\\4      S\\	   S\\
\\\\4   \4      S\\   S\\	   S\\
\S4      S\
\	S4   S\\   S\\   S \\   S!\\   S"\\   S#\\   S\\	   S\\\      S	\4*S$ jjrS%\S	\4S& jrS'rU =r$ ),_PaddleOCRVLPipeline1   z_PaddleOCRVLPipeline PipelineNconfigdevice	pp_optionuse_hpip
hpi_configreturnc                   > [         TU ]  X#XES9  UR                  SS5      U l        U R                  (       a:  UR                  S0 5      R                  SSS05      nU R	                  U5      U l        UR                  SS5      U l        U R                  (       a  UR                  S	0 5      R                  S
SS05      nUR                  SS5      nUb  US:X  d   S5       e0 n	UR                  SS5      =n
b  XS'   UR                  SS5      =nb  XS'   UR                  SS5      =n b  XS'   UR                  SS5      =n b  XS'   U R                  " U40 U	D6U l        UR                  SS5      U l	        UR                  S	0 5      R                  SSS05      nU R                  U5      U l
        UR                  SS5      U l        [        UR                  SS5      S9U l        [        SS9U l        [!        5       U l        UR                  SS5      U l        UR                  S S5      U l        UR                  S!/ S"Q5      U l        g)#af  
Initializes the class with given configurations and options.

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-   use_doc_preprocessorTSubPipelinesDocPreprocessorpipeline_config_errorz+config error for doc_preprocessor_pipeline!use_layout_detection
SubModulesLayoutDetectionmodel_config_errorz"config error for layout_det_model!
model_nameNzPP-DocLayoutV2z!model_name must be PP-DocLayoutV2	threshold
layout_nmslayout_unclip_ratiolayout_merge_bboxes_modeuse_chart_recognitionVLRecognitionzconfig error for vl_rec_model!format_block_contentF
batch_sizer   )r@   BGR)format
use_queuesmerge_layout_blocksmarkdown_ignore_labels)numberfootnoteheaderr#   footerr$   
aside_text)super__init__getr0   create_pipelinedoc_preprocessor_pipeliner4   create_modellayout_det_modelr=   vl_rec_modelr?   r   batch_samplerr   
img_readerr   crop_by_boxesrC   rD   rE   )selfr)   r*   r+   r,   r-   doc_preprocessor_configlayout_det_configr8   layout_kwargsr9   r:   r;   r<   vl_rec_config	__class__s                  q/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddlex/inference/pipelines/paddleocr_vl/pipeline.pyrL   _PaddleOCRVLPipeline.__init__5   s   * 	 	 	
 %+JJ/Et$L!$$&,jj&D&H&H!+-Z'# .2-A-A'.D* %+JJ/Et$L!$$ &

< < @ @!%'KL! +..|TBJ&:9I+I323IM.22;EE	R-6k*/33L$GG
T.8l+'8'<'<)4( # 	
 8K34,=,A,A.- ( 	
 =U89$($5$5!%%2%D! &,ZZ0G%N"

<488!#CD

 !--m<$*JJ/Eu$M!.&**\ST:UV#51(] **\59#)::.CT#J &,jj$'
#    c                 8    U R                   R                  5         g N)rR   closerV   s    r\   ra   _PaddleOCRVLPipeline.close   s    !r^   use_doc_orientation_classifyuse_doc_unwarpingr4   r=   r?   rD   rE   c           	          Uc  Uc  U R                   nOUSL d  USL a  SnOSnUc  U R                  nUc  U R                  nUc  U R                  nUc  U R                  nUc  U R
                  n[        UUUUUUS9$ )a  
Get the model settings based on the provided parameters or default values.

Args:
    use_doc_orientation_classify (Union[bool, None]): Enables document orientation classification if True. Defaults to system setting if None.
    use_doc_unwarping (Union[bool, None]): Enables document unwarping if True. Defaults to system setting if None.

Returns:
    dict: A dictionary containing the model settings.

TF)r0   r4   r=   r?   rD   rE   )r0   r4   r=   r?   rD   rE   dict)	rV   rd   re   r4   r=   r?   rD   rE   r0   s	            r\   get_model_settings'_PaddleOCRVLPipeline.get_model_settings   s    * (/4E4M#'#<#< +t37HD7P'+$',$'#'#<#<  ($($>$>!'#'#<#< &"&":":!)%)%@%@"!5!5"7!5 3#9
 	
r^   input_paramsc                 h    US   (       a(  U R                   (       d  [        R                  " S5        gg)a  
Check if the input parameters are valid based on the initialized models.

Args:
    input_params (Dict): A dictionary containing input parameters.

Returns:
    bool: True if all required models are initialized according to input parameters, False otherwise.
r0   zRSet use_doc_preprocessor, but the models for doc preprocessor are not initialized.FT)r0   r   error)rV   rj   s     r\   check_model_settings_valid/_PaddleOCRVLPipeline.check_model_settings_valid   s,     ./8Q8QMMd r^   c                    / n/ n/ n	/ n
/ n[        5       nU(       a  [        O	[        S/-   n[        [        XU5      5       GH"  u  nu  nnn[	        U5      nUS   nU R                  UU5      nU(       a  [        UUS/-   S9nUR                  U5        [        U5       H  u  nnUS   nUS   nUU;  d  M  Uc  M  0 nSn/ nUS:X  a  Sn[        UUS	   U5      u  nnnO)US:X  a
  U(       a  S
nOSU;   a  US:w  a  Sn[        U5      nUR                  U5        U	R                  U5        UR                  U5        U
R                  UU45        UR                  U5        M     GM%     Uc  0 nOUR                  SS 5      c  SUS'   SS0UEn[        U R                  R                  " [        X5       VVs/ s H  u  nnUUS.PM     snn4SS0UD65      n/ n/ nSn[        U5       GH  u  nn/ n / n![        U5       GH  u  nnUS   nUS	   n"US   nSn#U[        U
5      :  a  U
U   UU4:X  a  UU   n$UU   nUU   n%US-  nU%U$S'   U$R                  SS5      n&U&c  Sn&[!        U&5      n&SU&;   a  SU&;   d  SU&;   ar  SU&;   al  U&R#                  SS5      n&U&R#                  SS5      R#                  SS5      R#                  SS5      R#                  SS5      n&US:X  a  U&R#                  SS5      n&US:X  a  [%        U&5      n'U'S:w  a  U'n&['        U&U5      n&U&n#[)        UU"U#UR                  S S 5      S!9n(UU;   a{  Ubx  [        [+        [,        U"5      5      u  n)n*n+n,S"U S#U) S$U* S$U+ S$U, S%3n-U-U;  a?  SS Kn.U.R1                  UU.R2                  5      nU-[4        R6                  " U5      S&.U(l        OGM  U R                  U(5        GM     UR                  U 5        UR                  U!5        GM     UUU4$ s  snnf )'Nchartboxestable)non_merge_labelsimglabelzOCR:zTable Recognition:boxzChart Recognition:formulaformula_numberzFormula Recognition:max_new_tokensi   	use_cacheT)r"   queryskip_special_tokensr    r   r"   resultz\(z\)z\[z\]$z $ z $$ group_id)ru   bboxcontentr   zimgs/img_in__box__z.jpg)pathrt   )setIMAGE_LABELS	enumeratezipr   rU   r   appendr   r   updaterM   listrR   predictlenr    replacer   r!   r   mapintcv2cvtColorCOLOR_BGR2RGBr	   	fromarrayr"   )/rV   imageslayout_det_resultsimgs_in_docr=   
vlm_kwargsrD   blocks
block_imgstext_promptsvlm_block_idsfigure_token_mapsdrop_figures_setimage_labelsir"   layout_det_resimgs_in_doc_for_imgrq   blocks_for_imgjblock	block_imgblock_labelfigure_token_maptext_promptdrop_figureskwargsvl_rec_resultsparsing_res_liststable_res_listscurr_vlm_block_idxparsing_res_listtable_res_list
block_bboxblock_contentvl_rec_resultblock_img4vl
result_strhtml_str
block_infox_miny_minx_maxy_maximg_pathr   s/                                                  r\   get_layout_parsing_results/_PaddleOCRVLPipeline.get_layout_parsing_results   s    
51L|wi7O 	 @IK8@
;A;~': 2.AN"7+E!//u=N"!-"\WI5M" MM.)%n55!%L	#Gnl2y7L')$"(K#%L"g-&:4 )5<9L B	#3\
 %/4I&:"k1kEU6U&<$/	$:	%%i0 ''4%,,-=>!((!Q0$++L9/ 6@
H J^^,d3;+/J'( 

 %% 36j2O
 3P.	; "+!, 3P
 %)
 

 !*6!2A~!N%n55!%L	"5\
#Gn "%M(::}&@V@ %33E$FM'89K'L$#-.@#AL&!+&-9M'*!.!2!28R!@J!)%'
!<Z!HJ+0C+0C%/%7%7R%@
 '..ue<$WUE2$WUF3$WUF3	 # '*::)3););C)DJ"g-#7
#C#r>)1J%?&(8&
 %/M-%#)"YYz48	
 ,.93H15c#z6J1K.E5%!-k]%wawaPUwVWX]W^^bcH'77"$'LLC<M<M$N	$,#(??9#=,
(
 ! ''
3y 6z $$%56"">2C "3F !/;>>es   5O4inputlayout_thresholdr:   r;   r<   rC   prompt_labelrepetition_penaltytemperaturetop_p
min_pixels
max_pixelsry   c           
   +     ^ ^^^^^^	^^^^^^^^"^#^$^%^&^'^(^)^*^+#    T R                  TTUUUUU5      m(T R                  T(5      (       d  SS0v   U
c  T R                  n
T(S   (       dC  T(       a  TOSmTR                  5       S:X  a  ST(S'   TR                  5       S	;   d   S
T S35       eS U	UUUU(UU UU4	S jjm"UUUU(UU UU4S jm#U
(       Ga<  Sn[        R
                  " US9m*[        R
                  " US9m)[        R
                  " T R                  R                  U-  S9m+[        R                  " 5       m&[        R                  " 5       m%[        R                  " 5       m$[        R                  " 5       m'U%U&U*U 4S jnU"U$U%U&U(U)U*U 4S jnU#U$U&U'U)U+U 4S jn[        R                  " UU4SS9nUR                  5         [        R                  " USS9nUR                  5         [        R                  " USS9nUR                  5          U
(       a  T'R                  5       (       a  T+R                  5       (       df   T+R                  SS9nUS   (       d  [!        SUS    SUS    35      eUS   v   T'R                  5       (       d  MO  T+R                  5       (       d  Mf  O`T R                  U5       HK  n[#        T"" U5      5      n[%        U5      S:X  d   [%        U5      5       eUS   n T#" U 5       H  n!U!v   M	     MM     U
(       a  T&R'                  5         WR)                  SS9  UR+                  5       (       a  [,        R.                  " S5        WR)                  SS9  UR+                  5       (       a  [,        R.                  " S5        ggg! [        R                   a    T'R                  5       (       a   M   GM  f = f! U
(       a  T&R'                  5         WR)                  SS9  UR+                  5       (       a  [,        R.                  " S5        WR)                  SS9  UR+                  5       (       a  [,        R.                  " S5        f f f = f7f)!a	  
Predicts the layout parsing result for the given input.

Args:
    input (Union[str, list[str], np.ndarray, list[np.ndarray]]): Input image path, list of image paths,
                                                                numpy array of an image, or list of numpy arrays.
    use_doc_orientation_classify (Optional[bool]): Whether to use document orientation classification.
    use_doc_unwarping (Optional[bool]): Whether to use document unwarping.
    layout_threshold (Optional[float]): The threshold value to filter out low-confidence predictions. Default is None.
    layout_nms (bool, optional): Whether to use layout-aware NMS. Defaults to False.
    layout_unclip_ratio (Optional[Union[float, Tuple[float, float]]], optional): The ratio of unclipping the bounding box.
        Defaults to None.
        If it's a single number, then both width and height are used.
        If it's a tuple of two numbers, then they are used separately for width and height respectively.
        If it's None, then no unclipping will be performed.
    layout_merge_bboxes_mode (Optional[str], optional): The mode for merging bounding boxes. Defaults to None.
    use_queues (Optional[bool], optional): Whether to use queues. Defaults to None.
    prompt_label (Optional[Union[str, None]], optional): The label of the prompt in ['ocr', 'formula', 'table', 'chart']. Defaults to None.
    format_block_content (Optional[bool]): Whether to format the block content. Default is None.
    repetition_penalty (Optional[float]): The repetition penalty parameter used for VL model sampling. Default is None.
    temperature (Optional[float]): Temperature parameter used for VL model sampling. Default is None.
    top_p (Optional[float]): Top-p parameter used for VL model sampling. Default is None.
    min_pixels (Optional[int]): The minimum number of pixels allowed when the VL model preprocesses images. Default is None.
    max_pixels (Optional[int]): The maximum number of pixels allowed when the VL model preprocesses images. Default is None.
    max_new_tokens (Optional[int]): The maximum number of new tokens. Default is None.
    merge_layout_blocks (Optional[bool]): Whether to merge layout blocks. Default is None.
    markdown_ignore_labels (Optional[list[str]]): The list of ignored markdown labels. Default is None.
    **kwargs (Any): Additional settings to extend functionality.

Returns:
    PaddleOCRVLResult: The predicted layout parsing result.
rl   z0the input params for model settings are invalid!Nr4   ocrrp   Tr=   )r   rw   rr   rp   zLayout detection is disabled (use_layout_detection=False). 'prompt_label' must be one of ['ocr', 'formula', 'table', 'chart'], but got 'z'.c              3   Z  >	#    U(       d  [        U 5      n[        S[        U 5      U5       GHd  nU R                  X"U-    nU R                  X"U-    nU R                  X"U-    nU R
                  X"U-    nTR                  U5      nTS   (       a  [        TR                  UTTS95      nOU V	s/ s H  n	SU	0PM	     nn	U V
s/ s H  oS   PM	     nn
TS   (       aH  [        TR                  UTTTTS95      n[        X5       VVs/ s H  u  p[        XS   5      PM     nnnOd/ nU HJ  nUR                  S S STR                  5       SSSUR                  S   UR                  S   /S	./S
.5        ML     U Vs/ s H  n/ PM     nnXEXkXU4v   GMg     g s  sn	f s  sn
f s  snnf s  snf 7f)Nr   r0   )rd   re   
output_imgr4   )r9   r:   r;   r<   rq   r   )cls_idru   score
coordinate)
input_path
page_indexrq   )r   range	instancesinput_pathspage_indexespage_countsrT   r   rO   rQ   r   r   r   lowershape)
batch_datanew_batch_sizeidxr   r   r   r   image_arraysdoc_preprocessor_resultsarritemdoc_preprocessor_imagesr   
doc_pp_imgr   r   doc_preprocessor_imager   r<   r:   r   r;   model_settingsr   rV   rd   re   s                     r\   _process_cv1_PaddleOCRVLPipeline.predict.<locals>._process_cv  s4    !!$ZQJ@&00^7KL	(44S;OP)66s>=QR(44S;OP#y9!"89/366(9U.? 7 0, 8D07Cs+| - 0
 4L+3K4&3K ( + ""89)---3&6'10C5M . *& ;>3;#;6J $Jw0GH;   #K *,&2I.*11.2.2 341=1C1C1E12,-,-,B,H,H,K,B,H,H,K	7*	
%&*" 3J( 0B"B/A!2/AK"B!Wo  FQ  Q  QE A"0+#8 #Cs7   B+F+.F<F+F6F+F  AF+:F&%F+c              3      >#    U u  nnnnnnnTR                  UUUTS   TTTTTTS.TS   5      u  pn[        UUUUUUU	UU5	       HB  u	  n
nnnnnnnnU
UUUR                  S   UR                  S   UUUUUTS.n[        U5      v   MD     g 7f)Nr=   )r   r   r   r   r   ry   rD   r   r   )r   r   
page_countwidthheightdoc_preprocessor_resr   r   r   r   r   )r   r   r   r   )
results_cvr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   single_img_resry   r   r   r   r   rV   r   r   s                       r\   _process_vlm2_PaddleOCRVLPipeline.predict.<locals>._process_vlm  s
     '(" //+&"#:;.@'2!&&0&0*8 ##89 <8 '("!

&$ # #-",",399!<4::1=,@&4&4(8#6&4" (771
s   BB@   )maxsizec                 N  > TR                  U 5      nTR                  5       (       d6   [        U5      nTR                  SU45        TR                  5       (       d  M6  TR                  5         g ! [         a     M  [
         a  nTR                  SSU45         S nAMA  S nAff = f)NTFr   )rS   is_setnextputStopIteration	Exceptionr   )input_all_batch_datar   eevent_data_loading_doneevent_shutdownqueue_inputrV   s       r\   _worker_input3_PaddleOCRVLPipeline.predict.<locals>._worker_input^  s    !%!3!3F!;(//11<%).%9
 $z(:; )//11 (++- ) $ #(;<s   A/ /
B$<	B$BB$c                  4  > TR                  5       (       d   T	R                  SS9n U S   (       d  TR                  U 5        g  T" U S   TS   (       a   T
R                  R                  R                  OS 5       H  nTR                  SU45        M     TR                  5       (       d  M  g g ! [        R                   a+    TR                  5       (       a  TR	                  5          g  M  f = f! [         a  nTR                  SSU45         S nAg S nAff = f)	N      ?timeoutr   r   r4   TFcv)
r   rM   queueEmptyr   r   rQ   rS   r@   r   )r   r   r   r   event_cv_processing_doner   r   r   queue_cvr   rV   s      r\   
_worker_cv0_PaddleOCRVLPipeline.predict.<locals>._worker_cvl  s    (//11!*s;  7 T**5 G $22H#I !% 5 5 C C N N%)+J %LL$
);<+ )//11 !;; !299;;488:! 	!$ %  eT1%56s*   B- AC/ -9C,+C,/
D9DDc                    > Sn TR                   R                  R                  nTR                  5       (       GdP  / n[        R                  " 5       nSnSn U [        R                  " 5       U-
  -
  nUS::  a  Oj TR                  US9nUS   (       d  TR                  U5        SnO<UR                  US   5        US   S    H  nU[        US	   5      -  nM     XQ:  a  OM  U(       a  g U(       d(  TR                  5       (       a  TR                  5         g M  [        U6  V	s/ s H"  n	[        [        R                  " U	5      5      PM$     n
n	 T" U
5       H  nTR                  SU45        M     TR                  5       (       d  GMO  g g ! [        R                   a     M  f = fs  sn	f ! [          a  nTR                  SS
U45         S nAg S nAff = f)Nr   Fr   Tr  r      rq   vlm)rR   rS   r@   r   timerM   r  r  r   r   r   r   r   r   r   from_iterabler   )MAX_QUEUE_DELAY_SECSMAX_NUM_BOXESresults_cv_list
start_timeshould_break	num_boxesremaining_timer   reslistsmerged_results_cv
result_vlmr   r   r  r   event_vlm_processing_doner  	queue_vlmrV   s                r\   _worker_vlm1_PaddleOCRVLPipeline.predict.<locals>._worker_vlm  s   '*$ $ 1 1 ? ? J J(//11&(O!%J#(L !I)= IIK*4* *Q.!"#+<<<#GD  $Aw%MM$/+/L!'..tAw7#22#6q#9C%S\)::I $:$5!% & $*3::<<599;!  &)/%:)%:E U0078%: & )
*67H*IJ%MM4*<= +JM )//11  %{{ "!"&) % !ueQ&78s0   9F #)F&"F+ F#"F#+
G5GGF)targetargsdaemon)r  r!  r   r  r   zException from the 'r   z
' worker: r   r  z#CV worker did not terminate in timez$VLM worker did not terminate in timer`   )rh   rm   rC   r   r  QueuerS   r@   	threadingEventThreadstartr   emptyrM   r  RuntimeErrorr   r   r   joinis_aliver   warning),rV   r   rd   re   r4   r=   r   r:   r;   r<   rC   r   r?   r   r   r   r   r   ry   rD   rE   r   max_num_batches_in_processr   r  r  thread_input	thread_cv
thread_vlmr   r   r  r   r  r   r   r  r   r   r  r   r  r   r  s,   ` ``  ```` ` ``````               @@@@@@@@@@r\   r   _PaddleOCRVLPipeline.predictv  s    p 00( ! "
 ..~>>NOOJ45+7<UL!!#w.:>67%%' ,  k
 Z  [g  Zh  hj  kk F	Q F	QP?	8 ?	8B )+&++.HIK{{+EFH**558RRI '__.N&/oo&7#'0'8$(1(9%. . 4. .` %++$E8EL  !((
5IIOO"))UKJ	L4;;==)//BSBS!(}}S}9
  7*247):d1gYO  #1g 5;;==)//BSBS #'"4"4U";J&*;z+B&CO/14Jc/6JJ4!0!3J+J7!	  8	 #< ""$q)%%''OO$IJ*&&((OO$JK ) % !;; !4;;==! !$ ""$q)%%''OO$IJ*&&((OO$JK ) sQ   G1Q1O >N =O O #A!O BQ)O;O OO BQQmarkdown_listc                 2    SnU H  nUSUS   -   -  nM     U$ )z
Concatenate Markdown content from multiple pages into a single document.

Args:
    markdown_list (list): A list containing Markdown data for each page.

Returns:
    tuple: A tuple containing the processed Markdown text.
r}   z

markdown_texts )rV   r1  r3  r  s       r\   concatenate_markdown_pages/_PaddleOCRVLPipeline.concatenate_markdown_pages  s0      Cfs+;'<<<N ! r^   )rS   rU   rO   r?   rT   rQ   rE   rD   r=   r0   r4   rC   rR   )NNFNr`   )FNT)FFNNNNNNNNNNNNNNNNN)__name__
__module____qualname____firstlineno____doc__r   r   strr   boolr   r   r   rL   ra   r   rg   rh   rm   r   npndarrayfloatr   r   r   r   tupler5  __static_attributes____classcell__)r[   s   @r\   r'   r'   1   sM   '
 !%59AE_
_
 _
 12	_

 _
 U4S>9#<=>_
 
_
 _
B" 7;3
&+D$J&73
 !t,3
 $D$J/	3

  %T4Z03
 $D$J/3
 #4:.3
 !)c 33
 
3
jt  0 $ S?p ;@/426379=%)QU26%)3726.2'+!%$($((,.26:+gLS$s)RZZbjj1AABgL ',D$J&7gL !t,	gL
 $D$J/gL  %T4Z0gL #5#56gL TNgL &eE53F,L&MNgL #+3-gL TNgL uS$Y/0gL $D$J/gL %UOgL e_gL  !gL" SM#gL$ SM%gL& !'gL( &d^)gL* !)c 3+gL. 
/gLR   r^   r'   r   c                   .    \ rS rSrSr\S 5       rS rSrg)PaddleOCRVLPipelinei  zPaddleOCR-VLc                     [         $ r`   )r'   rb   s    r\   _pipeline_cls!PaddleOCRVLPipeline._pipeline_cls  s    ##r^   c                 &    UR                  SS5      $ )Nr@   r   )rM   )rV   r)   s     r\   _get_batch_size#PaddleOCRVLPipeline._get_batch_size  s    zz,**r^   r4  N)	r7  r8  r9  r:  entitiespropertyrG  rJ  rB  r4  r^   r\   rE  rE    s    H$ $+r^   rE  )4r  r#  r  	itertoolsr   typingr   r   r   r   r   numpyr>  PILr	   utilsr   
utils.depsr   common.batch_samplerr   common.readerr   utils.benchmarkr   	utils.hpir   utils.pp_optionr   	_parallelr   baser   
componentsr   layout_parsing.utilsr   r~   r   r   uiltsr   r   r   r   r   r    r!   r   time_methodsr'   rE  r4  r^   r\   <module>r_     s        4 4    2 5 & ( " 4 @  $ . 7   A |
< |
 |
~ +B +  +r^   