Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tensorflow as tf
- model_file = "frozen_har1.pb"
- def load_graph(pbmodelFile):
- with tf.gfile.GFile(pbmodelFile, "rb") as f:
- graph_def = tf.GraphDef()
- graph_def.ParseFromString(f.read())
- with tf.Graph().as_default() as graph:
- tf.import_graph_def(graph_def)
- input_name = graph.get_operations()[0].name+':0'
- output_name = graph.get_operations()[-1].name+':0'
- return graph, input_name, output_name
- graph, inputName, outputName = load_graph(model_file)
- input_tensor = graph.get_tensor_by_name(inputName)
- output_tensor = graph.get_tensor_by_name(outputName)
- print(input_tensor)
- print(output_tensor)
- converter = tf.lite.TFLiteConverter.from_frozen_graph(model_file, ["input"], ["y_"])
- tflite_model = converter.convert()
- open("fallDetection2.tflite", "wb").write(tflite_model)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement