
    j                         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	gZ
g d
Zee         ed<   ddgZee         ed<   	 ddededededede	f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	f
dZdS )     )Any)_CompiledModule   )classification)PreProcessor   )OrientationPredictorcrop_orientation_predictorpage_orientation_predictor)magc_resnet31mobilenet_v3_smallmobilenet_v3_small_rmobilenet_v3_largemobilenet_v3_large_rresnet18resnet31resnet34resnet50resnet34_widetextnet_tinytextnet_smalltextnet_base
vgg16_bn_rvit_svit_bvip_tinyvip_baseARCHS#mobilenet_v3_small_crop_orientation#mobilenet_v3_small_page_orientationORIENTATION_ARCHSFarch
pretrained
model_typedisabledkwargsreturnc                    |rt          d d           S t          | t                    r8| t          vrt	          d|  d          t          j        |          |          }nQt
          j        t          g}t          | t          |                    st	          dt          |                      | }|                    d|j        d                   |d<   |                    d|j        d                   |d<   |                    d|dk    rd	nd
          |d<   |j        d         dd          }t          t          |fddd||          }|S )Nzunknown architecture '')r#   zunknown architecture: meanstd
batch_sizecrop      input_shaper   T)preserve_aspect_ratiosymmetric_pad)r	   
isinstancestrr!   
ValueErrorr   __dict__MobileNetV3r   tupletypegetcfgr   )	r"   r#   r$   r%   r&   _modelallowed_archsr0   	predictors	            b/var/www/html/Carbon-Document/venv/lib/python3.11/site-packages/doctr/models/classification/zoo.py_orientation_predictorr@   (   si     0#D$///$ (((=d===>>>  (.*EEE (3_E$m 4 455 	DBd4jjBBCCCZZ
6(:;;F6NJJufj&788F5M!::l:;O;OCCUVWWF<*]+ABB/K$[[D[[TZ[[]c I     r.   r,   c                 $    t          d| ||dd|S )a  Crop orientation classification architecture.

    >>> import numpy as np
    >>> from doctr.models import crop_orientation_predictor
    >>> model = crop_orientation_predictor(arch='mobilenet_v3_small_crop_orientation', pretrained=True)
    >>> input_crop = (255 * np.random.rand(256, 256, 3)).astype(np.uint8)
    >>> out = model([input_crop])

    Args:
        arch: name of the architecture to use (e.g. 'mobilenet_v3_small_crop_orientation')
        pretrained: If True, returns a model pre-trained on our recognition crops dataset
        batch_size: number of samples the model processes in parallel
        **kwargs: keyword arguments to be passed to the OrientationPredictor

    Returns:
        OrientationPredictor
    r-   r"   r#   r,   r$    r@   r"   r#   r,   r&   s       r?   r
   r
   G   %    ( "wt
zflwwpvwwwrA   r/   c                 $    t          d| ||dd|S )a  Page orientation classification architecture.

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

    Args:
        arch: name of the architecture to use (e.g. 'mobilenet_v3_small_page_orientation')
        pretrained: If True, returns a model pre-trained on our recognition crops dataset
        batch_size: number of samples the model processes in parallel
        **kwargs: keyword arguments to be passed to the OrientationPredictor

    Returns:
        OrientationPredictor
    pagerC   rD   rE   rF   s       r?   r   r   ^   rG   rA   N)F)r   Fr.   )r    Fr/   )typingr   doctr.models.utilsr    r   preprocessorr   r>   r	   __all__r   listr4   __annotations__r!   boolr@   intr
   r   rD   rA   r?   <module>rS      s          . . . . . .       ' ' ' ' ' ' + + + + + +')E
F  tCy   * !FGlm 49 m m m DI 
-0<@TW   @ dgx x
xCGx]`xruxx x x x0 dex x
xCGx]`xpsxx x x x x xrA   