o
    2h1                     @   s   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 dlmZ dZd	Zed
dg								dddZeddddZeddddZejjdejejde_ejje_dS )     )backend)layers)keras_export)imagenet_utils)
Functional)operation_utils)
file_utilszthttps://storage.googleapis.com/tensorflow/keras-applications/xception/xception_weights_tf_dim_ordering_tf_kernels.h5zzhttps://storage.googleapis.com/tensorflow/keras-applications/xception/xception_weights_tf_dim_ordering_tf_kernels_notop.h5z$keras.applications.xception.Xceptionzkeras.applications.XceptionTimagenetN  softmaxxceptionc                 C   s~  |dv st |std|dkr| r|dkrtd| tj|ddt | |d}|d	u r6tj|d
}nt	|sCtj||d}n|}t dkrMdnd}	tj
dddddd|}
tj|	dd|
}
tjddd|
}
tj
ddddd|
}
tj|	dd|
}
tjddd|
}
tj
dd dd!dd"|
}tj|	d#|}tjddd!dd$d%|
}
tj|	d&d|
}
tjdd'd|
}
tjddd!dd(d%|
}
tj|	d)d|
}
tjddd!d*d+|
}
t|
|g}
tj
d,d dd!dd"|
}tj|	d#|}tjdd-d|
}
tjd,dd!dd.d%|
}
tj|	d/d|
}
tjdd0d|
}
tjd,dd!dd1d%|
}
tj|	d2d|
}
tjddd!d3d+|
}
t|
|g}
tj
d4d dd!dd"|
}tj|	d#|}tjdd5d|
}
tjd4dd!dd6d%|
}
tj|	d7d|
}
tjdd8d|
}
tjd4dd!dd9d%|
}
tj|	d:d|
}
tjddd!d;d+|
}
t|
|g}
td<D ]}|
}d=t|d>  }tjd|d? d|
}
tjd4dd!d|d@ d%|
}
tj|	|dA d|
}
tjd|dB d|
}
tjd4dd!d|dC d%|
}
tj|	|dD d|
}
tjd|dE d|
}
tjd4dd!d|dF d%|
}
tj|	|dG d|
}
t|
|g}
qtj
dHd dd!dd"|
}tj|	d#|}tjddId|
}
tjd4dd!ddJd%|
}
tj|	dKd|
}
tjddLd|
}
tjdHdd!ddMd%|
}
tj|	dNd|
}
tjddd!dOd+|
}
t|
|g}
tjdPdd!ddQd%|
}
tj|	dRd|
}
tjddSd|
}
tjdTdd!ddUd%|
}
tj|	dVd|
}
tjddWd|
}
| rtjdXd|
}
t|| tj||dYdZ|
}
n|d[krt |
}
n|d\krt |
}
|d	urt|}n|}t||
|d}|dkr3| r#t jd]td^d_d`}n	t jdatd^dbd`}|| |S |d	ur=|| |S )ca  Instantiates the Xception architecture.

    Reference:
    - [Xception: Deep Learning with Depthwise Separable Convolutions](
        https://arxiv.org/abs/1610.02357) (CVPR 2017)

    For image classification use cases, see
    [this page for detailed examples](
      https://keras.io/api/applications/#usage-examples-for-image-classification-models).

    For transfer learning use cases, make sure to read the
    [guide to transfer learning & fine-tuning](
      https://keras.io/guides/transfer_learning/).

    The default input image size for this model is 299x299.

    Note: each Keras Application expects a specific kind of input preprocessing.
    For Xception, call `keras.applications.xception.preprocess_input`
    on your inputs before passing them to the model.
    `xception.preprocess_input` will scale input pixels between -1 and 1.

    Args:
        include_top: whether to include the 3 fully-connected
            layers at the top of the network.
        weights: one of `None` (random initialization),
            `"imagenet"` (pre-training on ImageNet),
            or the path to the weights file to be loaded.
        input_tensor: optional Keras tensor
            (i.e. output of `layers.Input()`)
            to use as image input for the model.
        input_shape: optional shape tuple, only to be specified
            if `include_top` is `False` (otherwise the input shape
            has to be `(299, 299, 3)`.
            It should have exactly 3 inputs channels,
            and width and height should be no smaller than 71.
            E.g. `(150, 150, 3)` would be one valid value.
        pooling: Optional pooling mode for feature extraction
            when `include_top` is `False`.
            - `None` means that the output of the model will be
                the 4D tensor output of the
                last convolutional block.
            - `avg` means that global average pooling
                will be applied to the output of the
                last convolutional block, and thus
                the output of the model will be a 2D tensor.
            - `max` means that global max pooling will
                be applied.
        classes: optional number of classes to classify images
            into, only to be specified if `include_top` is `True`, and
            if no `weights` argument is specified. Defaults to `1000`.
        classifier_activation: A `str` or callable. The activation function to
            use on the "top" layer. Ignored unless `include_top=True`. Set
            `classifier_activation=None` to return the logits of the "top"
            layer.  When loading pretrained weights, `classifier_activation` can
            only be `None` or `"softmax"`.
        name: The name of the model (string).

    Returns:
        A model instance.
    >   Nr	   zThe `weights` argument should be either `None` (random initialization), 'imagenet' (pre-training on ImageNet), or the path to the weights file to be loaded.r	   r
   zcIf using `weights='imagenet'` with `include_top=True`, `classes` should be 1000.  Received classes=i+  G   )default_sizemin_sizedata_formatrequire_flattenweightsN)shape)tensorr   channels_first       )   r   )   r   Fblock1_conv1)stridesuse_biasnameblock1_conv1_bn)axisr   relublock1_conv1_act)r   @   block1_conv2)r   r   block1_conv2_bnblock1_conv2_act   )r   r   same)r   paddingr   )r    block2_sepconv1)r)   r   r   block2_sepconv1_bnblock2_sepconv2_actblock2_sepconv2block2_sepconv2_bnblock2_pool)r   r)   r      block3_sepconv1_actblock3_sepconv1block3_sepconv1_bnblock3_sepconv2_actblock3_sepconv2block3_sepconv2_bnblock3_pooli  block4_sepconv1_actblock4_sepconv1block4_sepconv1_bnblock4_sepconv2_actblock4_sepconv2block4_sepconv2_bnblock4_pool   block   _sepconv1_act	_sepconv1_sepconv1_bn_sepconv2_act	_sepconv2_sepconv2_bn_sepconv3_act	_sepconv3_sepconv3_bni   block13_sepconv1_actblock13_sepconv1block13_sepconv1_bnblock13_sepconv2_actblock13_sepconv2block13_sepconv2_bnblock13_pooli   block14_sepconv1block14_sepconv1_bnblock14_sepconv1_acti   block14_sepconv2block14_sepconv2_bnblock14_sepconv2_actavg_poolpredictions)
activationr   avgmaxz.xception_weights_tf_dim_ordering_tf_kernels.h5models 0a58e3b7378bc2990ea3b43d5981f1f6)cache_subdir	file_hashz4xception_weights_tf_dim_ordering_tf_kernels_notop.h5 b0042744bf5b25fce3cb969f33bebb97)r   exists
ValueErrorr   obtain_input_shaper   image_data_formatr   Inputis_keras_tensorConv2DBatchNormalization
ActivationSeparableConv2DMaxPooling2DaddrangestrGlobalAveragePooling2Dvalidate_activationDenseGlobalMaxPooling2Dr   get_source_inputsr   get_fileWEIGHTS_PATHWEIGHTS_PATH_NO_TOPload_weights)include_topr   input_tensorinput_shapepoolingclassesclassifier_activationr   	img_inputchannel_axisxresidualiprefixinputsmodelweights_path r   Z/var/www/html/chatgem/venv/lib/python3.10/site-packages/keras/src/applications/xception.pyXception   s  L	






















r   z,keras.applications.xception.preprocess_inputc                 C   s   t j| |ddS )Ntf)r   mode)r   preprocess_input)r   r   r   r   r   r   R  s   r   z.keras.applications.xception.decode_predictionsrA   c                 C   s   t j| |dS )N)top)r   decode_predictions)predsr   r   r   r   r   Y  s   r    )r   reterror)Tr	   NNNr
   r   r   )N)rA   )	keras.srcr   r   keras.src.api_exportr   keras.src.applicationsr   keras.src.modelsr   keras.src.opsr   keras.src.utilsr   rv   rw   r   r   r   PREPROCESS_INPUT_DOCformatPREPROCESS_INPUT_RET_DOC_TFPREPROCESS_INPUT_ERROR_DOC__doc__r   r   r   r   <module>   sJ      ;