Use of inception input in Model class

As discussed in the lecture, we are sampling the ‘mixed7’ layer from the InceptionV3 model, which considers layers until 7x7 convolutions.

So, while building the model with tensorflow.keras.layers.Model class

model= tensorflow.keras.layers.Model(pre_trained_model.input,x)

I understood that the first positional parameter defines the input size rather than the entire architecture itself. Here, x is the output configuration obtained by flattened and dense layers over the ‘mixed7’ configuration. Then the Model class builds the newer architecture by concatenating inputs and outputs.

So, based on my understanding, Is my below proposal is same as the one explained in the lecture?, or am I missing something?

ptm=tf.keras.Sequential(tf.keras.layers.Dense(units=1,input_shape=(150,150,3)))
model=Model(ptm.input,X)

#replaced pre_trained_model.input with tensorflow sequential dense layer of size 150,150,3

Thanks in advance

Please go through the functional api in tensorflow. The chain of layers from input(s) to output(s) defines the model.

To see if the model you’ve specified makes sense, print(your_model.summary())

It’s possible to specify a Model instance as a layer inside Sequential. The code will look like below:

transfer_submodel = tf.keras.Model(inputs=..., outputs=...)
final_model = tf.keras.Sequential([
    transfer_submodel,
    custom_layer1,
    custom_layer2,
    ...
])