Skip to content

Instantly share code, notes, and snippets.

@dipanjanS
Created August 15, 2019 09:06
Show Gist options
  • Save dipanjanS/653cf94b355ed3d674d187c6a7a60386 to your computer and use it in GitHub Desktop.
Save dipanjanS/653cf94b355ed3d674d187c6a7a60386 to your computer and use it in GitHub Desktop.
# load dependencies
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tf_explain.core.activations import ExtractActivations
from tensorflow.keras.applications.xception import decode_predictions
%matplotlib inline
# load Xception pre-trained CNN model
model = tf.keras.applications.xception.Xception(weights='imagenet',
include_top=True)
model.summary()
# Output
Model: "xception"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_1 (InputLayer) [(None, 299, 299, 3) 0
__________________________________________________________________________________________________
block1_conv1 (Conv2D) (None, 149, 149, 32) 864 input_1[0][0]
__________________________________________________________________________________________________
block1_conv1_bn (BatchNormaliza (None, 149, 149, 32) 128 block1_conv1[0][0]
__________________________________________________________________________________________________
...
...
__________________________________________________________________________________________________
block14_sepconv2_act (Activatio (None, 10, 10, 2048) 0 block14_sepconv2_bn[0][0]
__________________________________________________________________________________________________
avg_pool (GlobalAveragePooling2 (None, 2048) 0 block14_sepconv2_act[0][0]
__________________________________________________________________________________________________
predictions (Dense) (None, 1000) 2049000 avg_pool[0][0]
==================================================================================================
Total params: 22,910,480
Trainable params: 22,855,952
Non-trainable params: 54,528
__________________________________________________________________________________________________
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment