
    jW                         U d dl mZ d dlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ d	gZee         ed
<   g dZddededededef
dZ	 	 	 	 	 	 ddedededededededefdZdS )    )Any)_CompiledModule   )	detection)reparameterize)PreProcessor   )DetectionPredictordetection_predictorARCHS)	db_resnet34db_resnet50db_mobilenet_v3_largelinknet_resnet18linknet_resnet34linknet_resnet50	fast_tiny
fast_small	fast_baseTarch
pretrainedassume_straight_pageskwargsreturnc                 \   t          | t                    rw| t          vrt          d|  d          t	          j        |          ||                    dd          |          }t          |t          j                  rt          |          }nzt          j	        t          j
        t          j        t          g}t          | t          |                    st          dt          |                      | }||_        ||j        _        |                    dd            |                    d|j        d                   |d<   |                    d|j        d                   |d<   |                    d	d
          |d	<   t%          t'          |j        d         dd          fi ||          }|S )Nzunknown architecture ''pretrained_backboneT)r   r   r   zunknown architecture: meanstd
batch_sizer   input_shaper	   )
isinstancestrr   
ValueErrorr   __dict__getFASTr   DBNetLinkNetr   tupletyper   postprocessorpopcfgr
   r   )r   r   r   r   _modelallowed_archs	predictors          ]/var/www/html/Carbon-Document/venv/lib/python3.11/site-packages/doctr/models/detection/zoo.py
_predictorr3       s   $ Ku=d===>>>#D)! &

+@$ G G"7
 
 
 fin-- 	,#F++F #)*;Y^_]$m 4 455 	DBd4jjBBCCC'<$5J2
JJ$d+++ZZ
6(:;;F6NJJufj&788F5M!::lA66F<"VZ.qrr2==f== I     r   Fpreserve_aspect_ratiosymmetric_padr    c           
      (    t          d| |||||d|S )a  Text detection architecture.

    >>> import numpy as np
    >>> from doctr.models import detection_predictor
    >>> model = detection_predictor(arch='db_resnet50', pretrained=True)
    >>> input_page = (255 * np.random.rand(600, 800, 3)).astype(np.uint8)
    >>> out = model([input_page])

    Args:
        arch: name of the architecture or model itself to use (e.g. 'db_resnet50')
        pretrained: If True, returns a model pre-trained on our text detection dataset
        assume_straight_pages: If True, fit straight boxes to the page
        preserve_aspect_ratio: If True, pad the input document image to preserve the aspect ratio before
            running the detection model on it
        symmetric_pad: if True, pad the image symmetrically instead of padding at the bottom-right
        batch_size: number of samples the model processes in parallel
        **kwargs: optional keyword arguments passed to the architecture

    Returns:
        Detection predictor
    )r   r   r   r5   r6   r     )r3   )r   r   r   r5   r6   r    r   s          r2   r   r   D   s<    <  33#    r4   N)T)r   FTTTr   )typingr   doctr.models.utilsr    r   detection.fastr   preprocessorr   r1   r
   __all__listr#   __annotations__r   boolr3   intr   r8   r4   r2   <module>rC      sa          . . . . . .       + + + + + + ' ' ' ' ' ' ) ) ) ) ) ) 
!Cy   
	 
	 
	! !S !d !4 !Z] !bt ! ! ! !J "&"&& &
&&  &  	&
 & & & & & & & & &r4   