
    RЦi@                     <   S r SSKJr  SSKJrJrJrJrJrJ	r	J
r
  SSKrSSKJr  SSKJs  Jr  SSKJrJrJrJr  SSKJrJrJrJrJrJr  SSKJrJr  SS	K J!r!  SS
K"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*  SSK+J,r,J-r-J.r.  SSK/J0r0J1r1  SSK2J3r3J4r4J5r5  SS/r6 " S S\Rn                  5      r8 " S S\Rn                  5      r9SS\:S\;S\84S jjr< SS\:S\=S\;S\84S jjr>    SS\:S\=S\=S\\?   S\;S\84S jjr@SS\:S\=S\;S\84S jjrASS\:S\=S\;S\84S jjrB   SS\:S\=S\\?   S\;S\84
S jjrCSS \:S\\:\4   4S! jjrD\3" 0 S"\D" SS#9_S$\D" S%S&S'S(9_S)\D" S'S%\\S*S+SS,9_S-\D" S.S/S0S1S2S3S'S49_S5\D" S6S'S1S2S.S/S0S7S89_S9\D" S'\\S+S*S:S;SS<9_S=\D" S>S'S%S?9_S@\D" SAS'S%S?9_SB\D" SCS'S%S?9_SD\D" SES'S%S?9_SF\D" SGS'\\SH9_SI\D" SJS'\\SH9_SK\D" SLS'\\SH9_SM\D" SNS'\\SH9_SO\D" SPS'\\SH9_SQ\D" SRS'\\SH9_SS\D" STS'S+S*SU9_0 SV\D" SWS'S+S*SU9_SX\D" SYS'SZS[S*S:S\9_S]\D" 5       _S^\D" S_S'S%S?9_S`\D" SaS'S%S?9_Sb\D" ScS'S%S?9_Sd\D" 5       _Se\D" \\S+S*S%Sf9_Sg\D" S'\\S+S*S%Sh9_Si\D" S'S+S*S%Sj9_Sk\D" S'S+S*S%Sj9_Sl\D" S'\\S+S:S*S;SS%Sm9	_Sn\D" S'S+S:S*S;SS%So9_Sp\D" S'S*S+SS%Sq9_Sr\D" S'SsStS*S%Su9_Sv\D" S'SwSsStSS%Sx9_Sy\D" S'SwSsStSS%Sx9_E0 Sz\D" S'SwSsStSS%Sx9_S{\D" S'SsStS*S|SS%So9_S}\D" S'S+S:S*S;SS%So9_S~\D" S'S+S:S*S;SS%So9_S\D" S'S+S:S*S;SS%So9_S\D" S'SsStS*S|SS%So9_S\D" S'S*S+SS%Sq9_S\D" S'SwS+S:S*S;SS%S9_S\D" S'SsStS*S|SS%So9_S\D" S'SsStS*S|SS%So9_S\D" S+S:S*S%S9_S\D" S'S*S+SS%Sq9_S\D" S'S|SS*SSS%So9_S\D" S'SsStS*SSS%So9_S\D" S'SsStS*SSS%So9_S\D" S'SwSsStS*S|SS%S9_S\D" S*S%S9_ES\D" S+S:S*S%S90E5      rE\4SS\;S\84S jj5       rF\4SS\;S\84S jj5       rG\4SS\;S\84S jj5       rH\4SS\;S\84S jj5       rI\4SS\;S\84S jj5       rJ\4SS\;S\84S jj5       rK\4SS\;S\84S jj5       rL\4SS\;S\84S jj5       rM\4SS\;S\84S jj5       rN\4SS\;S\84S jj5       rO\4SS\;S\84S jj5       rP\4SS\;S\84S jj5       rQ\4SS\;S\84S jj5       rR\4SS\;S\84S jj5       rS\4SS\;S\84S jj5       rT\4SS\;S\84S jj5       rU\4SS\;S\84S jj5       rV\4SS\;S\84S jj5       rW\4SS\;S\84S jj5       rX\4SS\;S\84S jj5       rY\4SS\;S\84S jj5       rZ\4SS\;S\84S jj5       r[\4SS\;S\84S jj5       r\\4SS\;S\84S jj5       r]\4SS\;S\84S jj5       r^\4SS\;S\84S jj5       r_\4SS\;S\84S jj5       r`\4SS\;S\84S jj5       ra\4SS\;S\84S jj5       rb\4SS\;S\84S jj5       rc\4SS\;S\84S jj5       rd\4SS\;S\84S jj5       re\4SS\;S\84S jj5       rf\5" \gS-S5S.5        g)zMobileNet V3

A PyTorch impl of MobileNet-V3, compatible with TF weights from official impl.

Paper: Searching for MobileNetV3 - https://arxiv.org/abs/1905.02244

Hacked together by / Copyright 2019, Ross Wightman
    )partial)AnyDictCallableListOptionalTupleUnionN)IMAGENET_DEFAULT_MEANIMAGENET_DEFAULT_STDIMAGENET_INCEPTION_MEANIMAGENET_INCEPTION_STD)SelectAdaptivePool2dLinear	LayerTypePadTypecreate_conv2dget_norm_act_layer   )build_model_with_cfgpretrained_cfg_for_features)SqueezeExcite)	BlockArgsEfficientNetBuilderdecode_arch_defefficientnet_init_weightsround_channelsresolve_bn_argsresolve_act_layerBN_EPS_TF_DEFAULT)FeatureInfoFeatureHooksfeature_take_indices)checkpoint_seq
checkpoint)generate_default_cfgsregister_modelregister_model_deprecationsMobileNetV3MobileNetV3Featuresc            '         ^  \ rS rSrSrSSSSSSSS	S
S
S
S
S\SSS
SS
S
4S\S\S\S\S\S\S\S\S\	S\
\   S\
\   S\
\   S\
\   S\S\S\S\S\
\   S\	4&U 4S  jjjrS!\R                   4S" jr\R&                  R(                  S9S#\S!\\	\4   4S$ jj5       r\R&                  R(                  S:S%\S!S
4S& jj5       r\R&                  R(                  S!\R2                  4S' j5       rS;S\S\	S!S
4S( jjr      S<S)\R8                  S*\
\\\\   4      S+\S,\S-\	S.\S/\S!\\\R8                     \\R8                  \\R8                     4   4   4S0 jjr     S=S*\\\\   4   S1\S2\S/\S!\\   4
S3 jjr!S)\R8                  S!\R8                  4S4 jr"S9S)\R8                  S5\S!\R8                  4S6 jjr#S)\R8                  S!\R8                  4S7 jr$S8r%U =r&$ )>r)      a  MobileNetV3.

Based on my EfficientNet implementation and building blocks, this model utilizes the MobileNet-v3 specific
'efficient head', where global pooling is done before the head convolution without a final batch-norm
layer before the classifier.

Paper: `Searching for MobileNetV3` - https://arxiv.org/abs/1905.02244

Other architectures utilizing MobileNet-V3 efficient head that are supported by this impl include:
  * HardCoRe-NAS - https://arxiv.org/abs/2102.11646 (defn in hardcorenas.py uses this class)
  * FBNet-V3 - https://arxiv.org/abs/2006.02049
  * LCNet - https://arxiv.org/abs/2109.15099
  * MobileNet-V4 - https://arxiv.org/abs/2404.10518
        F   T N        avg
block_argsnum_classesin_chans	stem_sizefix_stemnum_features	head_bias	head_normpad_type	act_layer
norm_layeraa_layerse_layerse_from_expround_chs_fn	drop_ratedrop_path_ratelayer_scale_init_valueglobal_poolc                   > [         TU ]  5         UUS.nU
=(       d    [        R                  n
U=(       d    [        R                  n[        X5      nU=(       d    [        nX l        X0l        UU l	        SU l
        U(       d  U" U5      n[        X4S4SU	S.UD6U l        U" U4SS0UD6U l        [        SSU	UUU
UUUUUS	.
UD6n[        R                  " U" XA5      6 U l        UR"                  U l        U R$                   Vs/ s H  nUS
   PM
     snU l        UR(                  U l        X`l        [/        US9U l        U R*                  U R0                  R3                  5       -  nU(       aS  [        UU R,                  S4U	SS.UD6U l        U" U R,                  40 UD6U l        [        R8                  " 5       U l        OE[        UU R,                  S4U	US.UD6U l        [        R8                  " 5       U l        U
" SS9U l        U(       a  [        R<                  " S5      O[        R8                  " 5       U l        US:  a  [A        U R,                  U40 UD6O[        R8                  " 5       U l!        [E        U 5        gs  snf )a  Initialize MobileNetV3.

Args:
    block_args: Arguments for blocks of the network.
    num_classes: Number of classes for classification head.
    in_chans: Number of input image channels.
    stem_size: Number of output channels of the initial stem convolution.
    fix_stem: If True, don't scale stem by round_chs_fn.
    num_features: Number of output channels of the conv head layer.
    head_bias: If True, add a learnable bias to the conv head layer.
    head_norm: If True, add normalization to the head layer.
    pad_type: Type of padding to use for convolution layers.
    act_layer: Type of activation layer.
    norm_layer: Type of normalization layer.
    aa_layer: Type of anti-aliasing layer.
    se_layer: Type of Squeeze-and-Excite layer.
    se_from_exp: If True, calculate SE channel reduction from expanded mid channels.
    round_chs_fn: Callable to round number of filters based on depth multiplier.
    drop_rate: Dropout rate.
    drop_path_rate: Stochastic depth rate.
    layer_scale_init_value: Enable layer scale on compatible blocks if not None.
    global_pool: Type of pooling to use for global pooling features of the FC head.
devicedtypeFr.      stridepaddinginplaceT    )
output_strider<   rB   rA   r=   r>   r?   r@   rD   rE   stage	pool_typer   )rN   biasrO   r   N )#super__init__nnReLUBatchNorm2dr   r   r5   r6   rC   grad_checkpointingr   	conv_stembn1r   
Sequentialblocksfeaturesfeature_info
stage_endsin_chsr9   head_hidden_sizer   rF   	feat_mult	conv_head	norm_headIdentityact2Flattenflattenr   
classifierr   )selfr4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rI   rJ   ddnorm_act_layerbuilderfnum_pooled_chs	__class__s                              V/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/timm/models/mobilenetv3.pyrY   MobileNetV3.__init__-   sd   ^ 	/(	12>>
+JB,}& ""' $Y/I&xA`aQY`]_`!)@T@R@ & 
%#!)#9
 
 mmWY%CD#,,/3/@/@A/@!1W:/@A#NN , 0+F**T-=-=-G-G-II*%% ! DN ,D,A,AHRHDNDI +%% ! DN  [[]DN!$/DI(3rzz!}NY\]o&!6!6JrJcecncncp!$'E Bs   I>returnc                    U R                   U R                  /nUR                  U R                  5        UR                  U R                  U R
                  U R                  U R                  /5        UR                  [        R                  " 5       [        R                  " U R                  5      U R                  /5        [        R                  " U6 $ )zYConvert model to sequential form.

Returns:
    Sequential module containing all layers.
)r^   r_   extendra   rF   rh   ri   rk   rZ   rl   DropoutrC   rn   r`   )ro   layerss     rv   as_sequentialMobileNetV3.as_sequential   s     ..$((+dkk"t''STrzz|RZZ%?QR}}f%%    coarsec                 ,    [        SU(       a  SS9$ SS9$ )z"Group parameters for optimization.z^conv_stem|bn1z^blocks\.(\d+)z^blocks\.(\d+)\.(\d+))stemra   )dict)ro   r   s     rv   group_matcherMobileNetV3.group_matcher   s'     "(.$
 	
4L
 	
r   enablec                     Xl         gz)Enable or disable gradient checkpointing.Nr]   ro   r   s     rv   set_grad_checkpointing"MobileNetV3.set_grad_checkpointing   
     #)r   c                     U R                   $ )zGet the classifier head.)rn   )ro   s    rv   get_classifierMobileNetV3.get_classifier   s     r   c                    Xl         [        US9U l        U(       a  [        R                  " S5      O[        R
                  " 5       U l        US:  a  [        U R                  U5      U l	        g[        R
                  " 5       U l	        g)zReset the classifier head.

Args:
    num_classes: Number of classes for new classifier.
    global_pool: Global pooling type.
rS   r   r   N)
r5   r   rF   rZ   rl   rj   rm   r   rf   rn   )ro   r5   rF   s      rv   reset_classifierMobileNetV3.reset_classifier   s[     '/+F(3rzz!}HSVW&!6!6D]_]h]h]jr   xindicesnorm
stop_early
output_fmtintermediates_onlyextra_blocksc                 F   US;   d   S5       eU(       a  U(       d   S5       e/ nU(       a%  [        [        U R                  5      S-   U5      u  pON[        [        U R                  5      U5      u  pU	 Vs/ s H  oR                  U   PM     n	nU R                  U
   n
SnU R	                  U5      nU R                  U5      nX;   a  UR                  U5        [        R                  R                  5       (       d  U(       d  U R                  nOU R                  SU
 n[        USS9 He  u  pU R                  (       a/  [        R                  R                  5       (       d  [        X5      nOU" U5      nX;   d  MT  UR                  U5        Mg     U(       a  U$ X4$ s  snf )a  Forward features that returns intermediates.

Args:
    x: Input image tensor
    indices: Take last n blocks if int, all if None, select matching indices if sequence
    norm: Apply norm layer to compatible intermediates
    stop_early: Stop iterating over blocks when last desired intermediate hit
    output_fmt: Shape of intermediate feature outputs
    intermediates_only: Only return intermediate features
    extra_blocks: Include outputs of all blocks and head conv in output, does not align with feature_info
Returns:

)NCHWzOutput shape must be NCHW.z/Must use intermediates_only for early stopping.r   r   N)start)r#   lenra   rd   r^   r_   appendtorchjitis_scripting	enumerater]   r$   )ro   r   r   r   r   r   r   r   intermediatestake_indices	max_indexifeat_idxra   blks                  rv   forward_intermediates!MobileNetV3.forward_intermediates   sg   . Y&D(DD&%X'XX%&:3t{{;Ka;OQX&Y#L)&:3t;OQX&Y#L8DE1OOA.LE	2I NN1HHQK#  #99!!##:[[F[[),F&vQ7MH&&uyy/E/E/G/G"3*F'$$Q' 8   3 Fs   6F
prune_norm
prune_headc                    U(       a%  [        [        U R                  5      S-   U5      u  pVO0[        [        U R                  5      U5      u  pVU R                  U   nU R                  SU U l        U[        U R                  5      :  a4  [        R
                  " 5       U l        [        R
                  " 5       U l        U(       aF  [        R
                  " 5       U l        [        R
                  " 5       U l        U R                  SS5        U$ )a>  Prune layers not required for specified intermediates.

Args:
    indices: Indices of intermediate layers to keep.
    prune_norm: Whether to prune normalization layer.
    prune_head: Whether to prune the classifier head.
    extra_blocks: Include outputs of all blocks.

Returns:
    List of indices that were kept.
r   Nr   r1   )	r#   r   ra   rd   rZ   rj   rh   ri   r   )ro   r   r   r   r   r   r   s          rv   prune_intermediate_layers%MobileNetV3.prune_intermediate_layers  s    $ &:3t{{;Ka;OQX&Y#L)&:3t;OQX&Y#L	2Ikk*9-s4;;''[[]DN[[]DN[[]DN[[]DN!!!R(r   c                    U R                  U5      nU R                  U5      nU R                  (       a:  [        R                  R                  5       (       d  [        U R                  USS9nU$ U R                  U5      nU$ )zjForward pass through feature extraction layers.

Args:
    x: Input tensor.

Returns:
    Feature tensor.
T)rm   )r^   r_   r]   r   r   r   r$   ra   ro   r   s     rv   forward_featuresMobileNetV3.forward_features'  sg     NN1HHQK""599+A+A+C+Ct{{At<A  AAr   
pre_logitsc                 R   U R                  U5      nU R                  U5      nU R                  U5      nU R                  U5      nU R	                  U5      nU R
                  S:  a)  [        R                  " XR
                  U R                  S9nU(       a  U$ U R                  U5      $ )zForward pass through classifier head.

Args:
    x: Input features.
    pre_logits: Return features before final linear layer.

Returns:
    Classification logits or features.
r2   )ptraining)
rF   rh   ri   rk   rm   rC   Fdropoutr   rn   )ro   r   r   s      rv   forward_headMobileNetV3.forward_head8  s     QNN1NN1IIaLLLO>>B		!~~FAHq!!r   c                 J    U R                  U5      nU R                  U5      nU$ )zGForward pass.

Args:
    x: Input tensor.

Returns:
    Output logits.
)r   r   r   s     rv   forwardMobileNetV3.forwardM  s)     !!!$a r   )rk   ra   r_   rn   rh   r^   rC   rc   rm   rF   r]   rf   r6   ri   r5   r9   rd   FT)r3   )NFFr   FF)r   FTF)'__name__
__module____qualname____firstlineno____doc__r   r   intboolstrr   r   r   floatrY   rZ   r`   r}   r   r   ignorer   r   r   r   Moduler   r   Tensorr
   r   r	   r   r   r   r   r   __static_attributes____classcell__ru   s   @rv   r)   r)      sK   $  $" $"#-1.2,0,0 $%3!$&6:$-r(!r( r( 	r(
 r( r( r( r( r( r(  	*r( !+r( y)r( y)r( r(  #!r(" #r($ "%r(& %-UO'r(( )r( r(h
&r}} 
& YY
D 
T#s(^ 
 
 YY)T )T ) ) YY		  kC kc kd k  8<$$',!&8 ||8  eCcN348  	8 
 8  8  !%8  8  
tELL!5tELL7I)I#JJ	K8 x ./$#!&3S	>*  	
  
cB%,, 5<< ""ell " " "* %,,  r   c            $       L  ^  \ rS rSrSrSSSSSSS	\S
SSSSSSSSS4S\S\\S4   S\	S\S\S\
S\S\S\S\
S\\   S\\   S\\   S\\   S\S\S\\   4"U 4S jjjr\R$                  R&                  S&S \
S!S4S" jj5       rS#\R*                  S!\\R*                     4S$ jrS%rU =r$ )'r*   i[  zMobileNetV3 Feature Extractor.

A work-in-progress feature extraction module for MobileNet-V3 to use as a backbone for segmentation
and object detection models.
)r   r   rK   r.      
bottleneckr.   r/   FrP   r1   TNr2   r4   out_indices.feature_locationr6   r7   r8   rQ   r<   rB   rA   r=   r>   r?   r@   rC   rD   rE   c                   > [         TU ]  5         UUS.nU=(       d    [        R                  nU=(       d    [        R                  nU=(       d    [
        nX@l        Xl        SU l        U(       d  U	" U5      n[        XES4SUS.UD6U l
        U" U40 UD6U l        U" SS9U l        [        SUUU	U
UUUUUUUS.UD6n[        R                  " U" XQ5      6 U l        [!        UR"                  U5      U l        U R$                  R'                  5        Vs0 s H  nUS	   US
   _M     snU l        [+        U 5        SU l        US:w  a9  U R$                  R'                  SS9n[/        UU R1                  5       5      U l        ggs  snf )a  Initialize MobileNetV3Features.

Args:
    block_args: Arguments for blocks of the network.
    out_indices: Output from stages at indices.
    feature_location: Location of feature before/after each block, must be in ['bottleneck', 'expansion'].
    in_chans: Number of input image channels.
    stem_size: Number of output channels of the initial stem convolution.
    fix_stem: If True, don't scale stem by round_chs_fn.
    output_stride: Output stride of the network.
    pad_type: Type of padding to use for convolution layers.
    round_chs_fn: Callable to round number of filters based on depth multiplier.
    se_from_exp: If True, calculate SE channel reduction from expanded mid channels.
    act_layer: Type of activation layer.
    norm_layer: Type of normalization layer.
    aa_layer: Type of anti-aliasing layer.
    se_layer: Type of Squeeze-and-Excite layer.
    drop_rate: Dropout rate.
    drop_path_rate: Stochastic depth rate.
    layer_scale_init_value: Enable layer scale on compatible blocks if not None.
rH   Fr.   rK   rL   TrV   )rQ   r<   rB   rA   r=   r>   r?   r@   rD   rE   r   rR   indexNr   )module	hook_type)keysrW   )rX   rY   rZ   r[   r\   r   r6   rC   r]   r   r^   r_   act1r   r`   ra   r!   rb   rc   	get_dicts_stage_out_idxr   feature_hooksr"   named_modules)ro   r4   r   r   r6   r7   r8   rQ   r<   rB   rA   r=   r>   r?   r@   rC   rD   rE   rI   rJ   rp   rr   rs   hooksru   s                           rv   rY   MobileNetV3Features.__init__b  s   V 	/(	12>>
,} ""' $Y/I&xA`aQY`]_`i.2.d+	 & 
'%#!)#9-
 
 mmWY%CD'(8(8+F?C?P?P?Z?Z?\]?\!qz1W:5?\]!$' "|+%%//5L/ME!-eT5G5G5I!JD , ^s   E?r   rx   c                     Xl         gr   r   r   s     rv   r   *MobileNetV3Features.set_grad_checkpointing  r   r   r   c                    U R                  U5      nU R                  U5      nU R                  U5      nU R                  c  / nSU R                  ;   a  UR                  U5        [        U R                  5       Hs  u  p4U R                  (       a/  [        R                  R                  5       (       d  [        XA5      nOU" U5      nUS-   U R                  ;   d  Mb  UR                  U5        Mu     U$ U R                  U5        U R                  R                  UR                  5      n[        UR!                  5       5      $ )zlForward pass through feature extraction.

Args:
    x: Input tensor.

Returns:
    List of feature tensors.
r   r   )r^   r_   r   r   r   r   r   ra   r]   r   r   r   r%   
get_outputrI   listvalues)ro   r   rb   r   bouts         rv   r   MobileNetV3Features.forward  s     NN1HHQKIIaL%HD'''"!$++.**5993I3I3K3K"1(A!Aq5D///OOA& / OKKN$$//9C

%%r   )
r   r   ra   r_   r^   rC   r   rc   r]   r6   r   )r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   rY   r   r   r   r   r   r   r   r   r   r   s   @rv   r*   r*   [  s    ,;$0"!# "%3 $-1.2,0,0!$&6:)TK!TK sCxTK "	TK
 TK TK TK TK TK #TK TK  	*TK !+TK y)TK y)TK  !TK" "#TK$ %-UO%TK TKl YY)T )T ) )& &$u||*< & &r   variant
pretrainedrx   c                     Sn[         nSnUR                  SS5      (       a  SU;   d  SU;   a  SnO
Sn[        nS	n[        UU U4US:H  US	:g  US
.UD6nUS	:X  a  [	        UR
                  5      Ul        U$ )zCreate a MobileNetV3 model.

Args:
    variant: Model variant name.
    pretrained: Load pretrained weights.
    **kwargs: Additional model arguments.

Returns:
    MobileNetV3 model instance.
r1   Nfeatures_onlyFfeature_cfgfeature_clscfg)r5   r9   	head_convr:   r;   rF   cls)r   pretrained_strictkwargs_filter)r)   popr*   r   r   default_cfg)r   r   kwargsfeatures_mode	model_clsr   models          rv   _create_mnv3r     s     MIMzz/5))F"mv&=!MqM+I!M  $u,'50# E 78I8IJLr         ?channel_multiplierc                     S/SS/S// SQS/S/S//n[        S[        U5      S	[        [        US
9[        [        R
                  40 [        U5      D6[        US5      [        [        SS9S.UD6n[        X40 UD6nU$ )a<  Creates a MobileNet-V3 model.

Ref impl: ?
Paper: https://arxiv.org/abs/1905.02244

Args:
    variant: Model variant name.
    channel_multiplier: Multiplier to number of channels per layer.
    pretrained: Load pretrained weights.
    **kwargs: Additional model arguments.

Returns:
    MobileNetV3 model instance.
ds_r1_k3_s1_e1_c16_nre_noskipir_r1_k3_s2_e4_c24_nreir_r1_k3_s1_e3_c24_nreir_r3_k5_s2_e3_c40_se0.25_nreir_r1_k3_s2_e6_c80zir_r1_k3_s1_e2.5_c80zir_r2_k3_s1_e2.3_c80ir_r2_k3_s1_e6_c112_se0.25ir_r3_k5_s2_e6_c160_se0.25cn_r1_k1_s1_c960F
multiplier
hard_swishhard_sigmoid)
gate_layer)r4   r:   rB   r>   r=   r@   rW   )
r   r   r   r   rZ   r\   r   r   r   r   r   r   r   r   arch_defmodel_kwargsr   s          rv   _gen_mobilenet_v3_rwr    s    & 
))	!#;<	()N	%&	%&	H   "8,^8JK2>>E_V-DE#FL9>B L ==ELr   depth_multiplier
group_sizec                    SU ;   aB  SnSU ;   a  [        US5      nS/SS/SS	/S
/S/S//nOb[        US5      nS/SS/SS/S/S/S//nOESnSU ;   a  [        US5      nS/SS/S// SQS/S/S//nO[        US5      nS/SS /S!// SQS"/S#/S//n[        [        S$[        R                  [
        S%9n	[        S+[        XUS&9US'US(:  [        [
        US)9[        [        R                  40 [        U5      D6UU	S*.UD6n
[        X40 U
D6nU$ ),a  Creates a MobileNet-V3 model.

Ref impl: ?
Paper: https://arxiv.org/abs/1905.02244

Args:
    variant: Model variant name.
    channel_multiplier: Multiplier to number of channels per layer.
    depth_multiplier: Depth multiplier for model scaling.
    group_size: Group size for grouped convolutions.
    pretrained: Load pretrained weights.
    **kwargs: Additional model arguments.

Returns:
    MobileNetV3 model instance.
smalli   minimalreluds_r1_k3_s2_e1_c16zir_r1_k3_s2_e4.5_c24zir_r1_k3_s1_e3.67_c24ir_r1_k3_s2_e4_c40ir_r2_k3_s1_e6_c40ir_r2_k3_s1_e3_c48ir_r3_k3_s2_e6_c96cn_r1_k1_s1_c576r  zds_r1_k3_s2_e1_c16_se0.25_nrezir_r1_k3_s2_e4.5_c24_nrezir_r1_k3_s1_e3.67_c24_nreir_r1_k5_s2_e4_c40_se0.25zir_r2_k5_s1_e6_c40_se0.25zir_r2_k5_s1_e3_c48_se0.25zir_r3_k5_s2_e6_c96_se0.25r0   ds_r1_k3_s1_e1_c16ir_r1_k3_s2_e4_c24ir_r1_k3_s1_e3_c24ir_r3_k3_s2_e3_c40r  ir_r2_k3_s1_e6_c112ir_r3_k3_s2_e6_c160r  ds_r1_k3_s1_e1_c16_nrer  r  r  r  r  r  )r  force_act_layerrd_round_fn)r  r  r/         ?r	  )r4   r9   r7   r8   rB   r>   r=   r@   rW   )r   r   r   rZ   r[   r   r   r   r\   r   r   )r   r   r  r  r   r   r9   r=   r  r@   r  r   s               rv   _gen_mobilenet_v3r)  -  s   0 ')&&9I &&')@A%';<%&%&#$H *&,?I 11+-HI,.IJ,-,-#$H )&&9I &&%';<%&V&'&'#$H" *&,?I **)+CD01V-.-.#$H  }QSQXQXftuH 
"8[ef!#d*^8JK2>>E_V-DE
 
L ==ELr   c                    U R                  S5      S   nUS;   a  SnS/SS/SS	/S
S/SS// SQS//nOBUS:X  a  SnS/SS/SS/SS/SS// SQS//nO$US:X  a  SnS/SS/S S!/S"S#/S$S%// S&QS'//nO[        e[        [        US(S)9n[        [        S*US+9n[        US,5      n	[        S0[        U5      S-S.UUS.[        [        R                  40 [        U5      D6U	US/.	UD6n
[        X40 U
D6nU$ )1a  FBNetV3 model generator.

Paper: `FBNetV3: Joint Architecture-Recipe Search using Predictor Pretraining`
    - https://arxiv.org/abs/2006.02049
FIXME untested, this is a preliminary impl of some FBNet-V3 variants.

Args:
    variant: Model variant name.
    channel_multiplier: Channel width multiplier.
    pretrained: Load pretrained weights.
    **kwargs: Additional model arguments.

Returns:
    MobileNetV3 model instance.
_)ar   r/   ds_r2_k3_s1_e1_c16ir_r1_k5_s2_e4_c24ir_r3_k5_s1_e2_c24zir_r1_k5_s2_e5_c40_se0.25zir_r4_k5_s1_e3_c40_se0.25ir_r1_k5_s2_e5_c72ir_r4_k3_s1_e3_c72zir_r1_k3_s1_e5_c120_se0.25zir_r5_k5_s1_e3_c120_se0.25)zir_r1_k3_s2_e6_c184_se0.25zir_r5_k5_s1_e4_c184_se0.25zir_r1_k5_s1_e6_c224_se0.25cn_r1_k1_s1_c1344d   ir_r1_k3_s2_e5_c24ir_r5_k3_s1_e2_c24r  zir_r4_k3_s1_e3_c40_se0.25ir_r1_k3_s2_e5_c72zir_r1_k3_s1_e5_c128_se0.25zir_r6_k5_s1_e3_c128_se0.25)zir_r1_k3_s2_e6_c208_se0.25zir_r5_k5_s1_e5_c208_se0.25zir_r1_k5_s1_e6_c240_se0.25cn_r1_k1_s1_c1440grP   ds_r3_k3_s1_e1_c24ir_r1_k5_s2_e4_c40ir_r4_k5_s1_e2_c40zir_r1_k5_s2_e4_c56_se0.25zir_r4_k5_s1_e3_c56_se0.25ir_r1_k5_s2_e5_c104ir_r4_k3_s1_e3_c104zir_r1_k3_s1_e5_c160_se0.25zir_r8_k5_s1_e3_c160_se0.25)zir_r1_k3_s2_e6_c264_se0.25zir_r6_k5_s1_e5_c264_se0.25zir_r2_k5_s1_e6_c288_se0.25cn_r1_k1_s1_c1728ffffff?)r
  round_limitr  )r  r'  r  i  F)	r4   r9   r:   r7   rB   rA   r>   r=   r@   rW   )splitNotImplementedr   r   r   r   r   r   rZ   r\   r   r   )r   r   r   r   vlr7   r  rB   r@   r=   r  r   s               rv   _gen_fbnetv3rF    s     
s	B	B	Z	!"!#78(*EF!#78)+GHf !
 
s	!"!#78(*EF!#78)+GHf !
 
s	!"!#78(*EF"$9:)+GHf !
 >6HVZ[L}\ZH!&,7I "8,!2>>E_V-DE L ==ELr   c                    S/S/S/SS/S/S//n[        S[        U5      S[        [        US	9[        [        R
                  40 [        U5      D6[        US
5      [        [        S[        R                  S9SS.UD6n[        X40 UD6nU$ )a  LCNet model generator.

Essentially a MobileNet-V3 crossed with a MobileNet-V1

Paper: `PP-LCNet: A Lightweight CPU Convolutional Neural Network` - https://arxiv.org/abs/2109.15099

Args:
    variant: Model variant name.
    channel_multiplier: Multiplier to number of channels per layer.
    pretrained: Load pretrained weights.
    **kwargs: Additional model arguments.

Returns:
    MobileNetV3 model instance.
dsa_r1_k3_s1_c32dsa_r2_k3_s2_c64dsa_r2_k3_s2_c128dsa_r1_k3_s2_c256dsa_r1_k5_s1_c256dsa_r4_k5_s1_c256zdsa_r2_k5_s2_c512_se0.25r/   r	  r  r  )r  r&  r0   )r4   r7   rB   r>   r=   r@   r9   rW   )r   r   r   r   rZ   r\   r   r   r   r[   r   r  s          rv   
_gen_lcnetrN    s    $ 
			12		#$H  	"8,^8JK2>>E_V-DE#FL9>SUSZSZ[	 	L ==ELr   c                 f   SnSU ;   aU  SnSU ;   a  Sn[        US5      nS/SS	// S
Q/ SQS//n	OSU ;   a  Sn[        US5      nS/SS// SQ/ SQS//n	O SU  S35       eSnSU ;   a  Sn[        US5      nSS/SS// SQ/ SQS//n	OSSU ;   a  Sn[        US5      nS/SS	// SQ/ S QS//n	O/SU ;   a  Sn[        US5      nS/SS// S!Q/ S"QS//n	O SU  S35       e[        S([        XS#9SS$UUUS%:  [        [        US&9[        [
        R                  40 [        U5      D6UUS'.
UD6n
[        X40 U
D6nU$ ))ae  Creates a MobileNet-V4 model.

Paper: https://arxiv.org/abs/2404.10518

Args:
    variant: Model variant name.
    channel_multiplier: Multiplier to number of channels per layer.
    group_size: Group size for grouped convolutions.
    pretrained: Load pretrained weights.
    **kwargs: Additional model arguments.

Returns:
    MobileNetV3 model instance.
r0   hybridgh㈵>mediumrP   r  er_r1_k3_s2_e4_c48uir_r1_a3_k5_s2_e4_c80uir_r1_a3_k3_s1_e2_c80)uir_r1_a3_k5_s2_e6_c160uir_r1_a0_k0_s1_e2_c160uir_r1_a3_k3_s1_e4_c160uir_r1_a3_k5_s1_e4_c160mqa_r1_k3_h4_s1_v2_d64_c160rW  rY  uir_r1_a3_k0_s1_e4_c160rY  rW  rY  rZ  )uir_r1_a5_k5_s2_e6_c256uir_r1_a5_k5_s1_e4_c256uir_r2_a3_k5_s1_e4_c256uir_r1_a0_k0_s1_e2_c256uir_r1_a3_k5_s1_e2_c256r^  uir_r1_a0_k0_s1_e4_c256mqa_r1_k3_h4_s1_d64_c256uir_r1_a3_k0_s1_e4_c256ra  r\  ra  uir_r1_a5_k0_s1_e4_c256ra  rc  r  larger5  geluuir_r1_a3_k5_s2_e4_c96uir_r1_a3_k3_s1_e4_c96)uir_r1_a3_k5_s2_e4_c192uir_r3_a3_k3_s1_e4_c192uir_r1_a3_k5_s1_e4_c192uir_r2_a5_k3_s1_e4_c192mqa_r1_k3_h8_s1_v2_d48_c192uir_r1_a5_k3_s1_e4_c192rl  rm  rl  rm  rl  uir_r1_a3_k0_s1_e4_c192)uir_r4_a5_k5_s2_e4_c512uir_r1_a5_k0_s1_e4_c512uir_r1_a5_k3_s1_e4_c512uir_r2_a5_k0_s1_e4_c512rq  uir_r1_a5_k5_s1_e4_c512mqa_r1_k3_h8_s1_d64_c512rp  rt  rp  rt  rp  rt  rp  FzUnknown variant .Nr  cn_r1_k3_s2_e1_c32cn_r1_k1_s1_e1_c32cn_r1_k3_s2_e1_c96cn_r1_k1_s1_e1_c64)uir_r1_a5_k5_s2_e3_c96uir_r4_a0_k3_s1_e2_c96uir_r1_a3_k0_s1_e4_c96)uir_r1_a3_k3_s2_e6_c128uir_r1_a5_k5_s1_e4_c128uir_r1_a0_k5_s1_e4_c128uir_r1_a0_k5_s1_e3_c128uir_r2_a0_k3_s1_e4_c128)rU  uir_r2_a3_k3_s1_e4_c160rX  rW  rZ  rV  rZ  )	r[  r\  r]  r`  rb  r_  r\  uir_r2_a0_k0_s1_e4_c256uir_r1_a5_k0_s1_e2_c256)rh  ri  rj  uir_r5_a5_k3_s1_e4_c192rn  )ro  rp  rq  rr  rq  rs  uir_r3_a5_k0_s1_e4_c512)r  Tr   r	  )
r4   r:   r;   r9   r7   r8   rB   r>   r=   rE   rW   )	r   r   r   r   r   rZ   r\   r   r   )r   r   r  r   r   r9   rE   r7   r=   r  r  r   s               rv   _gen_mobilenet_v4r    sB   * L7!%wI)&&9I )
 -,
& 'Y/H` I)&&9I )
 -,
$ 'W.H` 8,WIQ775!%gI)&&9I )( )(
 '5H<  I)&&9I )
 -,

 'C$HJ I)&&9I )
 -,
	 '=!HF 8,WIQ775 "8C!#c)^8JK2>>E_V-DE5 L ==ELr   r1   urlc                 2    U SSSSS[         [        SSSS	.UE$ )
zCreate default configuration dictionary.

Args:
    url: Model weight URL.
    **kwargs: Additional configuration options.

Returns:
    Configuration dictionary.
r-   )r.      r  )   r  g      ?bilinearr^   rn   z
apache-2.0)r  r5   
input_size	pool_sizecrop_pctinterpolationmeanstd
first_convrn   license)r   r   )r  r   s     rv   _cfgr    s5     4}SYJ%.B!
 $* r   zmobilenetv3_large_075.untrained)r  zmobilenetv3_large_100.ra_in1kbicubiczvhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mobilenetv3_large_100_ra-f55367f5.pthztimm/)r  r  	hf_hub_idz)mobilenetv3_large_100.ra4_e3600_r224_in1krA  )r.      r  )r  r  r  r  r  test_input_sizetest_crop_pctz(mobilenetv3_large_100.miil_in21k_ft_in1kr  )r2   r2   r2   )r   r   r   z+https://github.com/Alibaba-MIIL/ImageNet21KzarXiv:2104.10972v4zhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tresnet/mobilenetv3_large_100_1k_miil_78_0-66471c13.pth)r  r  r  
origin_url	paper_idsr  r  z mobilenetv3_large_100.miil_in21kz~https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-tresnet/mobilenetv3_large_100_in21k_miil-d71cc17b.pthi+  )r  r  r  r  r  r  r  r5   z*mobilenetv3_large_150d.ra4_e3600_r256_in1k)   r  )r.   @  r  )r  r  r  r  r  r  r  r  zmobilenetv3_small_050.lamb_in1kzyhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mobilenetv3_small_050_lambc-4b7bbe87.pth)r  r  r  zmobilenetv3_small_075.lamb_in1kzyhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mobilenetv3_small_075_lambc-384766db.pthzmobilenetv3_small_100.lamb_in1kzxhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mobilenetv3_small_100_lamb-266a294c.pthzmobilenetv3_rw.rmsp_in1kzmhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/mobilenetv3_100-35495452.pthztf_mobilenetv3_large_075.in1kzvhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_mobilenetv3_large_075-150ee8b0.pth)r  r  r  r  ztf_mobilenetv3_large_100.in1kzvhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_mobilenetv3_large_100-427764d5.pthz%tf_mobilenetv3_large_minimal_100.in1kz~https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_mobilenetv3_large_minimal_100-8596ae28.pthztf_mobilenetv3_small_075.in1kzvhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_mobilenetv3_small_075-da427f52.pthztf_mobilenetv3_small_100.in1kzvhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_mobilenetv3_small_100-37f49e2b.pthz%tf_mobilenetv3_small_minimal_100.in1kz~https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/tf_mobilenetv3_small_minimal_100-922a7843.pthzfbnetv3_b.ra2_in1kzkhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/fbnetv3_b_224-ead5d2a1.pth)r  r  r  r  zfbnetv3_d.ra2_in1kzkhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/fbnetv3_d_224-c98bce42.pthzfbnetv3_g.ra2_in1kzkhttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/fbnetv3_g_240-0b1df83b.pth)r.      r  )r.      r  )r  r  r  r  r  r  zlcnet_035.untrainedzlcnet_050.ra2_in1kzghttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/lcnet_050-f447553b.pthzlcnet_075.ra2_in1kzghttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/lcnet_075-318cad2c.pthzlcnet_100.ra2_in1kzghttps://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/lcnet_100-a929038c.pthzlcnet_150.untrainedz$mobilenetv4_conv_small_035.untrained)r  r  r  r  r  z*mobilenetv4_conv_small_050.e3000_r224_in1k)r  r  r  r  r  r  z&mobilenetv4_conv_small.e2400_r224_in1k)r  r  r  r  z&mobilenetv4_conv_small.e1200_r224_in1kz&mobilenetv4_conv_small.e3600_r256_in1k)	r  r  r  r  r  r  r  r  r  z&mobilenetv4_conv_medium.e500_r256_in1k)r  r  r  r  r  r  r  z&mobilenetv4_conv_medium.e500_r224_in1k)r  r  r  r  r  z/mobilenetv4_conv_medium.e250_r384_in12k_ft_in1k)r.     r  )   r  )r  r  r  r  r  z'mobilenetv4_conv_medium.e180_r384_in12ki-.  )r  r5   r  r  r  r  z*mobilenetv4_conv_medium.e180_ad_r384_in12kz'mobilenetv4_conv_medium.e250_r384_in12kz%mobilenetv4_conv_large.e600_r384_in1k)r.     r  z%mobilenetv4_conv_large.e500_r256_in1kz1mobilenetv4_hybrid_medium.e200_r256_in12k_ft_in1kz+mobilenetv4_hybrid_medium.ix_e550_r256_in1kz+mobilenetv4_hybrid_medium.ix_e550_r384_in1kz(mobilenetv4_hybrid_medium.e500_r224_in1kz)mobilenetv4_hybrid_medium.e200_r256_in12k)r  r5   r  r  r  r  r  r  z*mobilenetv4_hybrid_large.ix_e600_r384_in1kz'mobilenetv4_hybrid_large.e600_r384_in1kz$mobilenetv4_conv_aa_medium.untrained)r  r  r  r  z+mobilenetv4_conv_blur_medium.e500_r224_in1kz1mobilenetv4_conv_aa_large.e230_r448_in12k_ft_in1k)   r  )r.      r  z1mobilenetv4_conv_aa_large.e230_r384_in12k_ft_in1k)r.     r  z(mobilenetv4_conv_aa_large.e600_r384_in1kz)mobilenetv4_conv_aa_large.e230_r384_in12kz'mobilenetv4_hybrid_medium_075.untrained)r  r  z&mobilenetv4_hybrid_large_075.untrainedc                      [        SSU 0UD6nU$ )MobileNet V3 r   )mobilenetv3_large_075r(  r)  r   r   r   s      rv   r  r         ]
]V\]ELr   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv3_large_100r   r  r  s      rv   r  r         \z\U[\ELr   c                 "    [        SSU S.UD6nU$ )r  g333333?)r  r   )mobilenetv3_large_150d      ?r  r  s      rv   r  r    s     sc^hslrsELr   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv3_small_050      ?r  r  s      rv   r  r    r  r   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv3_small_075r(  r  r  s      rv   r  r    r  r   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv3_small_100r   r  r  s      rv   r  r  "  r  r   c                 L    UR                  S[        5        [        SSU 0UD6nU$ )r  bn_epsr   )mobilenetv3_rwr   )
setdefaultr    r  r  s      rv   r  r  )  s-     h 12 X:XQWXELr   c                 p    UR                  S[        5        UR                  SS5        [        SSU 0UD6nU$ )r  r  r<   samer   )tf_mobilenetv3_large_075r(  r  r    r)  r  s      rv   r  r  1  =     h 12
j&)`:`Y_`ELr   c                 p    UR                  S[        5        UR                  SS5        [        SSU 0UD6nU$ )r  r  r<   r  r   )tf_mobilenetv3_large_100r   r  r  s      rv   r  r  :  =     h 12
j&)_*_X^_ELr   c                 p    UR                  S[        5        UR                  SS5        [        SSU 0UD6nU$ )r  r  r<   r  r   ) tf_mobilenetv3_large_minimal_100r   r  r  s      rv   r  r  C  >     h 12
j&)gR\g`fgELr   c                 p    UR                  S[        5        UR                  SS5        [        SSU 0UD6nU$ )r  r  r<   r  r   )tf_mobilenetv3_small_075r(  r  r  s      rv   r  r  L  r  r   c                 p    UR                  S[        5        UR                  SS5        [        SSU 0UD6nU$ )r  r  r<   r  r   )tf_mobilenetv3_small_100r   r  r  s      rv   r  r  U  r  r   c                 p    UR                  S[        5        UR                  SS5        [        SSU 0UD6nU$ )r  r  r<   r  r   ) tf_mobilenetv3_small_minimal_100r   r  r  s      rv   r  r  ^  r  r   c                      [        SSU 0UD6nU$ )z
FBNetV3-B r   )	fbnetv3_brF  r  s      rv   r  r  g       FFvFELr   c                      [        SSU 0UD6nU$ )z
FBNetV3-D r   )	fbnetv3_dr  r  s      rv   r  r  n  r  r   c                      [        SSU 0UD6nU$ )z
FBNetV3-G r   )	fbnetv3_gr  r  s      rv   r  r  u  r  r   c                      [        SSU 0UD6nU$ )zPP-LCNet 0.35r   )	lcnet_035ffffff?rN  r  s      rv   r  r  |       JZJ6JELr   c                      [        SSU 0UD6nU$ )zPP-LCNet 0.5r   )	lcnet_050r  r  r  s      rv   r  r         IJI&IELr   c                      [        SSU 0UD6nU$ )PP-LCNet 1.0r   )	lcnet_075r(  r  r  s      rv   r  r    r  r   c                      [        SSU 0UD6nU$ )r  r   )	lcnet_100r   r  r  s      rv   r  r    r  r   c                      [        SSU 0UD6nU$ )zPP-LCNet 1.5r   )	lcnet_150r  r  r  s      rv   r  r    r  r   c                      [        SSU 0UD6nU$ )MobileNet V4 r   )mobilenetv4_conv_small_035r  r  r  s      rv   r  r         bZb[abELr   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv4_conv_small_050r  r  r  s      rv   r  r    r  r   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv4_conv_smallr   r  r  s      rv   r  r    r  r   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv4_conv_mediumr   r  r  s      rv   r  r    s     ^^W]^ELr   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv4_conv_larger   r  r  s      rv   r  r    r  r   c                      [        SSU 0UD6nU$ )MobileNet V4 Hybrid r   )mobilenetv4_hybrid_mediumr   r  r  s      rv   r  r    s     `:`Y_`ELr   c                      [        SSU 0UD6nU$ )MobileNet V4 Hybridr   )mobilenetv4_hybrid_larger   r  r  s      rv   r  r    s     _*_X^_ELr   c                 "    [        SU SS.UD6nU$ )MobileNet V4 w/ AvgPool AA r3   r   r?   )mobilenetv4_conv_aa_mediumr   r  r  s      rv   r  r    s     qJafqjpqELr   c                 "    [        SU SS.UD6nU$ )zMobileNet V4 Conv w/ Blur AA blurpcr  )mobilenetv4_conv_blur_mediumr   r  r  s      rv   r  r    s     vjckvouvELr   c                 "    [        SU SS.UD6nU$ )r  r3   r  )mobilenetv4_conv_aa_larger   r  r  s      rv   r  r    s     p:`epiopELr   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv4_hybrid_medium_075r(  r  r  s      rv   r  r    s     ePZe^deELr   c                      [        SSU 0UD6nU$ )r  r   )mobilenetv4_hybrid_large_075r(  r  r  s      rv   r  r    s     dzd]cdELr   )mobilenetv3_large_100_miil mobilenetv3_large_100_miil_in21kr   )r   F)r   r   NF)r   NF)r1   )hr   	functoolsr   typingr   r   r   r   r   r	   r
   r   torch.nnrZ   torch.nn.functional
functionalr   	timm.datar   r   r   r   timm.layersr   r   r   r   r   r   _builderr   r   _efficientnet_blocksr   _efficientnet_builderr   r   r   r   r   r   r   r    	_featuresr!   r"   r#   _manipulater$   r%   	_registryr&   r'   r(   __all__r   r)   r*   r   r   r   r   r  r   r)  rF  rN  r  r  default_cfgsr  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   rW   r   rv   <module>r     sZ    D D D     r r k k G /J J J F F 3 Y Y/
0{")) {|	}&")) }&@!# !4 !k !J KP++*/+CG++` %("%$( mm!m  m SM	m
 m m`D# D5 DD Dgr DN* * *$ *ep *^ %($( 	@@!@ SM@ 	@ @Fc T#s(^ & % W&%t|W&#T E&W& 0&=CY}C2IW& / |@& O1W&  ' M@& |SX)Z!W&, 1$$*@ 46S`ps3u-W&6 &t H(!7W&> &t H(!?W&F &t G(!GW&P {!!QW&Z $T E$*@&B[W&b $T E$*@&BcW&j ,T M$*@.BkW&r $T E$*@&BsW&z $T F$*@&B{W&B ,T M$*@.BCW&L $y%6MW&T $y%6UW&\ $y -$Z`b]W&f 46gW&h $uiW&r $usW&| $u}W&F 46GW&J +D$*@%T-TKW&P 1$$*@%T3TQW&X -d%T/TYW&^ -d%T/T_W&d -d$*@ FT%S		/SeW&n -d F}CW`/boW&v -d}CW`/bwW&~ 6t HY80W&F .t HI	0/GW&P 1$ HI	3/QW&Z .t HI	0/[W&f ,T H}CW`.bgW&n ,T F}CW`.boW&x 8 F}CW`:byW&@ 24 F}CW`4bAW&H 24 H}CW`4bIW&P /}CW`1bQW&V 0 F}CW`	2bWW&` 1$ H}CW`3baW&h .t H}CW`0biW&t +D FTQZ-\uW&z 24}CW`4b{W&@ 8 H}CW`:bAW&H 8 H}CW`:bIW&P / H}CW`1bQW&X 0 H}CW`	2bYW&b .tY00cW&h -d FTQZ/\iW& Wt d    d   
 t +  
 d    d    d    t +    K    K    K    K    K    K   $ [   $ [   $ [   $ [   $ [   $ [   $ [   $ [   4 k   4 k   t +    ;   t +   $ [    K   4 k   T    $ [   d    T    H"L(J' r   