Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to create frozen graph, so i can convert it into tflite for android #110

Open
meenu92 opened this issue Oct 16, 2020 · 0 comments
Open

Comments

@meenu92
Copy link

meenu92 commented Oct 16, 2020

Hi,

I am using the below script for creating frozen graph by given checkpoints and saved_model.pb file.
checkpoint path : "data/checkpoints/rgb_imagenet/model.ckpt" in this directory
saved model link : https://tfhub.dev/deepmind/i3d-kinetics-400/1
When i was going to load checkpoint, it shows None, after running the script 0kb frozen graph is created.

Are these checkpoint is correct for the model downloaded from above hub?

`import tensorflow as tf
import i3d

input = tf.placeholder(tf.float32, shape=(1, 79, 224, 224, 3))

with tf.variable_scope('RGB'):
model = i3d.InceptionI3d()
logits, _ = model(input, is_training=False)

variable_map = {}
for variable in tf.global_variables():
variable_map[variable.name.replace(':0', '')] = variable

saver = tf.train.Saver(var_list=variable_map, reshape=True)

model_logits = logits
model_predictions = tf.nn.softmax(model_logits)

with tf.Session() as sess:
saver.restore(sess, "data/checkpoints/rgb_imagenet/model.ckpt")
tf.logging.info('RGB checkpoint restored')

out_graph = tf.graph_util.convert_variables_to_constants(sess,
    tf.get_default_graph().as_graph_def(), ["Softmax"])

f = tf.gfile.GFile("i3d-rgb.frozen.pb", "wb")
f.write(out_graph.SerializeToString())`

can you help me to solve this issue ? Or any other way to use it with mobile ?
I have to use this model in android.

Thanks In Advance
Meenakshi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant