Issue
I got an Xception model.
Xception = tf.keras.applications.Xception(input_shape=(512, 512, 3), include_top=False)
I have combined the model to change the Input Channel to 3.
input_layer = keras.Input(shape=(512, 512, 1), name="img_input")
x = layers.UpSampling3D(size=(1, 1, 3), name="output")(input_layer)
input_model = keras.Model(input_layer, x, name="input_model")
model = keras.Model(input_model, Xception, name="model")
however I have got error
Input tensors to a Functional must come from `tf.keras.Input`. Received: <tensorflow.python.keras.engine.functional.Functional object at 0x7f922942a690> (missing previous layer metadata).
Solution
You simply have to embed Xception
in the correct way in your new model:
Xception = tf.keras.applications.Xception(input_shape=(512, 512, 3), include_top=False)
input_layer = tf.keras.Input(shape=(512, 512, 1), name="img_input")
x = tf.keras.layers.UpSampling3D(size=(1, 1, 3), name="upsampling")(input_layer)
output = Xception(x)
model = tf.keras.Model(input_layer, output, name="model")
We create a new Input
layer, than we operate upsampling and in the end we pass all to Xception
Here is the running notebook if you are interested
Answered By - Marco Cerliani
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.