-
Notifications
You must be signed in to change notification settings - Fork 33
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
[MobileFaceNet]ONNX to tflite模型转换异常 #18
Comments
输出128变1000是因为你导出的是mobilenet, # 你导出的onnx就是mobilenet
model = torchvision.models.mobilenet_v2(True) |
感谢博主的指正,请问这块应该改成什么样呢?有没有对应的model输出要求的必改格式对照表,或者置为缺省,是否可以根据导入的模型,自动转换? 另外是否还有其他错误,也辛苦博主帮忙指正? |
from converter import onnx_converter
onnx_converter(
onnx_model_path = "./input/face_recognition_sface_2021dec.onnx",#这里填你的模型地址
need_simplify = True,
output_path = "./",
target_formats = ['tflite'], # or ['keras'], ['keras', 'tflite']
weight_quant = False,
int8_model = False,
int8_mean = None,
int8_std = None,
image_root = None
) |
感谢解答,我将代码同步到最新,尝试博主提供的方法,还是遇到相同的output=1000的问题,我在另外一个github上看到一个onnx2tf的工具也是引用了博主的套件,感觉博主的工具很有潜力,不知博主是否方便继续帮忙确认下?问题具体描述如下:
转换所用脚本onnx2tflite.py
//转换结果异常部分:
另外我在另外一个github上看到一个组合工具:https://github.com/PINTO0309/onnx2tf 看到也是引用博主的工具,但是使用该工具,可以将onnx转换为tflite(但是从测试结果看,转换后精度不高,这个问题稍后再表)
谢谢博主 |
朋友,你还是转换的mobilenet,只是你把模型的名字写成了face_recognition_sface_2021dec.onnx。 |
@MPolaris
转换所用脚本onnx2tflite.py:
谢谢 |
@joyoki The reason why @joyoki said the accuracy is poor after conversion is clear. You may have been missing a parameter that should have been specified to onnx2tf. I have included the URL of the tflite model I converted so you can compare it to the model you converted. Also, Please see this issue for a detailed explanation of what causes accuracy degradation in my tool and how to resolve it.
Thank you very much for your time. Update Nov. 4, 2022: In some situations, the tool has been modified so that the |
@joyoki 朋友,你重新去face_recognition_sface_2021dec.onnx下一个,然后再用工具转呀。 |
Hi 博主,
感谢你提供的工具,我在转换mobilefacenet 模型的时候,遇到以下几个问题,不知能否帮忙解答:
【问题描述】
1.onnx2tflite之后,模型输出由128变成1000
2.将生成的模型导入APK验证,脸部检测功能能正常工作,但是但是人脸识别功能失效
此处暂未提供LOG,优先确认问题1
2.生成的tflite模型尺寸几乎和onnx大小相当,未见尺寸优化
2210311357更新:tflite模型偏大的问题不知道是不是该文档提到大的,onnx转tflite需要去冗余操作:https://zhuanlan.zhihu.com/p/363317178
【所使用转换脚本】
使用博主的参考py,改成如下onnx2tflite.py
[相关模型]:
1.我所转换的模型为opencv_zoo/models/face_recognition_sface/
1.face_recognition_sface_2021dec-act_int8-wt_int8-quantized.onnx
2.face_recognition_sface_2021dec.onnx
原始模型链接为:https://github.com/opencv/opencv_zoo/tree/master/models/face_recognition_sface
谢谢解答
The text was updated successfully, but these errors were encountered: