Question:
How to update weights of a base Keras PointNet model?

Problem:

I trained a PointNet regression model and then saved it's weights by


model.save_weights('/home/rev9ai/aleef/Dainsta/model/beta_v0.weights.ckpt')


The saved files were


  • beta_v0.weights.ckpt.data-00000-of-00001

  • Beta_v0.weights.ckpt.index

Now I want to update a base PointNet model using these weights Here is how the model was built using Tensorflow:



# Define the PointNet architecture for regression

def build_pointnet_regression_model(num_points=2048):

    inputs = keras.Input(shape=(num_points, 3))

    

    x = tnet(inputs, 3)

    x = conv_bn(x, 32)

    x = conv_bn(x, 32)

    x = tnet(x, 32)

    x = conv_bn(x, 32)

    x = conv_bn(x, 64)

    x = conv_bn(x, 64) #additional

    x = conv_bn(x, 64) #additional

    x = conv_bn(x, 512)

    x = layers.GlobalMaxPooling1D()(x)

    x = dense_bn(x, 256)

    # x = layers.Dropout(0.3)(x)

    # x = dense_bn(x, 128)

    # x = layers.Dropout(0.3)(x)


    # Regression output layer

    outputs = layers.Dense(1, activation="relu")(x)

    

    model = keras.Model(inputs=inputs, outputs=outputs, name="pointnet_regression")

    return model


# Create the PointNet regression model

model = build_pointnet_regression_model(NUM_POINTS)


# Compile the model for regression

model.compile(

    loss="mean_absolute_error", 

    optimizer=keras.optimizers.RMSprop(learning_rate=0.1),

    metrics=["mean_absolute_error"],

)


Solution:


model.load_weights('location/to/weights.ckpt')


Suggested blogs:

>Invoking Python script from scons and pass ARGLIST

>Migrate From Haruko To AWS App: 5 Simple Steps

>PHP cURL to upload video to azure blob storage

>PHP Error Solved: htaccess problem with an empty string in URL

>Plugins and Presets for Vuejs project

>Python Error Solved: load_associated_files do not load a txt file

>Python Error Solved: pg_config executable not found

>Set up Node.js & connect to a MongoDB Database Using Node.js

>Setting up a Cloud Composer environment: Step-by-step guide


Nisha Patel

Nisha Patel

Submit
0 Answers