user836026
user836026

Reputation: 11350

How to break one Functional Resnet50 model into multiple layer

I created Resnet50 using:

     base_model = tf.keras.applications.ResNet50(include_top=False, weights=None, input_shape=(224, 224, 3))
    base_model.trainable = True
    
    inputs = Input((224, 224, 3))
    h = base_model(inputs, training=True)
    model = Model(inputs, projection_3)

model summary:

Layer (type)                Output Shape              Param #   
=================================================================
 input_image (InputLayer)    [(None, 256, 256, 3)]     0         
                                                                 
 resnet50 (Functional)       (None, 8, 8, 2048)        23587712  
                                                                 
=================================================================

Later, I realized I need to access some layer like this:

Resmodel.layers[4].output

However, I got:

IndexError: list index out of range

Is there away to break the Resnet50 funcational model into mutpile layer OR there away to access a certain layer of the model.

Upvotes: 0

Views: 111

Answers (1)

keertika jain
keertika jain

Reputation: 312

try this

model.layers[1].layers[4]

Upvotes: 1

Related Questions