
    9iMF                     d    S SK JrJrJrJr  SSKJrJr  SSKJ	r	   " S S\5      r
 " S S\5      rg	)
   )add_simple_inference_argsget_subcommand_argsperform_simple_inferencestr2bool   )PaddleXPipelineWrapperPipelineCLISubcommandExecutor)create_config_from_structurec                      ^  \ rS rSr                               SU 4S jjr\S 5       rSSSSSSSSSSSSSSSSSSS.S jrSSSSSSSSSSSSSSSSSSS.S	 jr\	S
 5       r
S rSrU =r$ )TableRecognitionPipelineV2   Nc                     > [        5       R                  5       n!U!R                  S5        U!R                  S5        U!U l        [        T"U ]  " S0 U D6  g )Nselfkwargs )localscopypop_paramssuper__init__)#r   layout_detection_model_namelayout_detection_model_dirtable_classification_model_nametable_classification_model_dir,wired_table_structure_recognition_model_name+wired_table_structure_recognition_model_dir/wireless_table_structure_recognition_model_name.wireless_table_structure_recognition_model_dir&wired_table_cells_detection_model_name%wired_table_cells_detection_model_dir)wireless_table_cells_detection_model_name(wireless_table_cells_detection_model_dir#doc_orientation_classify_model_name"doc_orientation_classify_model_dirdoc_unwarping_model_namedoc_unwarping_model_dirtext_detection_model_nametext_detection_model_dirtext_det_limit_side_lentext_det_limit_typetext_det_threshtext_det_box_threshtext_det_unclip_ratiotext_recognition_model_nametext_recognition_model_dirtext_recognition_batch_sizetext_rec_score_threshuse_doc_orientation_classifyuse_doc_unwarpinguse_layout_detectionuse_ocr_modelr   params	__class__s#                                     i/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddleocr/_pipelines/table_recognition_v2.pyr   #TableRecognitionPipelineV2.__init__   sB    F 

6

8"6"    c                     gNtable_recognition_v2r   r   s    r9   _paddlex_pipeline_name1TableRecognitionPipelineV2._paddlex_pipeline_nameD       %r;   FT)r3   r4   r5   r6   overall_ocr_reslayout_det_resr*   r+   r,   r-   r.   r2   use_e2e_wired_table_rec_model use_e2e_wireless_table_rec_model#use_wired_table_cells_trans_to_html&use_wireless_table_cells_trans_to_htmluse_table_orientation_classify use_ocr_results_with_table_cellsc                    U R                   R                  " U40 SU_SU_SU_SU_SU_SU_SU_SU	_S	U
_S
U_SU_SU_SU_SU_SU_SU_SU_SU_UD6$ Nr3   r4   r5   r6   rC   rD   r*   r+   r,   r-   r.   r2   rE   rF   rG   rH   rI   rJ   )paddlex_pipelinepredictr   inputr3   r4   r5   r6   rC   rD   r*   r+   r,   r-   r.   r2   rE   rF   rG   rH   rI   rJ   r   s                        r9   predict_iter'TableRecognitionPipelineV2.predict_iterH   s    0 $$,,
)E
 0
 "6	

 (
 ,
 *
 %<
 !4
 ,
 !4
 #8
 #8
 +H
 .N
  1T!
" 4Z#
$ ,J%
& .N)
 	
r;   c                    [        U R                  " U40 SU_SU_SU_SU_SU_SU_SU_SU	_S	U
_S
U_SU_SU_SU_SU_SU_SU_SU_SU_UD65      $ rL   )listrQ   rO   s                        r9   rN   "TableRecognitionPipelineV2.predictw   s    0 -I #4 &:	
 , !0  . )@ %8 !0 %8 '< '< /L 2R  5X!" 8^#$ 0N%& 2R)
 	
r;   c                     [        5       $ N)/TableRecognitionPipelineV2CLISubcommandExecutor)clss    r9   get_cli_subcommand_executor6TableRecognitionPipelineV2.get_cli_subcommand_executor   s    >@@r;   c                    0 SU R                   S   _SU R                   S   _SU R                   S   =(       d    U R                   S   _SU R                   S   _SU R                   S   _SU R                   S	   _S
U R                   S   _SU R                   S   _SU R                   S   _SU R                   S   _SU R                   S   _SU R                   S   _SU R                   S   _SU R                   S   _SU R                   S   _SU R                   S   _SU R                   S   _U R                   S    U R                   S!   U R                   S"   U R                   S#   U R                   S$   U R                   S%   U R                   S&   U R                   S'   U R                   S(   U R                   S)   U R                   S*   U R                   S+   U R                   S,   U R                   S-   U R                   S.   S/.En[        U5      $ )0Nz9SubPipelines.DocPreprocessor.use_doc_orientation_classifyr3   z.SubPipelines.DocPreprocessor.use_doc_unwarpingr4   use_doc_preprocessorr5   r6   z%SubModules.LayoutDetection.model_namer   z$SubModules.LayoutDetection.model_dirr   z)SubModules.TableClassification.model_namer   z(SubModules.TableClassification.model_dirr   z4SubModules.WiredTableStructureRecognition.model_namer   z3SubModules.WiredTableStructureRecognition.model_dirr   z7SubModules.WirelessTableStructureRecognition.model_namer   z6SubModules.WirelessTableStructureRecognition.model_dirr   z.SubModules.WiredTableCellsDetection.model_namer    z-SubModules.WiredTableCellsDetection.model_dirr!   z1SubModules.WirelessTableCellsDetection.model_namer"   z0SubModules.WirelessTableCellsDetection.model_dirr#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   )zISubPipelines.DocPreprocessor.SubModules.DocOrientationClassify.model_namezHSubPipelines.DocPreprocessor.SubModules.DocOrientationClassify.model_dirz?SubPipelines.DocPreprocessor.SubModules.DocUnwarping.model_namez>SubPipelines.DocPreprocessor.SubModules.DocUnwarping.model_dirz;SubPipelines.GeneralOCR.SubModules.TextDetection.model_namez:SubPipelines.GeneralOCR.SubModules.TextDetection.model_dirz?SubPipelines.GeneralOCR.SubModules.TextDetection.limit_side_lenz;SubPipelines.GeneralOCR.SubModules.TextDetection.limit_typez7SubPipelines.GeneralOCR.SubModules.TextDetection.threshz;SubPipelines.GeneralOCR.SubModules.TextDetection.box_threshz=SubPipelines.GeneralOCR.SubModules.TextDetection.unclip_ratioz=SubPipelines.GeneralOCR.SubModules.TextRecognition.model_namez<SubPipelines.GeneralOCR.SubModules.TextRecognition.model_dirz=SubPipelines.GeneralOCR.SubModules.TextRecognition.batch_sizez?SubPipelines.GeneralOCR.SubModules.TextRecognition.score_thresh)r   r
   )r   	STRUCTUREs     r9   _get_paddlex_config_overrides8TableRecognitionPipelineV2._get_paddlex_config_overrides   s   \
G.J\
 =dll#?	\
 #DLL1O$P %1||/0\
 #DLL1G$H\
 T\\/:\
 4T\\-6\
 3DLL,5\
" 81:#\
( 709)\
. CDLL>E/\
4 B4<<=D5\
: Ft||AH;\
@ Edll@GA\
F =dll8?G\
L <T\\7>M\
R @;BS\
X ?:AY\
^ Z^YeYe5Z Y]XdXd4Y PT||*P OSll)O LP<<+L KO,,*K PT||)P LP<<%L HL||!H LP<<%L NR\\'N NR\\-N MQLL,M NR\\-N PT||'Ps\
	z ,I66r;   )r   )NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN)__name__
__module____qualname____firstlineno__r   propertyr@   rQ   rN   classmethodrZ   r_   __static_attributes____classcell__)r8   s   @r9   r   r      s    %)#'(,'+59488<7;/3.22615,0+/!% $"&!% $  "$(#'$("%)!A(#T & & &*! $  ""&+).,1/4'+)-+-
f &*! $  ""&+).,1/4'+)-+/
b A A^7 ^7r;   r   c                   0    \ rS rSr\S 5       rS rS rSrg)rX   i  c                     gr=   r   r?   s    r9   subparser_name>TableRecognitionPipelineV2CLISubcommandExecutor.subparser_name  rB   r;   c                 0   [        U5        UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        S	S9  UR                  S
[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        S S9  UR                  S![        S"S9  UR                  S#[        S$S9  UR                  S%[        S&S9  UR                  S'[        S(S9  UR                  S)[        S*S9  UR                  S+[        S,S9  UR                  S-[        S.S9  UR                  S/[        S0S9  UR                  S1[        S2S9  UR                  S3[        S4S9  UR                  S5[        S6S9  UR                  S7[
        S8S9  UR                  S9[
        S:S9  UR                  S;[
        S<S9  UR                  S=[
        S>S9  g )?Nz--layout_detection_model_namez#Name of the layout detection model.)typehelpz--layout_detection_model_dirz-Path to the layout detection model directory.z!--table_classification_model_namez'Name of the table classification model.z --table_classification_model_dirz1Path to the table classification model directory.z.--wired_table_structure_recognition_model_namez4Name of the wired table structure recognition model.z---wired_table_structure_recognition_model_dirz>Path to the wired table structure recognition model directory.z1--wireless_table_structure_recognition_model_namez7Name of the wireless table structure recognition model.z0--wireless_table_structure_recognition_model_dirz(--wired_table_cells_detection_model_namez.Name of the wired table cells detection model.z'--wired_table_cells_detection_model_dirz8Path to the wired table cells detection model directory.z+--wireless_table_cells_detection_model_namez1Name of the wireless table cells detection model.z*--wireless_table_cells_detection_model_dirz;Path to the wireless table cells detection model directory.z%--doc_orientation_classify_model_namez<Name of the document image orientation classification model.z$--doc_orientation_classify_model_dirzFPath to the document image orientation classification model directory.z--doc_unwarping_model_namez'Name of the text image unwarping model.z--doc_unwarping_model_dirz,Path to the image unwarping model directory.z--text_detection_model_namez!Name of the text detection model.z--text_detection_model_dirz+Path to the text detection model directory.z--text_det_limit_side_lenzUThis sets a limit on the side length of the input image for the text detection model.z--text_det_limit_typezxThis determines how the side length limit is applied to the input image before feeding it into the text deteciton model.z--text_det_threshzDetection pixel threshold for the text detection model. Pixels with scores greater than this threshold in the output probability map are considered text pixels.z--text_det_box_threshzDetection box threshold for the text detection model. A detection result is considered a text region if the average score of all pixels within the border of the result is greater than this threshold.z--text_det_unclip_ratiozText detection expansion coefficient, which expands the text region using this method. The larger the value, the larger the expansion area.z--text_recognition_model_namez#Name of the text recognition model.z--text_recognition_model_dirz-Path to the text recognition model directory.z--text_recognition_batch_sizez*Batch size for the text recognition model.z--text_rec_score_threshzrText recognition threshold used in general OCR. Text results with scores greater than this threshold are retained.z--use_doc_orientation_classifyz9Whether to use document image orientation classification.z--use_doc_unwarpingz$Whether to use text image unwarping.z--use_layout_detectionz Whether to use layout detection.z--use_ocr_modelzWhether to use OCR models.)r   add_argumentstrintfloatr   )r   	subparsers     r9   _update_subparserATableRecognitionPipelineV2CLISubcommandExecutor._update_subparser  s   !),+6 	 	

 	*@ 	 	

 	/: 	 	

 	.D 	 	

 	<G 	 	

 	;Q 	 	

 	?J 	 	

 	>Q 	 	

 	6A 	 	

 	5K 	 	

 	9D 	 	

 	8N 	 	
 	3O 	 	

 	2Y 	 	

 	(: 	 	

 	'? 	 	
 	)4 	 	

 	(> 	 	

 	'h 	 	

 	# L 	 	

 	 t 	 	

 	# [ 	 	

 	% _ 	 	

 	+6 	 	

 	*@ 	 	

 	+= 	 	

 	% F 	 	
 	,L 	 	

 	!7 	 	

 	$3 	 	

 	- 	 	
r;   c                 :    [        U5      n[        [        U5        g rW   )r   r   r   )r   argsr7   s      r9   execute_with_argsATableRecognitionPipelineV2CLISubcommandExecutor.execute_with_args  s    $T* !;VDr;   r   N)	ra   rb   rc   rd   re   rk   ru   ry   rg   r   r;   r9   rX   rX     s!    & &`
DEr;   rX   N)
_utils.clir   r   r   r   baser   r	   utilsr
   r   rX   r   r;   r9   <module>r~      s9     H /q7!7 q7hiE6S iEr;   