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
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"],
)
model.load_weights('location/to/weights.ckpt')
That's how you load weights. Just build/ define the model as usual and then load pre-saved weights.