albertomontesg / keras-model-zoo

Keras Model Zoo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to fine tune the last layer of this C3D model?

bryanyzhu opened this issue · comments

Hi @albertomontesg , I checked online about fine tuning the last layer in Keras. and it seems that using model.layers.pop() first, and then add the my desired output layer is a simple way.

However,
i tried this,
.................................................
model.add(Dense(487, activation='softmax', name='fc8'))
model.layers.pop()
model.add(Dense(200, activation='softmax', name='fc8'))
model.compile(loss='sparse_categorical_crossentropy', optimizer='sgd', metrics=['accuracy'])

But the error came out: Exception: The name "fc8" is used 2 times in the model. All layer names should be unique.

But I print model.summary() after i pop the last layer, the fc-8 layer indeed poped out already. Why the name is still used 2 times in the model.

thanks a lot for any suggestions.

already solved, thanks @albertomontesg

@bryanyzhu I submitted a pull request to implement this functionality:
keras-team/keras#2418