
    9i{;                     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 jr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$ )SealRecognition   Nc           	         > 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_UUUUUUUS.EU l         [        TU ]  " S0 UD6  g )N#doc_orientation_classify_model_name"doc_orientation_classify_model_dirdoc_unwarping_model_namedoc_unwarping_model_dirlayout_detection_model_namelayout_detection_model_dirseal_text_detection_model_nameseal_text_detection_model_dirtext_recognition_model_nametext_recognition_model_dirtext_recognition_batch_sizeuse_doc_orientation_classifyuse_doc_unwarpinguse_layout_detectionlayout_threshold
layout_nmslayout_unclip_ratio)layout_merge_bboxes_modeseal_det_limit_side_lenseal_det_limit_typeseal_det_threshseal_det_box_threshseal_det_unclip_ratioseal_rec_score_thresh )_paramssuper__init__)selfr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   kwargs	__class__s                             e/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddleocr/_pipelines/seal_recognition.pyr*   SealRecognition.__init__   s   :
13V
02T
 '(@
 &'>	

 *+F
 )*D
 -.L
 ,-J
 *+F
 )*D
 *+F
 +,H
  !2
 #$8
  0
  *!
" "#6#
$ )A'>#6.#6%:%:1
4 	"6"    c                     gNseal_recognitionr'   r+   s    r.   _paddlex_pipeline_name&SealRecognition._paddlex_pipeline_nameS       !r0   r   r   r   layout_det_resr   r   r   r    r!   r"   r#   r$   r%   r&   c                Z    U R                   R                  " U4UUUUUUUU	U
UUUUUS.UD6$ Nr8   )paddlex_pipelinepredictr+   inputr   r   r   r9   r   r   r   r    r!   r"   r#   r$   r%   r&   r,   s                    r.   predict_iterSealRecognition.predict_iterW   sY    ( $$,,
)E/!5)-! 3%=$; 3+ 3"7"7
  !
 	
r0   c                X    [        U R                  " U4UUUUUUUU	U
UUUUUS.UD65      $ r;   )listr@   r>   s                    r.   r=   SealRecognition.predict~   s[    ( -I"3%9-!1%$7)A(?$7 /$7&;&;  !
 	
r0   c                     [        5       $ N)$SealRecognitionCLISubcommandExecutor)clss    r.   get_cli_subcommand_executor+SealRecognition.get_cli_subcommand_executor   s    355r0   c           
      N   0 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   =(       d    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)   S*.En[        U5      $ )+NzISubPipelines.DocPreprocessor.SubModules.DocOrientationClassify.model_namer   zHSubPipelines.DocPreprocessor.SubModules.DocOrientationClassify.model_dirr   z?SubPipelines.DocPreprocessor.SubModules.DocUnwarping.model_namer   z>SubPipelines.DocPreprocessor.SubModules.DocUnwarping.model_dirr   z%SubModules.LayoutDetection.model_namer   z$SubModules.LayoutDetection.model_dirr   z$SubModules.LayoutDetection.thresholdr   z%SubModules.LayoutDetection.layout_nmsr   z.SubModules.LayoutDetection.layout_unclip_ratior   z3SubModules.LayoutDetection.layout_merge_bboxes_moder    z9SubPipelines.DocPreprocessor.use_doc_orientation_classifyr   z.SubPipelines.DocPreprocessor.use_doc_unwarpingr   use_doc_preprocessorz8SubPipelines.SealOCR.SubModules.TextDetection.model_namer   z7SubPipelines.SealOCR.SubModules.TextDetection.model_dirr   z<SubPipelines.SealOCR.SubModules.TextDetection.limit_side_lenr!   z8SubPipelines.SealOCR.SubModules.TextDetection.limit_typer"   r#   r$   r%   r   r   r   r&   r   )z4SubPipelines.SealOCR.SubModules.TextDetection.threshz8SubPipelines.SealOCR.SubModules.TextDetection.box_threshz:SubPipelines.SealOCR.SubModules.TextDetection.unclip_ratioz:SubPipelines.SealOCR.SubModules.TextRecognition.model_namez9SubPipelines.SealOCR.SubModules.TextRecognition.model_dirz:SubPipelines.SealOCR.SubModules.TextRecognition.batch_sizez<SubPipelines.SealOCR.SubModules.TextRecognition.score_threshr   )r(   r
   )r+   	STRUCTUREs     r.   _get_paddlex_config_overrides-SealRecognition._get_paddlex_config_overrides   s   E
WY]YeYe5ZE
 WX\XdXd4Y	E
 Nt||*PE
 Mdll)OE
 4T\\-6E
  3DLL,5!E
& 3DLLAS4T'E
( 4T\\,5O)E
* =dll%?+E
0 B4<<*D1E
6 H.J7E
< =dll#?=E
B #DLL1O$P %1||/0EE
F G0IGE
L Ft||/HME
R KDLL)MSE
X G%IYE
^ EILL!E IM%I KO,,'K KO,,-K JN,J KO,,-K MQLL'M %)LL1G$HIE
	L ,I66r0   )r(   )NNNNNNNNNNNNNNNNNNNNNNNN)__name__
__module____qualname____firstlineno__r*   propertyr5   r@   r=   classmethodrI   rN   __static_attributes____classcell__)r-   s   @r.   r   r      s     -1+/!% $$(#''+&*$(#'$(%)! !% $  ""37#r " " &*! !% $  ""#%
V &*! !% $  ""#'
R 6 6G7 G7r0   r   c                   0    \ rS rSr\S 5       rS rS rSrg)rG      c                     gr2   r'   r4   s    r.   subparser_name3SealRecognitionCLISubcommandExecutor.subparser_name   r7   r0   c                 
   [        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                  S0[
        S1S9  g )2Nz%--doc_orientation_classify_model_namez<Name of the document image orientation classification model.)typehelpz$--doc_orientation_classify_model_dirzFPath to the document image orientation classification model directory.z--doc_unwarping_model_namez+Name of the document image unwarping model.z--doc_unwarping_model_dirz5Path to the document image unwarping model directory.z--layout_detection_model_namez#Name of the layout detection model.z--layout_detection_model_dirz-Path to the layout detection model directory.z --seal_text_detection_model_namez&Name of the seal text detection model.z--seal_text_detection_model_dirz0Path to the seal text detection model directory.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--use_doc_orientation_classifyz9Whether to use document image orientation classification.z--use_doc_unwarpingz(Whether to use document image unwarping.z--use_layout_detectionz Whether to use layout detection.z--layout_thresholdz%Threshold for layout detection model.z--layout_nmsz7Non-Maximum Suppression threshold for layout detection.z--layout_unclip_ratioz'Layout detection expansion coefficient.z--layout_merge_bboxes_modez4Mode for merging bounding boxes in layout detection.z--seal_det_limit_side_lenzZThis sets a limit on the side length of the input image for the seal text detection model.z--seal_det_limit_typez}This determines how the side length limit is applied to the input image before feeding it into the seal text detection model.z--seal_det_threshzDetection pixel threshold for the seal text detection model. Pixels with scores greater than this threshold in the output probability map are considered text pixels.z--seal_det_box_threshzDetection box threshold for the seal 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--seal_det_unclip_ratiozSeal text detection expansion coefficient, which expands the text region using this method. The larger the value, the larger the expansion area.z--seal_rec_score_threshz^Text recognition threshold. Text results with scores greater than this threshold are retained.)r   add_argumentstrintr   float)r+   	subparsers     r.   _update_subparser6SealRecognitionCLISubcommandExecutor._update_subparser   s   !),3O 	 	

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

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

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

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

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

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

 	-C 	 	

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

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

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

 	,L 	 	

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

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

 	 8 	 	

 	J 	 	

 	#: 	 	

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

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

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

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

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

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

 	%q 	 	
r0   c                 :    [        U5      n[        [        U5        g rF   )r   r   r   )r+   argsparamss      r.   execute_with_args6SealRecognitionCLISubcommandExecutor.execute_with_argsv  s    $T* &9r0   r'   N)	rP   rQ   rR   rS   rT   r[   re   rj   rV   r'   r0   r.   rG   rG      s     " "z
x:r0   rG   N)
_utils.clir   r   r   r   baser   r	   utilsr
   r   rG   r'   r0   r.   <module>ro      s7     H /Y7, Y7xD:+H D:r0   