Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load a weight file containing 30 layers into a model with 33 layers. #9

Open
JackonLiu opened this issue Dec 11, 2017 · 0 comments
Open

Comments

@JackonLiu
Copy link

You are trying to load a weight file containing 30 layers into a model with 33 layers.
I don't understand how to change my layers?
Can I change my model or change the weights file from you?

This is my model clone from you
Can you help me to change this model?

def create_wide_residual_network(input, nb_classes=100, N=2, k=1, dropout=0.0, verbose=1):
"""
Creates a Wide Residual Network with specified parameters
:param input: Input Keras object
:param nb_classes: Number of output classes
:param N: Depth of the network. Compute N = (n - 4) / 6.
Example : For a depth of 16, n = 16, N = (16 - 4) / 6 = 2
Example2: For a depth of 28, n = 28, N = (28 - 4) / 6 = 4
Example3: For a depth of 40, n = 40, N = (40 - 4) / 6 = 6
:param k: Width of the network.
:param dropout: Adds dropout if value is greater than 0.0
:param verbose: Debug info to describe created WRN
:return:
"""
x = initial_conv(input)
nb_conv = 4

for i in range(N):
    x = conv1_block(x, k, dropout)
    nb_conv += 2

x = MaxPooling2D(pool_size=(2, 2), dim_ordering="th")(x)

# model.add()

for i in range(N):
    x = conv2_block(x, k, dropout)
    nb_conv += 2

x = MaxPooling2D(pool_size=(2, 2), dim_ordering="th")(x)

for i in range(N):
    x = conv3_block(x, k, dropout)
    nb_conv += 2

x = AveragePooling2D((3,8))(x)
x = Flatten()(x)

x = Dense(nb_classes,init="normal", activation='softmax')(x)
if verbose: print("Wide Residual Network-%d-%d created." % (nb_conv, k))
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant