-
Notifications
You must be signed in to change notification settings - Fork 78
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
关于moilefacenet的pb模型转换成tf.lite #14
Comments
import tensorflow as tf in_path = "../output/mobilefacenet/frozen_graphs/MobileFaceNet.pb" input_tensor_name = ["input"] converter = tf.lite.TFLiteConverter.from_frozen_graph(in_path, input_tensor_name, with open(out_path, "wb") as f: |
我用你的代码依然不行,和版本有关系吗。我是1.15现在 |
还是保错,这是因为什么呢,请问你使用的是他原来的pb吗,假如不是,你是否是更改了他的代码,然后使得可以转换呢。似乎他原来的代码中生成的模型有程序控制流
2020-04-26 14:25:02.322529: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 2421 operators, 4174 arrays (0 quantized)
2020-04-26 14:25:02.711969: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] After Removing unused ops pass 1: 1484 operators, 2717 arrays (0 quantized)
2020-04-26 14:25:03.052979: I tensorflow/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 1484 operators, 2717 arrays (0 quantized)
2020-04-26 14:25:03.066037: F .\tensorflow/lite/toco/toco_tooling.h:38] Check failed: s.ok() Found BatchNormalization as non-selected output from Switch, but only Merge supported. Control flow ops like Switch and Merge are not generally supported. We are working on fixing this, please see the Github issue at tensorflow/tensorflow#28485.
Fatal Python error: Aborted
…------------------ 原始邮件 ------------------
发件人: "syaringan357"<[email protected]>;
发送时间: 2020年4月26日(星期天) 中午1:59
收件人: "syaringan357/Android-MobileFaceNet-MTCNN-FaceAntiSpoofing"<[email protected]>;
抄送: "2459431805"<[email protected]>;"Author"<[email protected]>;
主题: Re: [syaringan357/Android-MobileFaceNet-MTCNN-FaceAntiSpoofing] 关于moilefacenet的pb模型转换成tf.lite (#14)
-- coding:utf-8 --
import tensorflow as tf
in_path = "../output/mobilefacenet/frozen_graphs/MobileFaceNet.pb"
out_path = "../output/mobilefacenet/tflite/MobileFaceNet.tflite"
模型输入节点
input_tensor_name = ["input"]
input_tensor_shape = {"input": [2, 112, 112, 3]}
模型输出节点
classes_tensor_name = ["embeddings"]
converter = tf.lite.TFLiteConverter.from_frozen_graph(in_path, input_tensor_name,
classes_tensor_name, input_shapes=input_tensor_shape)
converter.allow_custom_ops = True
#converter.post_training_quantize = True
tflite_model = converter.convert()
with open(out_path, "wb") as f:
f.write(tflite_model)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
哦,我不是用他原来那个pb转的,用他的ckpt重新固化一个pb,再转。 |
import os training_checkpoint = "../output/mobilefacenet/MobileFaceNet_TF.ckpt" def freeze_graph_def(sess, output_node_names): def save():
if name == 'main': |
凑合看把 上面都是代码 |
谢谢大佬,跪谢。 |
大哥,再问个问题,就是这一句output, _ = inference(data_input, bottleneck_layer_size=192) |
我也不太清楚,我也是按报错提示改的。可能是他一些代码经过长时间修改之后对不上了。 |
这样啊,谢谢了。
…------------------ 原始邮件 ------------------
发件人: "syaringan357"<[email protected]>;
发送时间: 2020年5月6日(星期三) 上午9:42
收件人: "syaringan357/Android-MobileFaceNet-MTCNN-FaceAntiSpoofing"<[email protected]>;
抄送: "2459431805"<[email protected]>;"Author"<[email protected]>;
主题: Re: [syaringan357/Android-MobileFaceNet-MTCNN-FaceAntiSpoofing] 关于moilefacenet的pb模型转换成tf.lite (#14)
我也不太清楚,我也是按报错提示改的。可能是他一些代码经过长时间修改之后对不上了。
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
你好,请问这个问题解决了吗?方便说一下解决方法嘛?多谢 |
你好,你可以看作者发的代码,可以解决,当时,我就是用他的代码,现在我代码找不到了。换了块硬盘,找起来费劲得很。你如果用他的代码无语,那就正好,如果有误,我就再找找 |
Hi, I'm encouting the same problem and cannot solve this. My approach is to change 'Switch' op -> 'If' and 'Merge' -> 'While' but didn't work. Any suggestion? Tks :D |
sorry,I don't learn it so long,I forgeted it.
…---原始邮件---
发件人: ***@***.***>
发送时间: 2021年12月31日(周五) 下午4:58
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [syaringan357/Android-MobileFaceNet-MTCNN-FaceAntiSpoofing] 关于moilefacenet的pb模型转换成tf.lite (#14)
Hi, I'm encouting the same problem and cannot solve this. My approach is to change 'Switch' op -> 'If' and 'Merge' -> 'While' but didn't work. Any suggestion? Tks :D
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
But how can you export a tflite version from the model? :o |
您好,为什么您这里的batchsize 设置成 2呢,不应该是1吗? |
你好请问你的pb模型是这么转换到lite,模型的,我现在在tf的1.80,1.12-1.15都试过,但总是转不了,请问你当时是怎么转换的呢。
The text was updated successfully, but these errors were encountered: