Skip to content

Possible to get model weights as .pb file? #18

Description

@JohnMBrandt

hi,

Very incredible paper. Really cool to see the ability to pick up the small clouds and cloud shadows compared to Maja & Fmask.

I'd like to test applying the L2A UNet model in my existing Tensorflow-based image segmentation pipeline. I currently use something like the following to save my model weights

saver.restore(sess,tf.train.latest_checkpoint(meta_path))
output_node_names = ['conv2d_13/Sigmoid']

# Freeze the graph
frozen_graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def,
     output_node_names)

with open('../../models/620-240-apr/predict_graph.pb', 'wb') as f:
     f.write(frozen_graph_def.SerializeToString())"

and then something like the following to load them:

 predict_file = tf.io.gfile.GFile(args.predict_model_path + "predict_graph.pb", 'rb')
 predict_graph_def.ParseFromString(predict_file.read())
 predict_graph = tf.import_graph_def(predict_graph_def, name='predict')

Do you know if it would be possible to make something like this out of then .hdf5 file for the U-Net weights? do you know the input, output variable names? This is the only way I know to have multiple TF graphs in memory at once -- I have one for doing model predictions, one for super resolving 20m band to 10m, and would have a third graph with your model weights

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions