
    6bi?                        S r SSKJs  Jr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  SSKJr  SS	KJr  S
rSr\" 5       r\" SS5             SS j5       r SS jr\" S5      SS j5       r\" S5      SS j5       r\R2                  R5                  S\R6                  \R8                  S9\l         \R0                  R                   \l         g)zInception V3 model for TF-Keras.

Reference:
  - [Rethinking the Inception Architecture for Computer Vision](
      http://arxiv.org/abs/1512.00567) (CVPR 2016)
    N)backend)imagenet_utils)training)VersionAwareLayers)
data_utils)layer_utils)keras_exportz|https://storage.googleapis.com/tensorflow/keras-applications/inception_v3/inception_v3_weights_tf_dim_ordering_tf_kernels.h5zhttps://storage.googleapis.com/tensorflow/keras-applications/inception_v3/inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5z+keras.applications.inception_v3.InceptionV3zkeras.applications.InceptionV3c           
      b   US;   d<  [         R                  R                  R                  U5      (       d  [	        SU 35      eUS:X  a  U (       a  US:w  a  [	        SU 35      e[
        R                  " USS[        R                  " 5       U US9nUc  [        R                  US	9nO1[        R                  " U5      (       d  [        R                  X#S
9nOUn[        R                  " 5       S:X  a  SnOSn[        USSSSSS9n	[        U	SSSSS9n	[        U	SSS5      n	[        R                  SSS9" U	5      n	[        U	SSSSS9n	[        U	SSSSS9n	[        R                  SSS9" U	5      n	[        U	SSS5      n
[        U	SSS5      n[        USSS5      n[        U	SSS5      n[        USSS5      n[        USSS5      n[        R                  SSSS9" U	5      n[        USSS5      n[        R                  XX/USS9n	[        U	SSS5      n
[        U	SSS5      n[        USSS5      n[        U	SSS5      n[        USSS5      n[        USSS5      n[        R                  SSSS9" U	5      n[        USSS5      n[        R                  XX/USS9n	[        U	SSS5      n
[        U	SSS5      n[        USSS5      n[        U	SSS5      n[        USSS5      n[        USSS5      n[        R                  SSSS9" U	5      n[        USSS5      n[        R                  XX/US S9n	[        U	S!SSSSS9n[        U	SSS5      n[        USSS5      n[        USSSSSS9n[        R                  SSS9" U	5      n[        R                  XU/US"S9n	[        U	SSS5      n
[        U	S#SS5      n[        US#SS$5      n[        USS$S5      n[        U	S#SS5      n[        US#S$S5      n[        US#SS$5      n[        US#S$S5      n[        USSS$5      n[        R                  SSSS9" U	5      n[        USSS5      n[        R                  XUU/US%S9n	[!        S&5       H  n[        U	SSS5      n
[        U	S'SS5      n[        US'SS$5      n[        USS$S5      n[        U	S'SS5      n[        US'S$S5      n[        US'SS$5      n[        US'S$S5      n[        USSS$5      n[        R                  SSSS9" U	5      n[        USSS5      n[        R                  XUU/US([#        SU-   5      -   S9n	M     [        U	SSS5      n
[        U	SSS5      n[        USSS$5      n[        USS$S5      n[        U	SSS5      n[        USS$S5      n[        USSS$5      n[        USS$S5      n[        USSS$5      n[        R                  SSSS9" U	5      n[        USSS5      n[        R                  XUU/US)S9n	[        U	SSS5      n[        US*SSSSS9n[        U	SSS5      n[        USSS$5      n[        USS$S5      n[        USSSSSS9n[        R                  SSS9" U	5      n[        R                  UUU/US+S9n	[!        S&5       H  n[        U	S*SS5      n
[        U	S!SS5      n[        US!SS5      n[        US!SS5      n[        R                  UU/US,[#        U5      -   S9n[        U	S-SS5      n[        US!SS5      n[        US!SS5      n[        US!SS5      n[        R                  UU/US.9n[        R                  SSSS9" U	5      n[        USSS5      n[        R                  XX/US([#        S/U-   5      -   S9n	M     U (       aJ  [        R%                  S0S19" U	5      n	[
        R&                  " Xa5        [        R)                  XVS2S39" U	5      n	OAUS4:X  a  [        R%                  5       " U	5      n	O US5:X  a  [        R+                  5       " U	5      n	Ub  [,        R.                  " U5      nOUn[0        R2                  " UU	S6S19nUS:X  aQ  U (       a  [4        R6                  " S7[8        S8S9S:9nO[4        R6                  " S;[:        S8S<S:9nUR=                  U5        U$ Ub  UR=                  U5        U$ )=a4  Instantiates the Inception v3 architecture.

Reference:
- [Rethinking the Inception Architecture for Computer Vision](
    http://arxiv.org/abs/1512.00567) (CVPR 2016)

This function returns a TF-Keras image classification model,
optionally loaded with weights pre-trained on ImageNet.

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/).

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

Args:
  include_top: Boolean, whether to include the fully-connected
    layer at the top, as the last layer of the network. Defaults to `True`.
  weights: One of `None` (random initialization),
    `imagenet` (pre-training on ImageNet),
    or the path to the weights file to be loaded. Defaults to `imagenet`.
  input_tensor: Optional TF-Keras tensor (i.e. output of `layers.Input()`)
    to use as image input for the model. `input_tensor` is useful for
    sharing inputs between multiple different networks. Defaults to `None`.
  input_shape: Optional shape tuple, only to be specified
    if `include_top` is False (otherwise the input shape
    has to be `(299, 299, 3)` (with `channels_last` data format)
    or `(3, 299, 299)` (with `channels_first` data format).
    It should have exactly 3 inputs channels,
    and width and height should be no smaller than 75.
    E.g. `(150, 150, 3)` would be one valid value.
    `input_shape` will be ignored if the `input_tensor` is provided.
  pooling: Optional pooling mode for feature extraction
    when `include_top` is `False`.
    - `None` (default) 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"`.

Returns:
  A `keras.Model` instance.
>   NimagenetzThe `weights` argument should be either `None` (random initialization), `imagenet` (pre-training on ImageNet), or the path to the weights file to be loaded; Received: weights=r     zjIf using `weights` as `"imagenet"` with `include_top` as true, `classes` should be 1000; Received classes=i+  K   )default_sizemin_sizedata_formatrequire_flattenweights)shape)tensorr   channels_first          )   r   valid)stridespadding)r   @   )r   r   )r   P      0      `   r   r   samemixed0)axisnamemixed1mixed2i  mixed3      mixed4r      mixedmixed7i@  mixed8mixed9_i  )r&   	   avg_poolr'   predictions)
activationr'   avgmaxinception_v3z2inception_v3_weights_tf_dim_ordering_tf_kernels.h5models 9a0d58056eeedaa3f26cb7ebd46da564)cache_subdir	file_hashz8inception_v3_weights_tf_dim_ordering_tf_kernels_notop.h5 bcbd6486424b2319ff4ef7d526e38f63)tfiogfileexists
ValueErrorr   obtain_input_shaper   image_data_formatlayersInputis_keras_tensor	conv2d_bnMaxPooling2DAveragePooling2DconcatenaterangestrGlobalAveragePooling2Dvalidate_activationDenseGlobalMaxPooling2Dr   get_source_inputsr   Modelr   get_fileWEIGHTS_PATHWEIGHTS_PATH_NO_TOPload_weights)include_topr   input_tensorinput_shapepoolingclassesclassifier_activation	img_inputchannel_axisx	branch1x1	branch5x5branch3x3dblbranch_pool	branch3x3	branch7x7branch7x7dblibranch7x7x3branch3x3_1branch3x3_2branch3x3dbl_1branch3x3dbl_2inputsmodelweights_paths                             `/home/james-whalen/.local/lib/python3.13/site-packages/tf_keras/src/applications/inception_v3.pyInceptionV3rt   /   sA
   T ))RUU[[-?-?-H-H! ")		+
 	
 *D  'y*
 	
 !33--/#K LL{L3	&&|44LLI$I  "&66)RAvwGA!RAw/A!RAAFF3A6A!RAw/A!S!Q0AFF3A6A !RA&I!RA&I)RA.IQAq)L\2q!4L\2q!4L)) * 	K KQ2K	|9 	 	A !RA&I!RA&I)RA.IQAq)L\2q!4L\2q!4L)) * 	K KQ2K	|9 	 	A !RA&I!RA&I)RA.IQAq)L\2q!4L\2q!4L)) * 	K KQ2K	|9 	 	A !S!QHIQAq)L\2q!4Lb!QL %%ff%=a@K	+.\ 	 	A
 !S!Q'I!S!Q'I)S!Q/I)S!Q/IQQ*L\315L\315L\315L\315L)) * 	K Ka3K	|[9 	 	A 1Xaa+	aa+	ia3	ia3	 CA. sAq9 sAq9 sAq9 sAq9--FF . 

  S!Q7<=3q1u:%  
# 0 !S!Q'I!S!Q'I)S!Q/I)S!Q/IQQ*L\315L\315L\315L\315L)) * 	K Ka3K	|[9 	 	A !S!Q'I)S!QPIAsAq)KKa3KKa3KS!QK %%ff%=a@K	K-Lx 	 	A
 1Xaa+	aa+		315	315&&+&SV# ' 
	 !CA. sAq9"<a;"<a;))^,< * 
 --FF . 

  S!Q7<=3q1u:%  
1 : ))z):1=**+@JLLM  

 e--/2A))+A.A ..|<NN61>:E *%..D%<	L &..J#%<	L 	<( L 
	7#L    c           	         Ub  US-   nUS-   nOSnSn[         R                  " 5       S:X  a  Sn	OSn	[        R                  UX#4UUSUS9" U 5      n [        R	                  U	SUS	9" U 5      n [        R                  S
US9" U 5      n U $ )a  Utility function to apply conv + BN.

Args:
  x: input tensor.
  filters: filters in `Conv2D`.
  num_row: height of the convolution kernel.
  num_col: width of the convolution kernel.
  padding: padding mode in `Conv2D`.
  strides: strides in `Conv2D`.
  name: name of the ops; will become `name + '_conv'`
    for the convolution and `name + '_bn'` for the
    batch norm layer.

Returns:
  Output tensor after applying `Conv2D` and `BatchNormalization`.
N_bn_convr   r   r   F)r   r   use_biasr'   )r&   scaler'   relur5   )r   rF   rG   Conv2DBatchNormalization
Activation)
rb   filtersnum_rownum_colr   r   r'   bn_name	conv_namebn_axiss
             rs   rJ   rJ     s    & ,7N		  "&66	 	 	 		A 	!!we'!J1MA&t,Q/AHru   z0keras.applications.inception_v3.preprocess_inputc                 ,    [         R                  " XSS9$ )Nr@   )r   mode)r   preprocess_input)rb   r   s     rs   r   r     s    **	 ru   z2keras.applications.inception_v3.decode_predictionsc                 *    [         R                  " XS9$ )N)top)r   decode_predictions)predsr   s     rs   r   r     s    ,,U<<ru    )r   reterror)Tr   NNNr   softmax)r$   r#   N)N)r!   )__doc__tensorflow.compat.v2compatv2r@   tf_keras.srcr   tf_keras.src.applicationsr   tf_keras.src.enginer   tf_keras.src.layersr   tf_keras.src.utilsr   r    tensorflow.python.util.tf_exportr	   rW   rX   rG   rt   rJ   r   r   PREPROCESS_INPUT_DOCformatPREPROCESS_INPUT_RET_DOC_TFPREPROCESS_INPUT_ERROR_DOC ru   rs   <module>r      s    " !   4 ( 2 ) * :F 
L 
 
	 1$
 #^	^D HL'T @A B BC= D= *>>EE	22

3
3 F   
 ,>>FF  ru   