Created
December 14, 2018 19:27
-
-
Save bandiatindra/0d8cf46796275a99b607d1728fda3973 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taking the last convolutional layer | |
layer = model.layers[-4] | |
weights = layer.get_weights() | |
# Randomly initializing the weights of the last layer | |
new_kernel = np.random.normal(size=weights[0].shape)/(GRID_H*GRID_W) | |
new_bias = np.random.normal(size=weights[1].shape)/(GRID_H*GRID_W) | |
# Setting the weights of the last layer | |
layer.set_weights([new_kernel, new_bias]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment