'convert saved_model.pbtxt to saved_model.pb in Tensorflow 2
I have used this script to convert a saved_model.pb to saved_model.pbtxt. I then went an modified some parameters (is_training: b: True). Now I would like to convert back to saved_model.pb for this to be read into tf2onnx.
def convert_saved_model_to_pbtxt(path):
import os, sys
import google.protobuf
from tensorflow.core.protobuf import saved_model_pb2
saved_model = saved_model_pb2.SavedModel()
with open(os.path.join(path, 'saved_model.pb'), 'rb') as f:
saved_model.ParseFromString(f.read())
with open(os.path.join(path, 'saved_model.pbtxt'), 'w') as f:
f.write(google.protobuf.text_format.MessageToString(saved_model))
What is the recommended way to convert this .pbtxt to ONNX?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
