question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can i saved pretrained model as "savedmodel" tensorflow format ?

See original GitHub issue

trying to load the weight from checkpoint and save entire model as “.savedmodel” format. Here is my code:

cfg_path = os.path.join(os.path.dirname(__file__), 'configs/retinaface_res50.yaml')
checkpoint_path = os.path.join(os.path.dirname(__file__), 'checkpoints/cpkt-81')
saved_path = os.path.join(os.path.dirname(__file__), 'retinaface_res50')


def main(_):
    cfg = load_yaml(cfg_path)
    model = RetinaFaceModel(cfg, training=True)
    model.summary()
    model.load_weights(checkpoint_path).expect_partial()
    model.save(saved_path)

it seem cant load the weights by load_weights(): image

So how do i save pretrained model as a file in tf2 format ?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
JamesPiggottcommented, Nov 22, 2020

I would also like to know. Face detection models in saved model format are rare

0reactions
suraj-maniyarcommented, Apr 12, 2021

I was unable to convert this model to tflite using TFv2.2.0 due to NMS and other native Tensorflow operations. Getting this error : image

Has anyone figured out how to port RetinaFace to TensorFlow Lite?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the SavedModel format | TensorFlow Core
A SavedModel contains a complete TensorFlow program, including trained parameters (i.e, tf.Variable s) and computation. It does not require the original ...
Read more >
Save and load models | TensorFlow Core
An entire model can be saved in two different file formats ( SavedModel and HDF5 ). The TensorFlow SavedModel format is the default...
Read more >
Migrate the SavedModel workflow | TensorFlow Core
Save and export a SavedModel defined with tf.Module. To export your model in TensorFlow 2, you must define a tf.Module or a tf.keras....
Read more >
tf.saved_model.save | TensorFlow v2.11.0
SavedModels exported with tf.saved_model.save strip default-valued attributes automatically, which removes one source of incompatibilities when ...
Read more >
Export a SavedModel | TensorFlow Hub
This page describes the details of exporting (saving) a model from a TensorFlow program to the SavedModel format of TensorFlow 2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found