Skip to content

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

@JackonLiu

Description

@JackonLiu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions